DrmSessionManager


@UnstableApi
interface DrmSessionManager

Known direct subclasses
DefaultDrmSessionManager

A DrmSessionManager that supports playbacks using ExoMediaDrm.


Manages a DRM session.

Summary

Nested types

Represents a single reference count of a DrmSession, while deliberately not giving access to the underlying session.

Constants

const DrmSessionManager!

An instance that supports no DRM schemes.

const DrmSessionManager!

This property is deprecated.

Use DRM_UNSUPPORTED.

Public functions

DrmSession?
acquireSession(
    eventDispatcher: DrmSessionEventListener.EventDispatcher?,
    format: Format!
)

Returns a DrmSession for the specified Format, with an incremented reference count.

Int

Returns the C.CryptoType that the DRM session manager will use for a given .

java-static DrmSessionManager!

This function is deprecated.

Use DRM_UNSUPPORTED.

DrmSessionManager.DrmSessionReference!
preacquireSession(
    eventDispatcher: DrmSessionEventListener.EventDispatcher?,
    format: Format!
)

Pre-acquires a DRM session for the specified Format.

Unit

Acquires any required resources.

Unit

Releases any acquired resources.

Unit
setPlayer(playbackLooper: Looper!, playerId: PlayerId!)

Sets information about the player using this DRM session manager.

Constants

DRM_UNSUPPORTED

const val DRM_UNSUPPORTEDDrmSessionManager!

An instance that supports no DRM schemes.

DUMMY

const val DUMMYDrmSessionManager!

An instance that supports no DRM schemes.

Public functions

acquireSession

fun acquireSession(
    eventDispatcher: DrmSessionEventListener.EventDispatcher?,
    format: Format!
): DrmSession?

Returns a DrmSession for the specified Format, with an incremented reference count. May return null if the drmInitData is null and the DRM session manager is not configured to attach a DrmSession to clear content. When the caller no longer needs to use a returned DrmSession, it must call release to decrement the reference count.

If the provided Format contains a null drmInitData, the returned DrmSession (if not null) will be a placeholder session which does not execute key requests, and cannot be used to handle encrypted content. However, a placeholder session may be used to configure secure decoders for playback of clear content periods, which can reduce the cost of transitioning between clear and encrypted content.

Parameters
eventDispatcher: DrmSessionEventListener.EventDispatcher?

The DrmSessionEventListener.EventDispatcher used to distribute events, and passed on to acquire.

format: Format!

The Format for which to acquire a DrmSession.

Returns
DrmSession?

The DRM session. May be null if the given drmInitData is null.

getCryptoType

@C.CryptoType
fun getCryptoType(format: Format!): Int

Returns the C.CryptoType that the DRM session manager will use for a given . Returns CRYPTO_TYPE_UNSUPPORTED if the manager does not support any of the DRM schemes defined in the Format. Returns CRYPTO_TYPE_NONE if drmInitData is null and acquireSession will return null for the given Format.

Parameters
format: Format!

The Format.

Returns
Int

The C.CryptoType that the manager will use, or @link C#CRYPTO_TYPE_UNSUPPORTED} if the manager does not support any of the DRM schemes defined in the Format. Will be CRYPTO_TYPE_NONE if drmInitData is null and acquireSession will return null for the given Format.

getDummyDrmSessionManager

java-static fun getDummyDrmSessionManager(): DrmSessionManager!

Returns DRM_UNSUPPORTED.

preacquireSession

fun preacquireSession(
    eventDispatcher: DrmSessionEventListener.EventDispatcher?,
    format: Format!
): DrmSessionManager.DrmSessionReference!

Pre-acquires a DRM session for the specified Format.

This notifies the manager that a subsequent call to acquireSession with the same Format is likely, allowing a manager that supports pre-acquisition to get the required DrmSession ready in the background.

The caller must call release on the returned instance when they no longer require the pre-acquisition (i.e. they know they won't be making a matching call to acquireSession in the near future).

This manager may silently release the underlying session in order to allow another operation to complete. This will result in a subsequent call to acquireSession re-initializing a new session, including repeating key loads and other async initialization steps.

The caller must separately call acquireSession in order to obtain a session suitable for playback. The pre-acquired DrmSessionReference and full DrmSession instances are distinct. The caller must release both, and can release the DrmSessionReference before the DrmSession without affecting playback.

This can be called from any thread.

Implementations that do not support pre-acquisition always return an empty instance.

Parameters
eventDispatcher: DrmSessionEventListener.EventDispatcher?

The DrmSessionEventListener.EventDispatcher used to distribute events, and passed on to acquire.

format: Format!

The Format for which to pre-acquire a DrmSession.

Returns
DrmSessionManager.DrmSessionReference!

A releaser for the pre-acquired session. Guaranteed to be non-null even if the matching acquireSession would return null.

prepare

fun prepare(): Unit

Acquires any required resources.

release must be called to ensure the acquired resources are released. After releasing, an instance may be re-prepared.

release

fun release(): Unit

Releases any acquired resources.

setPlayer

fun setPlayer(playbackLooper: Looper!, playerId: PlayerId!): Unit

Sets information about the player using this DRM session manager.

Parameters
playbackLooper: Looper!

The Looper associated with the player's playback thread.

playerId: PlayerId!

The PlayerId of the player.