Class DefaultDrmSessionManager
- java.lang.Object
-
- com.google.android.exoplayer2.drm.DefaultDrmSessionManager
-
- All Implemented Interfaces:
DrmSessionManager
@RequiresApi(18) @Deprecated public class DefaultDrmSessionManager extends Object implements DrmSessionManager
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.ADrmSessionManagerthat supports playbacks usingExoMediaDrm.This implementation supports pre-acquisition of sessions using
preacquireSession(DrmSessionEventListener.EventDispatcher, Format).
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classDefaultDrmSessionManager.BuilderDeprecated.Builder forDefaultDrmSessionManagerinstances.static classDefaultDrmSessionManager.MissingSchemeDataExceptionDeprecated.Signals that theFormat.drmInitDatapassed toacquireSession(com.google.android.exoplayer2.drm.DrmSessionEventListener.EventDispatcher, com.google.android.exoplayer2.Format)does not contain scheme data for the required UUID.static interfaceDefaultDrmSessionManager.ModeDeprecated.Determines the action to be done after a session acquired.-
Nested classes/interfaces inherited from interface com.google.android.exoplayer2.drm.DrmSessionManager
DrmSessionManager.DrmSessionReference
-
-
Field Summary
Fields Modifier and Type Field Description static longDEFAULT_SESSION_KEEPALIVE_MSDeprecated.Default value forDefaultDrmSessionManager.Builder.setSessionKeepaliveMs(long).static intINITIAL_DRM_REQUEST_RETRY_COUNTDeprecated.Number of times to retry for initial provisioning and key request for reporting error.static intMODE_DOWNLOADDeprecated.Downloads an offline license or renews an existing one.static intMODE_PLAYBACKDeprecated.Loads and refreshes (if necessary) a license for playback.static intMODE_QUERYDeprecated.Restores an offline license to allow its status to be queried.static intMODE_RELEASEDeprecated.Releases an existing offline license.static StringPLAYREADY_CUSTOM_DATA_KEYDeprecated.A key for specifying PlayReady custom data in the key request parameters passed toDefaultDrmSessionManager.Builder.setKeyRequestParameters(Map).-
Fields inherited from interface com.google.android.exoplayer2.drm.DrmSessionManager
DRM_UNSUPPORTED, DUMMY
-
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description DrmSessionacquireSession(DrmSessionEventListener.EventDispatcher eventDispatcher, Format format)Deprecated.Returns aDrmSessionfor the specifiedFormat, with an incremented reference count.@com.google.android.exoplayer2.C.CryptoType intgetCryptoType(Format format)Deprecated.Returns theC.CryptoTypethat the DRM session manager will use for a givenFormat.DrmSessionManager.DrmSessionReferencepreacquireSession(DrmSessionEventListener.EventDispatcher eventDispatcher, Format format)Deprecated.Pre-acquires a DRM session for the specifiedFormat.voidprepare()Deprecated.Acquires any required resources.voidrelease()Deprecated.Releases any acquired resources.voidsetMode(@com.google.android.exoplayer2.drm.DefaultDrmSessionManager.Mode int mode, byte[] offlineLicenseKeySetId)Deprecated.Sets the mode, which determines the role of sessions acquired from the instance.voidsetPlayer(Looper playbackLooper, PlayerId playerId)Deprecated.Sets information about the player using this DRM session manager.
-
-
-
Field Detail
-
PLAYREADY_CUSTOM_DATA_KEY
public static final String PLAYREADY_CUSTOM_DATA_KEY
Deprecated.A key for specifying PlayReady custom data in the key request parameters passed toDefaultDrmSessionManager.Builder.setKeyRequestParameters(Map).- See Also:
- Constant Field Values
-
MODE_PLAYBACK
public static final int MODE_PLAYBACK
Deprecated.Loads and refreshes (if necessary) a license for playback. Supports streaming and offline licenses.- See Also:
- Constant Field Values
-
MODE_QUERY
public static final int MODE_QUERY
Deprecated.Restores an offline license to allow its status to be queried.- See Also:
- Constant Field Values
-
MODE_DOWNLOAD
public static final int MODE_DOWNLOAD
Deprecated.Downloads an offline license or renews an existing one.- See Also:
- Constant Field Values
-
MODE_RELEASE
public static final int MODE_RELEASE
Deprecated.Releases an existing offline license.- See Also:
- Constant Field Values
-
INITIAL_DRM_REQUEST_RETRY_COUNT
public static final int INITIAL_DRM_REQUEST_RETRY_COUNT
Deprecated.Number of times to retry for initial provisioning and key request for reporting error.- See Also:
- Constant Field Values
-
DEFAULT_SESSION_KEEPALIVE_MS
public static final long DEFAULT_SESSION_KEEPALIVE_MS
Deprecated.Default value forDefaultDrmSessionManager.Builder.setSessionKeepaliveMs(long).- See Also:
- Constant Field Values
-
-
Method Detail
-
setMode
public void setMode(@com.google.android.exoplayer2.drm.DefaultDrmSessionManager.Mode int mode, @Nullable byte[] offlineLicenseKeySetId)Deprecated.Sets the mode, which determines the role of sessions acquired from the instance. This must be called beforeacquireSession(DrmSessionEventListener.EventDispatcher, Format)is called.By default, the mode is
MODE_PLAYBACKand a streaming license is requested when required.modemust be one of these:MODE_PLAYBACK: IfofflineLicenseKeySetIdis null then a streaming license is requested. Otherwise, the offline license is restored.MODE_QUERY:offlineLicenseKeySetIdcannot be null. The offline license is restored to allow its status to be queried.MODE_DOWNLOAD: IfofflineLicenseKeySetIdis null then an offline license is requested. Otherwise, the offline license is renewed.MODE_RELEASE:offlineLicenseKeySetIdcannot be null. The offline license is released.
- Parameters:
mode- The mode to be set.offlineLicenseKeySetId- The key set id of the license to be used with the given mode.
-
prepare
public final void prepare()
Deprecated.Description copied from interface:DrmSessionManagerAcquires any required resources.DrmSessionManager.release()must be called to ensure the acquired resources are released. After releasing, an instance may be re-prepared.- Specified by:
preparein interfaceDrmSessionManager
-
release
public final void release()
Deprecated.Description copied from interface:DrmSessionManagerReleases any acquired resources.- Specified by:
releasein interfaceDrmSessionManager
-
setPlayer
public void setPlayer(Looper playbackLooper, PlayerId playerId)
Deprecated.Description copied from interface:DrmSessionManagerSets information about the player using this DRM session manager.- Specified by:
setPlayerin interfaceDrmSessionManager- Parameters:
playbackLooper- TheLooperassociated with the player's playback thread.playerId- ThePlayerIdof the player.
-
preacquireSession
public DrmSessionManager.DrmSessionReference preacquireSession(@Nullable DrmSessionEventListener.EventDispatcher eventDispatcher, Format format)
Deprecated.Description copied from interface:DrmSessionManagerPre-acquires a DRM session for the specifiedFormat.This notifies the manager that a subsequent call to
DrmSessionManager.acquireSession( DrmSessionEventListener.EventDispatcher, Format)with the sameFormatis likely, allowing a manager that supports pre-acquisition to get the requiredDrmSessionready in the background.The caller must call
DrmSessionManager.DrmSessionReference.release()on the returned instance when they no longer require the pre-acquisition (i.e. they know they won't be making a matching call toDrmSessionManager.acquireSession(DrmSessionEventListener.EventDispatcher, Format)in the near future).This manager may silently release the underlying session in order to allow another operation to complete. This will result in a subsequent call to
DrmSessionManager.acquireSession( DrmSessionEventListener.EventDispatcher, Format)re-initializing a new session, including repeating key loads and other async initialization steps.The caller must separately call
DrmSessionManager.acquireSession( DrmSessionEventListener.EventDispatcher, Format)in order to obtain a session suitable for playback. The pre-acquiredDrmSessionManager.DrmSessionReferenceand fullDrmSessioninstances are distinct. The caller must release both, and can release theDrmSessionManager.DrmSessionReferencebefore theDrmSessionwithout affecting playback.This can be called from any thread.
Implementations that do not support pre-acquisition always return an empty
DrmSessionManager.DrmSessionReferenceinstance.- Specified by:
preacquireSessionin interfaceDrmSessionManager- Parameters:
eventDispatcher- TheDrmSessionEventListener.EventDispatcherused to distribute events, and passed on toDrmSession.acquire(DrmSessionEventListener.EventDispatcher).format- TheFormatfor which to pre-acquire aDrmSession.- Returns:
- A releaser for the pre-acquired session. Guaranteed to be non-null even if the matching
DrmSessionManager.acquireSession(DrmSessionEventListener.EventDispatcher, Format)would return null.
-
acquireSession
@Nullable public DrmSession acquireSession(@Nullable DrmSessionEventListener.EventDispatcher eventDispatcher, Format format)
Deprecated.Description copied from interface:DrmSessionManagerReturns aDrmSessionfor the specifiedFormat, with an incremented reference count. May return null if theFormat.drmInitDatais null and the DRM session manager is not configured to attach aDrmSessionto clear content. When the caller no longer needs to use a returnedDrmSession, it must callDrmSession.release(DrmSessionEventListener.EventDispatcher)to decrement the reference count.If the provided
Formatcontains a nullFormat.drmInitData, the returnedDrmSession(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.- Specified by:
acquireSessionin interfaceDrmSessionManager- Parameters:
eventDispatcher- TheDrmSessionEventListener.EventDispatcherused to distribute events, and passed on toDrmSession.acquire(DrmSessionEventListener.EventDispatcher).format- TheFormatfor which to acquire aDrmSession.- Returns:
- The DRM session. May be null if the given
Format.drmInitDatais null.
-
getCryptoType
public @com.google.android.exoplayer2.C.CryptoType int getCryptoType(Format format)
Deprecated.Description copied from interface:DrmSessionManagerReturns theC.CryptoTypethat the DRM session manager will use for a givenFormat. ReturnsC.CRYPTO_TYPE_UNSUPPORTEDif the manager does not support any of the DRM schemes defined in theFormat. ReturnsC.CRYPTO_TYPE_NONEifFormat.drmInitDatais null andDrmSessionManager.acquireSession(com.google.android.exoplayer2.drm.DrmSessionEventListener.EventDispatcher, com.google.android.exoplayer2.Format)will returnnullfor the givenFormat.- Specified by:
getCryptoTypein interfaceDrmSessionManager- Parameters:
format- TheFormat.- Returns:
- The
C.CryptoTypethat the manager will use, or @link C#CRYPTO_TYPE_UNSUPPORTED} if the manager does not support any of the DRM schemes defined in theFormat. Will beC.CRYPTO_TYPE_NONEifFormat.drmInitDatais null andDrmSessionManager.acquireSession(com.google.android.exoplayer2.drm.DrmSessionEventListener.EventDispatcher, com.google.android.exoplayer2.Format)will return null for the givenFormat.
-
-