Back to Exoplayer

DrmSessionManager (ExoPlayer library)

docs/doc/reference/com/google/android/exoplayer2/drm/DrmSessionManager.html

latest13.2 KB
Original Source

Package com.google.android.exoplayer2.drm

Interface DrmSessionManager

  • All Known Implementing Classes:DefaultDrmSessionManager

[@Deprecated](https://developer.android.com/reference/java/lang/Deprecated.html "class or interface in java.lang")public interfaceDrmSessionManager

Deprecated. com.google.android.exoplayer2 is deprecated. Please migrate to androidx.media3 (which contains the same ExoPlayer code). See the migration guide for more details, including a script to help with the migration.

Manages a DRM session.

Nested Class Summary

Nested Classes | Modifier and Type | Interface | Description | | --- | --- | --- | | static interface | DrmSessionManager.DrmSessionReference | Deprecated.

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

Field Summary

Fields | Modifier and Type | Field | Description | | --- | --- | --- | | static DrmSessionManager | DRM_UNSUPPORTED | Deprecated.

An instance that supports no DRM schemes. | | static DrmSessionManager | DUMMY | Deprecated. Use DRM_UNSUPPORTED.

|

Method Summary

All Methods Static Methods Instance Methods Abstract Methods Default Methods Deprecated Methods | Modifier and Type | Method | Description | | --- | --- | --- | | DrmSession | acquireSession​(DrmSessionEventListener.EventDispatcher eventDispatcher, Format format) | Deprecated.

Returns a DrmSession for the specified Format, with an incremented reference count. | | @com.google.android.exoplayer2.C.CryptoType int | getCryptoType​(Format format) | Deprecated.

Returns the C.CryptoType that the DRM session manager will use for a given Format. | | static DrmSessionManager | getDummyDrmSessionManager() | Deprecated. Use DRM_UNSUPPORTED.

| | default DrmSessionManager.DrmSessionReference | preacquireSession​(DrmSessionEventListener.EventDispatcher eventDispatcher, Format format) | Deprecated.

Pre-acquires a DRM session for the specified Format. | | default void | prepare() | Deprecated.

Acquires any required resources. | | default void | release() | Deprecated.

Releases any acquired resources. | | void | setPlayer​(Looper playbackLooper, PlayerId playerId) | Deprecated.

Sets information about the player using this DRM session manager. |

Field Detail

- 

DRM_UNSUPPORTED

static final[DrmSessionManager](DrmSessionManager.html "interface in com.google.android.exoplayer2.drm")DRM_UNSUPPORTED

Deprecated.

An instance that supports no DRM schemes.

- 

DUMMY

[@Deprecated](https://developer.android.com/reference/java/lang/Deprecated.html "class or interface in java.lang")static final[DrmSessionManager](DrmSessionManager.html "interface in com.google.android.exoplayer2.drm")DUMMY

Deprecated. Use DRM_UNSUPPORTED.

An instance that supports no DRM schemes.

Method Detail

- 

getDummyDrmSessionManager

[@Deprecated](https://developer.android.com/reference/java/lang/Deprecated.html "class or interface in java.lang")static[DrmSessionManager](DrmSessionManager.html "interface in com.google.android.exoplayer2.drm")getDummyDrmSessionManager()

Deprecated. Use DRM_UNSUPPORTED.

Returns DRM_UNSUPPORTED.

- 

prepare

default void prepare()

Deprecated.

Acquires any required resources.

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

- 

release

default void release()

Deprecated.

Releases any acquired resources.

- 

setPlayer

void setPlayer​([Looper](https://developer.android.com/reference/android/os/Looper.html "class or interface in android.os")playbackLooper,[PlayerId](../analytics/PlayerId.html "class in com.google.android.exoplayer2.analytics")playerId)

Deprecated.

Sets information about the player using this DRM session manager. Parameters:playbackLooper - The Looper associated with the player's playback thread.playerId - The PlayerId of the player.

- 

preacquireSession

default[DrmSessionManager.DrmSessionReference](DrmSessionManager.DrmSessionReference.html "interface in com.google.android.exoplayer2.drm")preacquireSession​(@Nullable[DrmSessionEventListener.EventDispatcher](DrmSessionEventListener.EventDispatcher.html "class in com.google.android.exoplayer2.drm")eventDispatcher,[Format](../Format.html "class in com.google.android.exoplayer2")format)

Deprecated.

Pre-acquires a DRM session for the specified Format.

This notifies the manager that a subsequent call to acquireSession( DrmSessionEventListener.EventDispatcher, Format) 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 DrmSessionManager.DrmSessionReference.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(DrmSessionEventListener.EventDispatcher, Format) 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( DrmSessionEventListener.EventDispatcher, Format) re-initializing a new session, including repeating key loads and other async initialization steps.

The caller must separately call acquireSession( DrmSessionEventListener.EventDispatcher, Format) in order to obtain a session suitable for playback. The pre-acquired DrmSessionManager.DrmSessionReference and full DrmSession instances are distinct. The caller must release both, and can release the DrmSessionManager.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 DrmSessionManager.DrmSessionReference instance.

Parameters:eventDispatcher - The DrmSessionEventListener.EventDispatcher used to distribute events, and passed on to DrmSession.acquire(DrmSessionEventListener.EventDispatcher).format - The Format for which to pre-acquire a DrmSession.Returns:A releaser for the pre-acquired session. Guaranteed to be non-null even if the matching acquireSession(DrmSessionEventListener.EventDispatcher, Format) would return null.

- 

acquireSession

@Nullable[DrmSession](DrmSession.html "interface in com.google.android.exoplayer2.drm")acquireSession​(@Nullable[DrmSessionEventListener.EventDispatcher](DrmSessionEventListener.EventDispatcher.html "class in com.google.android.exoplayer2.drm")eventDispatcher,[Format](../Format.html "class in com.google.android.exoplayer2")format)

Deprecated.

Returns a DrmSession for the specified Format, with an incremented reference count. May return null if the Format.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 DrmSession.release(DrmSessionEventListener.EventDispatcher) to decrement the reference count.

If the provided Format contains a null Format.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 - The DrmSessionEventListener.EventDispatcher used to distribute events, and passed on to DrmSession.acquire(DrmSessionEventListener.EventDispatcher).format - The Format for which to acquire a DrmSession.Returns:The DRM session. May be null if the given Format.drmInitData is null.

- 

getCryptoType

@com.google.android.exoplayer2.C.CryptoType int getCryptoType​([Format](../Format.html "class in com.google.android.exoplayer2")format)

Deprecated.

Returns the C.CryptoType that the DRM session manager will use for a given Format. Returns C.CRYPTO_TYPE_UNSUPPORTED if the manager does not support any of the DRM schemes defined in the Format. Returns C.CRYPTO_TYPE_NONE if Format.drmInitData is null and acquireSession(com.google.android.exoplayer2.drm.DrmSessionEventListener.EventDispatcher, com.google.android.exoplayer2.Format) will return null for the given Format. Parameters:format - The Format.Returns: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 C.CRYPTO_TYPE_NONE if Format.drmInitData is null and acquireSession(com.google.android.exoplayer2.drm.DrmSessionEventListener.EventDispatcher, com.google.android.exoplayer2.Format) will return null for the given Format.