DrmSessionManager
@UnstableApi
interface DrmSessionManager
DefaultDrmSessionManager |
A |
Manages a DRM session.
Summary
Nested types |
|---|
interface DrmSessionManager.DrmSessionReferenceRepresents a single reference count of a |
Constants |
|
|---|---|
const DrmSessionManager! |
An instance that supports no DRM schemes. |
Public functions |
|
|---|---|
DrmSession? |
acquireSession(Returns a |
Int |
@C.CryptoTypeReturns the |
DrmSessionManager.DrmSessionReference! |
preacquireSession(Pre-acquires a DRM session for the specified |
Unit |
prepare()Acquires any required resources. |
Unit |
release()Releases any acquired resources. |
Unit |
Sets information about the player using this DRM session manager. |
Constants
DRM_UNSUPPORTED
const val DRM_UNSUPPORTED: DrmSessionManager!
An instance that supports no DRM schemes.
Public functions
acquireSession
fun acquireSession(
eventDispatcher: DrmSessionEventListener.EventDispatcher?,
format: Format!
): DrmSession?
Returns a DrmSession for the specified Format, 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 release to decrement the reference count.
If the provided Format 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.
| Parameters | |
|---|---|
eventDispatcher: DrmSessionEventListener.EventDispatcher? |
The |
format: Format! |
The |
| Returns | |
|---|---|
DrmSession? |
The DRM session. May be null if the given |
getCryptoType
@C.CryptoType
fun getCryptoType(format: Format!): Int
Returns the C.CryptoType that the DRM session manager will use for a given Format. Returns CRYPTO_TYPE_UNSUPPORTED if the manager does not support any of the DRM schemes defined in the Format. Returns CRYPTO_TYPE_NONE if drmInitData is null and acquireSession will return null for the given Format.
| Returns | |
|---|---|
Int |
The |
preacquireSession
fun preacquireSession(
eventDispatcher: DrmSessionEventListener.EventDispatcher?,
format: Format!
): DrmSessionManager.DrmSessionReference!
Pre-acquires a DRM session for the specified Format.
This notifies the manager that a subsequent call to acquireSession with the same Format is likely, allowing a manager that supports pre-acquisition to get the required DrmSession ready in the background.
The caller must call 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 to acquireSession 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 re-initializing a new session, including repeating key loads and other async initialization steps.
The caller must separately call acquireSession in order to obtain a session suitable for playback. The pre-acquired DrmSessionReference and full DrmSession instances are distinct. The caller must release both, and can release the DrmSessionReference before the DrmSession without affecting playback.
This can be called from any thread.
Implementations that do not support pre-acquisition always return an empty DrmSessionReference instance.
| Parameters | |
|---|---|
eventDispatcher: DrmSessionEventListener.EventDispatcher? |
The |
format: Format! |
The |
| Returns | |
|---|---|
DrmSessionManager.DrmSessionReference! |
A releaser for the pre-acquired session. Guaranteed to be non-null even if the matching |