docs/doc/reference/com/google/android/exoplayer2/drm/DefaultDrmSessionManager.html
Package com.google.android.exoplayer2.drm
All Implemented Interfaces:DrmSessionManager
@RequiresApi(18)[@Deprecated](https://developer.android.com/reference/java/lang/Deprecated.html "class or interface in java.lang")public classDefaultDrmSessionManagerextends[Object](https://developer.android.com/reference/java/lang/Object.html "class or interface in java.lang")implements[DrmSessionManager](DrmSessionManager.html "interface in com.google.android.exoplayer2.drm")
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.
A DrmSessionManager that supports playbacks using ExoMediaDrm.
This implementation supports pre-acquisition of sessions using preacquireSession(DrmSessionEventListener.EventDispatcher, Format).
Nested Classes | Modifier and Type | Class | Description |
| --- | --- | --- |
| static class | DefaultDrmSessionManager.Builder |
Deprecated.
Builder for DefaultDrmSessionManager instances.
|
| static class | DefaultDrmSessionManager.MissingSchemeDataException |
Deprecated.
Signals that the Format.drmInitData passed to acquireSession(com.google.android.exoplayer2.drm.DrmSessionEventListener.EventDispatcher, com.google.android.exoplayer2.Format) does not contain scheme data for the required UUID.
|
| static interface | DefaultDrmSessionManager.Mode |
Deprecated.
Determines the action to be done after a session acquired. |
-
DrmSessionManager.DrmSessionReference
Fields | Modifier and Type | Field | Description |
| --- | --- | --- |
| static long | DEFAULT_SESSION_KEEPALIVE_MS |
Deprecated.
Default value for DefaultDrmSessionManager.Builder.setSessionKeepaliveMs(long).
|
| static int | INITIAL_DRM_REQUEST_RETRY_COUNT |
Deprecated.
Number of times to retry for initial provisioning and key request for reporting error.
|
| static int | MODE_DOWNLOAD |
Deprecated.
Downloads an offline license or renews an existing one.
|
| static int | MODE_PLAYBACK |
Deprecated.
Loads and refreshes (if necessary) a license for playback.
|
| static int | MODE_QUERY |
Deprecated.
Restores an offline license to allow its status to be queried.
|
| static int | MODE_RELEASE |
Deprecated.
Releases an existing offline license.
|
| static String | PLAYREADY_CUSTOM_DATA_KEY |
Deprecated.
A key for specifying PlayReady custom data in the key request parameters passed to DefaultDrmSessionManager.Builder.setKeyRequestParameters(Map).
|
-
DRM_UNSUPPORTED, DUMMY
All Methods Instance Methods Concrete 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.
|
| DrmSessionManager.DrmSessionReference | preacquireSession(DrmSessionEventListener.EventDispatcher eventDispatcher, Format format) |
Deprecated.
Pre-acquires a DRM session for the specified Format.
|
| void | prepare() |
Deprecated.
Acquires any required resources.
|
| void | release() |
Deprecated.
Releases any acquired resources.
|
| void | setMode(@com.google.android.exoplayer2.drm.DefaultDrmSessionManager.Mode int mode, byte[] offlineLicenseKeySetId) |
Deprecated.
Sets the mode, which determines the role of sessions acquired from the instance.
|
| void | setPlayer(Looper playbackLooper, PlayerId playerId) |
Deprecated.
Sets information about the player using this DRM session manager. |
-
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
public static final[String](https://developer.android.com/reference/java/lang/String.html "class or interface in java.lang")PLAYREADY_CUSTOM_DATA_KEY
Deprecated.
A key for specifying PlayReady custom data in the key request parameters passed to DefaultDrmSessionManager.Builder.setKeyRequestParameters(Map).
See Also:Constant Field Values
-
public static final int MODE_PLAYBACK
Deprecated.
Loads and refreshes (if necessary) a license for playback. Supports streaming and offline licenses. See Also:Constant Field Values
-
public static final int MODE_QUERY
Deprecated.
Restores an offline license to allow its status to be queried. See Also:Constant Field Values
-
public static final int MODE_DOWNLOAD
Deprecated.
Downloads an offline license or renews an existing one. See Also:Constant Field Values
-
public static final int MODE_RELEASE
Deprecated.
Releases an existing offline license. See Also:Constant Field Values
-
public static final int INITIAL_DRM_REQUEST_RETRY_COUNT
Deprecated.
Number of times to retry for initial provisioning and key request for reporting error. See Also:Constant Field Values
-
public static final long DEFAULT_SESSION_KEEPALIVE_MS
Deprecated.
Default value for DefaultDrmSessionManager.Builder.setSessionKeepaliveMs(long).
See Also:Constant Field Values
-
public void setMode(@com.google.android.exoplayer2.drm.DefaultDrmSessionManager.Mode int mode,
@Nullable
byte[] offlineLicenseKeySetId)
Deprecated.
Sets the mode, which determines the role of sessions acquired from the instance. This must be called before acquireSession(DrmSessionEventListener.EventDispatcher, Format) is called.
By default, the mode is MODE_PLAYBACK and a streaming license is requested when required.
mode must be one of these:
- [`MODE_PLAYBACK`](#MODE_PLAYBACK): If `offlineLicenseKeySetId` is null then a streaming license is requested. Otherwise, the offline license is restored.
- [`MODE_QUERY`](#MODE_QUERY): `offlineLicenseKeySetId` cannot be null. The offline license is restored to allow its status to be queried.
- [`MODE_DOWNLOAD`](#MODE_DOWNLOAD): If `offlineLicenseKeySetId` is null then an offline license is requested. Otherwise, the offline license is renewed.
- [`MODE_RELEASE`](#MODE_RELEASE): `offlineLicenseKeySetId` cannot be null. The offline license is released.
Parameters:mode - The mode to be set.offlineLicenseKeySetId - The key set id of the license to be used with the given mode.
-
public final void prepare()
Deprecated.
Description copied from interface: DrmSessionManager
Acquires any required resources.
DrmSessionManager.release() must be called to ensure the acquired resources are released. After releasing, an instance may be re-prepared.
Specified by:prepare in interface DrmSessionManager
-
public final void release()
Deprecated.
Description copied from interface: DrmSessionManager
Releases any acquired resources.
Specified by:release in interface DrmSessionManager
-
public 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.
Description copied from interface: DrmSessionManager
Sets information about the player using this DRM session manager.
Specified by:setPlayer in interface DrmSessionManagerParameters:playbackLooper - The Looper associated with the player's playback thread.playerId - The PlayerId of the player.
-
public[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.
Description copied from interface: DrmSessionManager
Pre-acquires a DRM session for the specified Format.
This notifies the manager that a subsequent call to DrmSessionManager.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 DrmSessionManager.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 DrmSessionManager.acquireSession( DrmSessionEventListener.EventDispatcher, Format) re-initializing a new session, including repeating key loads and other async initialization steps.
The caller must separately call DrmSessionManager.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.
Specified by:preacquireSession in interface DrmSessionManagerParameters: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 DrmSessionManager.acquireSession(DrmSessionEventListener.EventDispatcher, Format) would return null.
-
@Nullable
public[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.
Description copied from interface: DrmSessionManager
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.
Specified by:acquireSession in interface DrmSessionManagerParameters: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.
-
public @com.google.android.exoplayer2.C.CryptoType int getCryptoType([Format](../Format.html "class in com.google.android.exoplayer2")format)
Deprecated.
Description copied from interface: DrmSessionManager
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 DrmSessionManager.acquireSession(com.google.android.exoplayer2.drm.DrmSessionEventListener.EventDispatcher, com.google.android.exoplayer2.Format) will return null for the given Format.
Specified by:getCryptoType in interface DrmSessionManagerParameters: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 DrmSessionManager.acquireSession(com.google.android.exoplayer2.drm.DrmSessionEventListener.EventDispatcher, com.google.android.exoplayer2.Format) will return null for the given Format.