public interface DrmSession
| 限定符和类型 | 接口和说明 |
|---|---|
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.
|
| 限定符和类型 | 字段和说明 |
|---|---|
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.
|
| 限定符和类型 | 方法和说明 |
|---|---|
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.
|
java.util.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.
|
java.util.Map<java.lang.String,java.lang.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(DrmSession previousSession, 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.
@DrmSession.State int getState()
STATE_ERROR,
STATE_RELEASED, STATE_OPENING, STATE_OPENED and
STATE_OPENED_WITH_KEYS.default boolean playClearSamplesWithoutKeys()
DrmSession.DrmSessionException getError()
getState() is not STATE_ERROR.java.util.UUID getSchemeUuid()
ExoMediaCrypto getMediaCrypto()
ExoMediaCrypto for the open session, or null if called before the session
has been opened or after it's been released.java.util.Map<java.lang.String,java.lang.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[])byte[] getOfflineLicenseKeySetId()
void acquire(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(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)).