ErrorStateDrmSession


@UnstableApi
public final class ErrorStateDrmSession implements DrmSession


A DrmSession that's in a terminal error state.

Summary

Public methods

void

Increments the reference count.

@Nullable CryptoConfig

Returns a CryptoConfig for the open session, or null if called before the session has been opened or after it's been released.

@Nullable DrmSession.DrmSessionException

Returns the cause of the error state, or null if getState is not STATE_ERROR.

@Nullable byte[]

Returns the key set id of the offline license loaded into this session, or null if there isn't one.

final UUID

Returns the DRM scheme UUID for this session.

int

Returns the current state of the session, which is one of STATE_ERROR, STATE_RELEASED, STATE_OPENING, STATE_OPENED and STATE_OPENED_WITH_KEYS.

boolean

Returns whether this session allows playback of clear samples prior to keys being loaded.

@Nullable Map<StringString>

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

Decrements the reference count.

boolean

Returns whether this session requires use of a secure decoder for the given MIME type.

Inherited Constants

From androidx.media3.exoplayer.drm.DrmSession
static final int

The session has encountered an error.

static final int

The session is open, but does not have keys required for decryption.

static final int

The session is open and has keys required for decryption.

static final int

The session is being opened.

static final int

The session has been released.

Inherited methods

From androidx.media3.exoplayer.drm.DrmSession
static void
replaceSession(
    @Nullable DrmSession previousSession,
    @Nullable DrmSession newSession
)

Acquires newSession then releases previousSession.

Public fields

error

public final DrmSession.DrmSessionException error

Public constructors

ErrorStateDrmSession

public ErrorStateDrmSession(DrmSession.DrmSessionException error)

Public methods

acquire

public void acquire(
    @Nullable DrmSessionEventListener.EventDispatcher eventDispatcher
)

Increments the reference count. When the caller no longer needs to use the instance, it must call release to decrement the reference count.

Parameters
@Nullable DrmSessionEventListener.EventDispatcher eventDispatcher

The DrmSessionEventListener.EventDispatcher used to route DRM-related events dispatched from this session, or null if no event handling is needed.

getCryptoConfig

public @Nullable CryptoConfig getCryptoConfig()

Returns a CryptoConfig for the open session, or null if called before the session has been opened or after it's been released.

getError

public @Nullable DrmSession.DrmSessionException getError()

Returns the cause of the error state, or null if getState is not STATE_ERROR.

getOfflineLicenseKeySetId

public @Nullable byte[] getOfflineLicenseKeySetId()

Returns the key set id of the offline license loaded into this session, or null if there isn't one.

getSchemeUuid

public final UUID getSchemeUuid()

Returns the DRM scheme UUID for this session.

getState

public 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.

playClearSamplesWithoutKeys

public boolean playClearSamplesWithoutKeys()

Returns whether this session allows playback of clear samples prior to keys being loaded.

queryKeyStatus

public @Nullable Map<StringStringqueryKeyStatus()

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.

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.

Returns
@Nullable Map<StringString>

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.

See also
queryKeyStatus

release

public void release(
    @Nullable DrmSessionEventListener.EventDispatcher eventDispatcher
)

Decrements the reference count. If the reference count drops to 0 underlying resources are released, and the instance cannot be re-used.

Parameters
@Nullable DrmSessionEventListener.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).

requiresSecureDecoder

public boolean requiresSecureDecoder(String mimeType)

Returns whether this session requires use of a secure decoder for the given MIME type. Assumes a license policy that requires the highest level of security supported by the session.

The session must be in stateSTATE_OPENED or STATE_OPENED_WITH_KEYS.