docs/doc/reference/com/google/android/exoplayer2/drm/DrmSession.html
Package com.google.android.exoplayer2.drm
ErrorStateDrmSession[@Deprecated](https://developer.android.com/reference/java/lang/Deprecated.html "class or interface in java.lang")public interfaceDrmSession
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 DRM session.
Nested Classes | Modifier and Type | Interface | Description |
| --- | --- | --- |
| static class | DrmSession.DrmSessionException |
Deprecated.
Wraps the throwable which is the cause of the error state.
|
| static interface | DrmSession.State |
Deprecated.
The state of the DRM session. |
Fields | Modifier and Type | Field | Description |
| --- | --- | --- |
| static int | STATE_ERROR |
Deprecated.
The session has encountered an error.
|
| static int | STATE_OPENED |
Deprecated.
The session is open, but does not have keys required for decryption.
|
| static int | STATE_OPENED_WITH_KEYS |
Deprecated.
The session is open and has keys required for decryption.
|
| static int | STATE_OPENING |
Deprecated.
The session is being opened.
|
| static int | STATE_RELEASED |
Deprecated.
The session has been released. |
All Methods Static Methods Instance Methods Abstract Methods Default Methods Deprecated Methods | Modifier and Type | Method | Description |
| --- | --- | --- |
| void | acquire(DrmSessionEventListener.EventDispatcher eventDispatcher) |
Deprecated.
Increments the reference count.
|
| CryptoConfig | getCryptoConfig() |
Deprecated.
Returns a CryptoConfig for the open session, or null if called before the session has been opened or after it's been released.
|
| DrmSession.DrmSessionException | getError() |
Deprecated.
Returns the cause of the error state, or null if getState() is not STATE_ERROR.
|
| byte[] | getOfflineLicenseKeySetId() |
Deprecated.
Returns the key set id of the offline license loaded into this session, or null if there isn't one.
|
| UUID | getSchemeUuid() |
Deprecated.
Returns the DRM scheme UUID for this session.
|
| @com.google.android.exoplayer2.drm.DrmSession.State int | getState() |
Deprecated.
Returns the current state of the session, which is one of STATE_ERROR, STATE_RELEASED, STATE_OPENING, STATE_OPENED and STATE_OPENED_WITH_KEYS.
|
| default boolean | playClearSamplesWithoutKeys() |
Deprecated.
Returns whether this session allows playback of clear samples prior to keys being loaded.
|
| Map<String,String> | queryKeyStatus() |
Deprecated.
Returns a map describing the key status for the session, or null if called before the session has been opened or after it's been released.
|
| void | release(DrmSessionEventListener.EventDispatcher eventDispatcher) |
Deprecated.
Decrements the reference count.
|
| static void | replaceSession(DrmSession previousSession, DrmSession newSession) |
Deprecated.
Acquires newSession then releases previousSession.
|
| boolean | requiresSecureDecoder(String mimeType) |
Deprecated.
Returns whether this session requires use of a secure decoder for the given MIME type. |
-
static final int STATE_RELEASED
Deprecated.
The session has been released. This is a terminal state. See Also:Constant Field Values
-
static final int STATE_ERROR
Deprecated.
The session has encountered an error. getError() can be used to retrieve the cause. This is a terminal state.
See Also:Constant Field Values
-
static final int STATE_OPENING
Deprecated.
The session is being opened. See Also:Constant Field Values
-
static final int STATE_OPENED
Deprecated.
The session is open, but does not have keys required for decryption. See Also:Constant Field Values
-
static final int STATE_OPENED_WITH_KEYS
Deprecated.
The session is open and has keys required for decryption. See Also:Constant Field Values
-
static void replaceSession(@Nullable[DrmSession](DrmSession.html "interface in com.google.android.exoplayer2.drm")previousSession,
@Nullable[DrmSession](DrmSession.html "interface in com.google.android.exoplayer2.drm")newSession)
Deprecated.
Acquires newSession then releases previousSession.
Invokes newSession's acquire(DrmSessionEventListener.EventDispatcher) and previousSession's release(DrmSessionEventListener.EventDispatcher) in that order (passing eventDispatcher = null). Null arguments are ignored. Does nothing if previousSession and newSession are the same session.
-
[@State](DrmSession.State.html "annotation in com.google.android.exoplayer2.drm")@com.google.android.exoplayer2.drm.DrmSession.State int getState()
Deprecated.
Returns the current state of the session, which is one of STATE_ERROR, STATE_RELEASED, STATE_OPENING, STATE_OPENED and STATE_OPENED_WITH_KEYS.
-
default boolean playClearSamplesWithoutKeys()
Deprecated.
Returns whether this session allows playback of clear samples prior to keys being loaded.
-
@Nullable[DrmSession.DrmSessionException](DrmSession.DrmSessionException.html "class in com.google.android.exoplayer2.drm")getError()
Deprecated.
Returns the cause of the error state, or null if getState() is not STATE_ERROR.
-
[UUID](https://developer.android.com/reference/java/util/UUID.html "class or interface in java.util")getSchemeUuid()
Deprecated.
Returns the DRM scheme UUID for this session.
-
@Nullable[CryptoConfig](../decoder/CryptoConfig.html "interface in com.google.android.exoplayer2.decoder")getCryptoConfig()
Deprecated.
Returns a CryptoConfig for the open session, or null if called before the session has been opened or after it's been released.
-
@Nullable[Map](https://developer.android.com/reference/java/util/Map.html "class or interface in java.util")<[String](https://developer.android.com/reference/java/lang/String.html?is-external=true "class or interface in java.lang"),[String](https://developer.android.com/reference/java/lang/String.html?is-external=true "class or interface in java.lang")> queryKeyStatus()
Deprecated.
Returns a map describing the key status for the session, or null if called before the session has been opened or after it's been released.
Since DRM license policies vary by vendor, the specific status field names are determined by each DRM vendor. Refer to your DRM provider documentation for definitions of the field names for a particular DRM engine plugin.
Returns:A map describing the key status for the session, or null if called before the session has been opened or after it's been released.See Also:MediaDrm.queryKeyStatus(byte[])
-
@Nullable
byte[] getOfflineLicenseKeySetId()
Deprecated.
Returns the key set id of the offline license loaded into this session, or null if there isn't one.
-
boolean requiresSecureDecoder([String](https://developer.android.com/reference/java/lang/String.html "class or interface in java.lang")mimeType)
Deprecated.
Returns whether this session requires use of a secure decoder for the given MIME type. Assumes a license policy that requires the highest level of security supported by the session.
The session must be in state STATE_OPENED or STATE_OPENED_WITH_KEYS.
-
void acquire(@Nullable[DrmSessionEventListener.EventDispatcher](DrmSessionEventListener.EventDispatcher.html "class in com.google.android.exoplayer2.drm")eventDispatcher)
Deprecated.
Increments the reference count. When the caller no longer needs to use the instance, it must call release(DrmSessionEventListener.EventDispatcher) to decrement the reference count.
Parameters:eventDispatcher - The DrmSessionEventListener.EventDispatcher used to route DRM-related events dispatched from this session, or null if no event handling is needed.
-
void release(@Nullable[DrmSessionEventListener.EventDispatcher](DrmSessionEventListener.EventDispatcher.html "class in com.google.android.exoplayer2.drm")eventDispatcher)
Deprecated.
Decrements the reference count. If the reference count drops to 0 underlying resources are released, and the instance cannot be re-used.
Parameters:eventDispatcher - The DrmSessionEventListener.EventDispatcher to disconnect when the session is released (the same instance (possibly null) that was passed by the caller to acquire(DrmSessionEventListener.EventDispatcher)).