public class DefaultDrmSessionManager extends java.lang.Object implements DrmSessionManager
DrmSessionManager that supports playbacks using ExoMediaDrm.| Modifier and Type | Class and Description |
|---|---|
static class |
DefaultDrmSessionManager.Builder
Builder for
DefaultDrmSessionManager instances. |
static class |
DefaultDrmSessionManager.MissingSchemeDataException
Signals that the drmInitData passed to
acquireSession(android.os.Looper, tv.danmaku.ijk.media.drm.DrmSessionEventListener.EventDispatcher, tv.danmaku.ijk.media.drm.DrmInitData, java.lang.String) does not contain
scheme data for the required UUID. |
static interface |
DefaultDrmSessionManager.Mode
Determines the action to be done after a session acquired.
|
| Modifier and Type | Field and Description |
|---|---|
static long |
DEFAULT_SESSION_KEEPALIVE_MS
Default value for
DefaultDrmSessionManager.Builder.setSessionKeepaliveMs(long). |
static int |
INITIAL_DRM_REQUEST_RETRY_COUNT
Number of times to retry for initial provisioning and key request for reporting error.
|
static int |
MODE_DOWNLOAD
Downloads an offline license or renews an existing one.
|
static int |
MODE_PLAYBACK
Loads and refreshes (if necessary) a license for playback.
|
static int |
MODE_QUERY
Restores an offline license to allow its status to be queried.
|
static int |
MODE_RELEASE
Releases an existing offline license.
|
static java.lang.String |
PLAYREADY_CUSTOM_DATA_KEY
A key for specifying PlayReady custom data in the key request parameters passed to
DefaultDrmSessionManager.Builder.setKeyRequestParameters(Map). |
DRM_UNSUPPORTED, DUMMY| Constructor and Description |
|---|
DefaultDrmSessionManager(java.util.UUID uuid,
ExoMediaDrm exoMediaDrm,
MediaDrmCallback callback,
java.util.HashMap<java.lang.String,java.lang.String> keyRequestParameters)
Deprecated.
Use
DefaultDrmSessionManager.Builder instead. |
DefaultDrmSessionManager(java.util.UUID uuid,
ExoMediaDrm exoMediaDrm,
MediaDrmCallback callback,
java.util.HashMap<java.lang.String,java.lang.String> keyRequestParameters,
boolean multiSession)
Deprecated.
Use
DefaultDrmSessionManager.Builder instead. |
DefaultDrmSessionManager(java.util.UUID uuid,
ExoMediaDrm exoMediaDrm,
MediaDrmCallback callback,
java.util.HashMap<java.lang.String,java.lang.String> keyRequestParameters,
boolean multiSession,
int initialDrmRequestRetryCount)
Deprecated.
Use
DefaultDrmSessionManager.Builder instead. |
| Modifier and Type | Method and Description |
|---|---|
DrmSession |
acquireSession(android.os.Looper playbackLooper,
DrmSessionEventListener.EventDispatcher eventDispatcher,
DrmInitData drmInitData,
java.lang.String sampleMimeType)
Returns a
DrmSession for the specified DrmInitData, with an incremented reference
count. |
java.lang.Class<? extends ExoMediaCrypto> |
getExoMediaCryptoType(DrmInitData drmInitData,
java.lang.String sampleMimeType)
Returns the
ExoMediaCrypto type associated to sessions acquired for the given DrmInitData. |
void |
prepare()
Acquires any required resources.
|
void |
release()
Releases any acquired resources.
|
void |
setMode(int mode,
byte[] offlineLicenseKeySetId)
Sets the mode, which determines the role of sessions acquired from the instance.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitgetDummyDrmSessionManagerpublic static final java.lang.String PLAYREADY_CUSTOM_DATA_KEY
DefaultDrmSessionManager.Builder.setKeyRequestParameters(Map).public static final int MODE_PLAYBACK
public static final int MODE_QUERY
public static final int MODE_DOWNLOAD
public static final int MODE_RELEASE
public static final int INITIAL_DRM_REQUEST_RETRY_COUNT
public static final long DEFAULT_SESSION_KEEPALIVE_MS
DefaultDrmSessionManager.Builder.setSessionKeepaliveMs(long).@Deprecated
public DefaultDrmSessionManager(java.util.UUID uuid,
ExoMediaDrm exoMediaDrm,
MediaDrmCallback callback,
java.util.HashMap<java.lang.String,java.lang.String> keyRequestParameters)
DefaultDrmSessionManager.Builder instead.uuid - The UUID of the drm scheme.exoMediaDrm - An underlying ExoMediaDrm for use by the manager.callback - Performs key and provisioning requests.keyRequestParameters - An optional map of parameters to pass as the last argument to
ExoMediaDrm.getKeyRequest(byte[], List, int, HashMap). May be null.@Deprecated
public DefaultDrmSessionManager(java.util.UUID uuid,
ExoMediaDrm exoMediaDrm,
MediaDrmCallback callback,
java.util.HashMap<java.lang.String,java.lang.String> keyRequestParameters,
boolean multiSession)
DefaultDrmSessionManager.Builder instead.uuid - The UUID of the drm scheme.exoMediaDrm - An underlying ExoMediaDrm for use by the manager.callback - Performs key and provisioning requests.keyRequestParameters - An optional map of parameters to pass as the last argument to
ExoMediaDrm.getKeyRequest(byte[], List, int, HashMap). May be null.multiSession - A boolean that specify whether multiple key session support is enabled.
Default is false.@Deprecated
public DefaultDrmSessionManager(java.util.UUID uuid,
ExoMediaDrm exoMediaDrm,
MediaDrmCallback callback,
java.util.HashMap<java.lang.String,java.lang.String> keyRequestParameters,
boolean multiSession,
int initialDrmRequestRetryCount)
DefaultDrmSessionManager.Builder instead.uuid - The UUID of the drm scheme.exoMediaDrm - An underlying ExoMediaDrm for use by the manager.callback - Performs key and provisioning requests.keyRequestParameters - An optional map of parameters to pass as the last argument to
ExoMediaDrm.getKeyRequest(byte[], List, int, HashMap). May be null.multiSession - A boolean that specify whether multiple key session support is enabled.
Default is false.initialDrmRequestRetryCount - The number of times to retry for initial provisioning and
key request before reporting error.public void setMode(@DefaultDrmSessionManager.Mode int mode, byte[] offlineLicenseKeySetId)
acquireSession(Looper, DrmSessionEventListener.EventDispatcher, DrmInitData, String)
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: If offlineLicenseKeySetId is null then a streaming
license is requested. Otherwise, the offline license is restored.
MODE_QUERY: offlineLicenseKeySetId cannot be null. The offline license
is restored to allow its status to be queried.
MODE_DOWNLOAD: If offlineLicenseKeySetId is null then an offline license
is requested. Otherwise, the offline license is renewed.
MODE_RELEASE: offlineLicenseKeySetId cannot be null. The offline license
is released.
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()
DrmSessionManagerDrmSessionManager.release() must be called to ensure the acquired resources are released. After
releasing, an instance may be re-prepared.
prepare in interface DrmSessionManagerpublic final void release()
DrmSessionManagerrelease in interface DrmSessionManagerpublic DrmSession acquireSession(android.os.Looper playbackLooper, DrmSessionEventListener.EventDispatcher eventDispatcher, DrmInitData drmInitData, java.lang.String sampleMimeType)
DrmSessionManagerDrmSession for the specified DrmInitData, with an incremented reference
count. May return null if the 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 DrmInitData contains a null 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.
acquireSession in interface DrmSessionManagerplaybackLooper - The looper associated with the media playback thread.eventDispatcher - The DrmSessionEventListener.EventDispatcher used to distribute
events, and passed on to DrmSession.acquire(DrmSessionEventListener.EventDispatcher).drmInitData - The DrmInitData for which to acquire a DrmSession.public java.lang.Class<? extends ExoMediaCrypto> getExoMediaCryptoType(DrmInitData drmInitData, java.lang.String sampleMimeType)
DrmSessionManagerExoMediaCrypto type associated to sessions acquired for the given DrmInitData. Returns the UnsupportedMediaCrypto type if this DRM session manager does not
support any of the DRM schemes defined in the given DrmInitData. Returns null if drmInitData
is null and DrmSessionManager.acquireSession(android.os.Looper, tv.danmaku.ijk.media.drm.DrmSessionEventListener.EventDispatcher, tv.danmaku.ijk.media.drm.DrmInitData, java.lang.String) would return null for the given DrmInitData.getExoMediaCryptoType in interface DrmSessionManagerdrmInitData - The DrmInitData for which to return the ExoMediaCrypto type.ExoMediaCrypto type associated to sessions acquired using the given DrmInitData, or UnsupportedMediaCrypto if this DRM session manager does not support any
of the DRM schemes defined in the given DrmInitData. May be null if
drmInitData is null and DrmSessionManager.acquireSession(android.os.Looper, tv.danmaku.ijk.media.drm.DrmSessionEventListener.EventDispatcher, tv.danmaku.ijk.media.drm.DrmInitData, java.lang.String) would return null for the given
DrmInitData.