Interface DrmSessionManager
-
- All Known Implementing Classes:
DefaultDrmSessionManager
@Deprecated public interface 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.Manages a DRM session.
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static interface
DrmSessionManager.DrmSessionReference
Deprecated.Represents a single reference count of aDrmSession
, while deliberately not giving access to the underlying session.
-
Field Summary
Fields Modifier and Type Field Description static DrmSessionManager
DRM_UNSUPPORTED
Deprecated.An instance that supports no DRM schemes.static DrmSessionManager
DUMMY
Deprecated.UseDRM_UNSUPPORTED
.
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Default Methods Deprecated Methods Modifier and Type Method Description DrmSession
acquireSession(DrmSessionEventListener.EventDispatcher eventDispatcher, Format format)
Deprecated.Returns aDrmSession
for the specifiedFormat
, with an incremented reference count.@com.google.android.exoplayer2.C.CryptoType int
getCryptoType(Format format)
Deprecated.Returns theC.CryptoType
that the DRM session manager will use for a givenFormat
.static DrmSessionManager
getDummyDrmSessionManager()
Deprecated.UseDRM_UNSUPPORTED
.default DrmSessionManager.DrmSessionReference
preacquireSession(DrmSessionEventListener.EventDispatcher eventDispatcher, Format format)
Deprecated.Pre-acquires a DRM session for the specifiedFormat
.default void
prepare()
Deprecated.Acquires any required resources.default void
release()
Deprecated.Releases any acquired resources.void
setPlayer(Looper playbackLooper, PlayerId playerId)
Deprecated.Sets information about the player using this DRM session manager.
-
-
-
Field Detail
-
DRM_UNSUPPORTED
static final DrmSessionManager DRM_UNSUPPORTED
Deprecated.An instance that supports no DRM schemes.
-
DUMMY
@Deprecated static final DrmSessionManager DUMMY
Deprecated.UseDRM_UNSUPPORTED
.An instance that supports no DRM schemes.
-
-
Method Detail
-
getDummyDrmSessionManager
@Deprecated static DrmSessionManager getDummyDrmSessionManager()
Deprecated.UseDRM_UNSUPPORTED
.ReturnsDRM_UNSUPPORTED
.
-
prepare
default void prepare()
Deprecated.Acquires any required resources.release()
must be called to ensure the acquired resources are released. After releasing, an instance may be re-prepared.
-
release
default void release()
Deprecated.Releases any acquired resources.
-
setPlayer
void setPlayer(Looper playbackLooper, PlayerId playerId)
Deprecated.Sets information about the player using this DRM session manager.
-
preacquireSession
default DrmSessionManager.DrmSessionReference preacquireSession(@Nullable DrmSessionEventListener.EventDispatcher eventDispatcher, Format format)
Deprecated.Pre-acquires a DRM session for the specifiedFormat
.This notifies the manager that a subsequent call to
acquireSession( DrmSessionEventListener.EventDispatcher, Format)
with the sameFormat
is likely, allowing a manager that supports pre-acquisition to get the requiredDrmSession
ready 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 toacquireSession(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
acquireSession( DrmSessionEventListener.EventDispatcher, Format)
re-initializing a new session, including repeating key loads and other async initialization steps.The caller must separately call
acquireSession( DrmSessionEventListener.EventDispatcher, Format)
in order to obtain a session suitable for playback. The pre-acquiredDrmSessionManager.DrmSessionReference
and fullDrmSession
instances are distinct. The caller must release both, and can release theDrmSessionManager.DrmSessionReference
before theDrmSession
without affecting playback.This can be called from any thread.
Implementations that do not support pre-acquisition always return an empty
DrmSessionManager.DrmSessionReference
instance.- Parameters:
eventDispatcher
- TheDrmSessionEventListener.EventDispatcher
used to distribute events, and passed on toDrmSession.acquire(DrmSessionEventListener.EventDispatcher)
.format
- TheFormat
for which to pre-acquire aDrmSession
.- Returns:
- A releaser for the pre-acquired session. Guaranteed to be non-null even if the matching
acquireSession(DrmSessionEventListener.EventDispatcher, Format)
would return null.
-
acquireSession
@Nullable DrmSession acquireSession(@Nullable DrmSessionEventListener.EventDispatcher eventDispatcher, Format format)
Deprecated.Returns aDrmSession
for the specifiedFormat
, with an incremented reference count. May return null if theFormat.drmInitData
is null and the DRM session manager is not configured to attach aDrmSession
to 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
Format
contains 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.- Parameters:
eventDispatcher
- TheDrmSessionEventListener.EventDispatcher
used to distribute events, and passed on toDrmSession.acquire(DrmSessionEventListener.EventDispatcher)
.format
- TheFormat
for which to acquire aDrmSession
.- Returns:
- The DRM session. May be null if the given
Format.drmInitData
is null.
-
getCryptoType
@com.google.android.exoplayer2.C.CryptoType int getCryptoType(Format format)
Deprecated.Returns theC.CryptoType
that the DRM session manager will use for a givenFormat
. ReturnsC.CRYPTO_TYPE_UNSUPPORTED
if the manager does not support any of the DRM schemes defined in theFormat
. ReturnsC.CRYPTO_TYPE_NONE
ifFormat.drmInitData
is null andacquireSession(com.google.android.exoplayer2.drm.DrmSessionEventListener.EventDispatcher, com.google.android.exoplayer2.Format)
will returnnull
for the givenFormat
.- Parameters:
format
- TheFormat
.- Returns:
- The
C.CryptoType
that 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_NONE
ifFormat.drmInitData
is null andacquireSession(com.google.android.exoplayer2.drm.DrmSessionEventListener.EventDispatcher, com.google.android.exoplayer2.Format)
will return null for the givenFormat
.
-
-