DrmSession
@UnstableApi
interface DrmSession
ErrorStateDrmSession |
A |
A DRM session.
Summary
Nested types |
|---|
|
Wraps the throwable which is the cause of the error state. |
@DocumentedThe state of the DRM session. |
Constants |
|
|---|---|
const Int |
STATE_ERROR = 1The session has encountered an error. |
const Int |
STATE_OPENED = 3The session is open, but does not have keys required for decryption. |
const Int |
The session is open and has keys required for decryption. |
const Int |
STATE_OPENING = 2The session is being opened. |
const Int |
STATE_RELEASED = 0The session has been released. |
Public functions |
|
|---|---|
Unit |
acquire(eventDispatcher: DrmSessionEventListener.EventDispatcher?)Increments the reference count. |
CryptoConfig? |
Returns a |
DrmSession.DrmSessionException? |
getError()Returns the cause of the error state, or null if |
ByteArray<Byte>? |
Returns the key set id of the offline license loaded into this session, or null if there isn't one. |
UUID! |
Returns the DRM scheme UUID for this session. |
Int |
Returns the current state of the session, which is one of |
Boolean |
Returns whether this session allows playback of clear samples prior to keys being loaded. |
(Mutable)Map<String!, String!>? |
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. |
Unit |
release(eventDispatcher: DrmSessionEventListener.EventDispatcher?)Decrements the reference count. |
java-static Unit |
replaceSession(previousSession: DrmSession?, newSession: DrmSession?)Acquires |
Boolean |
requiresSecureDecoder(mimeType: String!)Returns whether this session requires use of a secure decoder for the given MIME type. |
Constants
STATE_ERROR
const val STATE_ERROR = 1: Int
The session has encountered an error. getError can be used to retrieve the cause. This is a terminal state.
STATE_OPENED
const val STATE_OPENED = 3: Int
The session is open, but does not have keys required for decryption.
STATE_OPENED_WITH_KEYS
const val STATE_OPENED_WITH_KEYS = 4: Int
The session is open and has keys required for decryption.
STATE_RELEASED
const val STATE_RELEASED = 0: Int
The session has been released. This is a terminal state.
Public functions
acquire
fun acquire(eventDispatcher: DrmSessionEventListener.EventDispatcher?): Unit
Increments the reference count. When the caller no longer needs to use the instance, it must call release to decrement the reference count.
| Parameters | |
|---|---|
eventDispatcher: DrmSessionEventListener.EventDispatcher? |
The |
getCryptoConfig
fun getCryptoConfig(): CryptoConfig?
Returns a CryptoConfig for the open session, or null if called before the session has been opened or after it's been released.
getError
fun getError(): DrmSession.DrmSessionException?
Returns the cause of the error state, or null if getState is not STATE_ERROR.
getOfflineLicenseKeySetId
fun getOfflineLicenseKeySetId(): ByteArray<Byte>?
Returns the key set id of the offline license loaded into this session, or null if there isn't one.
getState
@DrmSession.State
fun getState(): Int
Returns the current state of the session, which is one of STATE_ERROR, STATE_RELEASED, STATE_OPENING, STATE_OPENED and STATE_OPENED_WITH_KEYS.
playClearSamplesWithoutKeys
fun playClearSamplesWithoutKeys(): Boolean
Returns whether this session allows playback of clear samples prior to keys being loaded.
queryKeyStatus
fun queryKeyStatus(): (Mutable)Map<String!, String!>?
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 | |
|---|---|
(Mutable)Map<String!, String!>? |
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 | |
|---|---|
queryKeyStatus |
release
fun release(eventDispatcher: DrmSessionEventListener.EventDispatcher?): Unit
Decrements the reference count. If the reference count drops to 0 underlying resources are released, and the instance cannot be re-used.
| Parameters | |
|---|---|
eventDispatcher: DrmSessionEventListener.EventDispatcher? |
The |
replaceSession
java-static fun replaceSession(previousSession: DrmSession?, newSession: DrmSession?): Unit
Acquires newSession then releases previousSession.
Invokes newSession'sacquire and previousSession'srelease in that order (passing eventDispatcher = null). Null arguments are ignored. Does nothing if previousSession and newSession are the same session.
requiresSecureDecoder
fun requiresSecureDecoder(mimeType: String!): Boolean
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 stateSTATE_OPENED or STATE_OPENED_WITH_KEYS.