Package com.google.android.exoplayer2.drm

## Class DrmSessionEventListener.EventDispatcher

- java.lang.Object
- - com.google.android.exoplayer2.drm.DrmSessionEventListener.EventDispatcher

- Enclosing interface:
    DrmSessionEventListener

      public static class DrmSessionEventListener.EventDispatcher
      extends Object

  Dispatches events to `DrmSessionEventListeners`.

- - ### Field Summary

    Fields
    Modifier and Type | Field | Description
    --- | --- | ---
    `MediaSource.MediaPeriodId` | `mediaPeriodId` | The `MediaSource.MediaPeriodId` reported with the events.
    `int` | `windowIndex` | The timeline window index reported with the events.

  - ### Constructor Summary

    Constructors
    Constructor | Description
    --- | ---
    `EventDispatcher()` | Creates an event dispatcher.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `void` | `addEventListener​(Handler handler, DrmSessionEventListener eventListener)` | Adds a listener to the event dispatcher.
    `void` | `drmKeysLoaded()` | Dispatches `DrmSessionEventListener.onDrmKeysLoaded(int, MediaPeriodId)`.
    `void` | `drmKeysRemoved()` | Dispatches `DrmSessionEventListener.onDrmKeysRemoved(int, MediaPeriodId)`.
    `void` | `drmKeysRestored()` | Dispatches `DrmSessionEventListener.onDrmKeysRestored(int, MediaPeriodId)`.
    `void` | `drmSessionAcquired​(@com.google.android.exoplayer2.drm.DrmSession.State int state)` | Dispatches `DrmSessionEventListener.onDrmSessionAcquired(int, MediaPeriodId, int)` and `DrmSessionEventListener.onDrmSessionAcquired(int, MediaPeriodId)`.
    `void` | `drmSessionManagerError​(Exception error)` | Dispatches `DrmSessionEventListener.onDrmSessionManagerError(int, MediaPeriodId, Exception)`.
    `void` | `drmSessionReleased()` | Dispatches `DrmSessionEventListener.onDrmSessionReleased(int, MediaPeriodId)`.
    `void` | `removeEventListener​(DrmSessionEventListener eventListener)` | Removes a listener from the event dispatcher.
    `DrmSessionEventListener.EventDispatcher` | `withParameters​(int windowIndex, MediaSource.MediaPeriodId mediaPeriodId)` | Creates a view of the event dispatcher with the provided window index and media period id.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Field Detail

    - #### windowIndex

          public final int windowIndex

      The timeline window index reported with the events.

    - #### mediaPeriodId

          @Nullable
          public final MediaSource.MediaPeriodId mediaPeriodId

      The `MediaSource.MediaPeriodId` reported with the events.

  - ### Constructor Detail

    - #### EventDispatcher

          public EventDispatcher()

      Creates an event dispatcher.

  - ### Method Detail

    - #### withParameters

          @CheckResult
          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:
        `windowIndex` - The timeline window index to be reported with the events.
        `mediaPeriodId` - The `MediaSource.MediaPeriodId` to be reported with the events.
      Returns:
        A view of the event dispatcher with the pre-configured parameters.

    - #### addEventListener

          public void addEventListener​(Handler handler,
                                       DrmSessionEventListener eventListener)

      Adds a listener to the event dispatcher.
      Parameters:
        `handler` - A handler on the which listener events will be posted.
        `eventListener` - The listener to be added.

    - #### removeEventListener

          public void removeEventListener​(DrmSessionEventListener eventListener)

      Removes a listener from the event dispatcher.
      Parameters:
        `eventListener` - The listener to be removed.

    - #### drmSessionAcquired

          public void drmSessionAcquired​(@State
                                         @com.google.android.exoplayer2.drm.DrmSession.State int state)

      Dispatches `DrmSessionEventListener.onDrmSessionAcquired(int, MediaPeriodId, int)` and `DrmSessionEventListener.onDrmSessionAcquired(int, MediaPeriodId)`.

    - #### drmKeysLoaded

          public void drmKeysLoaded()

      Dispatches `DrmSessionEventListener.onDrmKeysLoaded(int, MediaPeriodId)`.

    - #### drmSessionManagerError

          public void drmSessionManagerError​(Exception error)

      Dispatches `DrmSessionEventListener.onDrmSessionManagerError(int, MediaPeriodId, Exception)`.

    - #### drmKeysRestored

          public void drmKeysRestored()

      Dispatches `DrmSessionEventListener.onDrmKeysRestored(int, MediaPeriodId)`.

    - #### drmKeysRemoved

          public void drmKeysRemoved()

      Dispatches `DrmSessionEventListener.onDrmKeysRemoved(int, MediaPeriodId)`.

    - #### drmSessionReleased

          public void drmSessionReleased()

      Dispatches `DrmSessionEventListener.onDrmSessionReleased(int, MediaPeriodId)`.