DrmSessionEventListener.EventDispatcher


public class DrmSessionEventListener.EventDispatcher


Dispatches events to DrmSessionEventListeners.

Summary

Public fields

final @Nullable MediaSource.MediaPeriodId

The MediaPeriodId reported with the events.

final int

The timeline window index reported with the events.

Public constructors

Creates an event dispatcher.

Public methods

void
addEventListener(
    Handler handler,
    DrmSessionEventListener eventListener
)

Adds a listener to the event dispatcher.

void

Dispatches onDrmKeysLoaded.

void

Dispatches onDrmKeysRemoved.

void

Dispatches onDrmKeysRestored.

void

Dispatches onDrmSessionAcquired.

void

Dispatches onDrmSessionManagerError.

void

Dispatches onDrmSessionReleased.

void

Removes a listener from the event dispatcher.

DrmSessionEventListener.EventDispatcher
withParameters(
    int windowIndex,
    @Nullable MediaSource.MediaPeriodId mediaPeriodId
)

Creates a view of the event dispatcher with the provided window index and media period id.

Public fields

mediaPeriodId

public final @Nullable MediaSource.MediaPeriodId mediaPeriodId

The MediaPeriodId reported with the events.

windowIndex

public final int windowIndex

The timeline window index reported with the events.

Public constructors

EventDispatcher

public EventDispatcher()

Creates an event dispatcher.

Public methods

addEventListener

public void addEventListener(
    Handler handler,
    DrmSessionEventListener eventListener
)

Adds a listener to the event dispatcher.

Parameters
Handler handler

A handler on the which listener events will be posted.

DrmSessionEventListener eventListener

The listener to be added.

drmKeysLoaded

public void drmKeysLoaded()

Dispatches onDrmKeysLoaded.

drmKeysRemoved

public void drmKeysRemoved()

Dispatches onDrmKeysRemoved.

drmKeysRestored

public void drmKeysRestored()

Dispatches onDrmKeysRestored.

drmSessionAcquired

public void drmSessionAcquired(@DrmSession.State int state)

Dispatches onDrmSessionAcquired.

drmSessionManagerError

public void drmSessionManagerError(Exception error)

Dispatches onDrmSessionManagerError.

drmSessionReleased

public void drmSessionReleased()

Dispatches onDrmSessionReleased.

removeEventListener

public void removeEventListener(DrmSessionEventListener eventListener)

Removes a listener from the event dispatcher.

Parameters
DrmSessionEventListener eventListener

The listener to be removed.

withParameters

public DrmSessionEventListener.EventDispatcher withParameters(
    int windowIndex,
    @Nullable MediaSource.MediaPeriodId mediaPeriodId
)

Creates a view of the event dispatcher with the provided window index and media period id.

Parameters
int windowIndex

The timeline window index to be reported with the events.

@Nullable MediaSource.MediaPeriodId mediaPeriodId

The MediaPeriodId to be reported with the events.

Returns
DrmSessionEventListener.EventDispatcher

A view of the event dispatcher with the pre-configured parameters.