ErrorStateDrmSessionpublic interface DrmSession
| Modifier and Type | Interface | Description |
|---|---|---|
static class |
DrmSession.DrmSessionException |
Wraps the throwable which is the cause of the error state.
|
static interface |
DrmSession.State |
The state of the DRM session.
|
| Modifier and Type | Field | Description |
|---|---|---|
static int |
STATE_ERROR |
The session has encountered an error.
|
static int |
STATE_OPENED |
The session is open, but does not have keys required for decryption.
|
static int |
STATE_OPENED_WITH_KEYS |
The session is open and has keys required for decryption.
|
static int |
STATE_OPENING |
The session is being opened.
|
static int |
STATE_RELEASED |
The session has been released.
|
| Modifier and Type | Method | Description |
|---|---|---|
void |
acquire(DrmSessionEventListener.EventDispatcher eventDispatcher) |
Increments the reference count.
|
DrmSession.DrmSessionException |
getError() |
Returns the cause of the error state, or null if
getState() is not STATE_ERROR. |
ExoMediaCrypto |
getMediaCrypto() |
Returns an
ExoMediaCrypto for the open session, or null if called before the session
has been opened or after it's been released. |
byte[] |
getOfflineLicenseKeySetId() |
Returns the key set id of the offline license loaded into this session, or null if there isn't
one.
|
UUID |
getSchemeUuid() |
Returns the DRM scheme UUID for this session.
|
int |
getState() |
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() |
Returns whether this session allows playback of clear samples prior to keys being loaded.
|
Map<String,String> |
queryKeyStatus() |
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) |
Decrements the reference count.
|
static void |
replaceSession(DrmSession previousSession,
DrmSession newSession) |
Acquires
newSession then releases previousSession. |
static final int STATE_RELEASED
static final int STATE_ERROR
getError() can be used to retrieve the cause.
This is a terminal state.static final int STATE_OPENING
static final int STATE_OPENED
static final int STATE_OPENED_WITH_KEYS
static void replaceSession(@Nullable
DrmSession previousSession,
@Nullable
DrmSession newSession)
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 int getState()
STATE_ERROR,
STATE_RELEASED, STATE_OPENING, STATE_OPENED and
STATE_OPENED_WITH_KEYS.default boolean playClearSamplesWithoutKeys()
@Nullable DrmSession.DrmSessionException getError()
getState() is not STATE_ERROR.UUID getSchemeUuid()
@Nullable ExoMediaCrypto getMediaCrypto()
ExoMediaCrypto for the open session, or null if called before the session
has been opened or after it's been released.@Nullable Map<String,String> queryKeyStatus()
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.
MediaDrm.queryKeyStatus(byte[])@Nullable byte[] getOfflineLicenseKeySetId()
void acquire(@Nullable
DrmSessionEventListener.EventDispatcher eventDispatcher)
release(DrmSessionEventListener.EventDispatcher) to decrement the reference
count.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 eventDispatcher)
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)).