Package com.google.android.exoplayer2.source.dash

## Class PlayerEmsgHandler

- java.lang.Object
- - com.google.android.exoplayer2.source.dash.PlayerEmsgHandler

- All Implemented Interfaces:
    `Handler.Callback`

      public final class PlayerEmsgHandler
      extends Object
      implements Handler.Callback

  Handles all emsg messages from all media tracks for the player.

  This class will only respond to emsg messages which have schemeIdUri "urn:mpeg:dash:event:2012", and value "1"/"2"/"3". When it encounters one of these messages, it will handle the message according to Section 4.5.2.1 DASH -IF IOP Version 4.1:

  - If both presentation time delta and event duration are zero, it means the media presentation has ended.
  - Else, it will parse the message data from the emsg message to find the publishTime of the expired manifest, and mark manifest with publishTime smaller than that values to be expired.
  In both cases, the DASH media source will be notified, and a manifest reload should be triggered.

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Class | Description
    --- | --- | ---
    `static interface` | `PlayerEmsgHandler.PlayerEmsgCallback` | Callbacks for player emsg events encountered during DASH live stream.
    `class` | `PlayerEmsgHandler.PlayerTrackEmsgHandler` | Handles emsg messages for a specific track for the player.

  - ### Constructor Summary

    Constructors
    Constructor | Description
    --- | ---
    `PlayerEmsgHandler​(DashManifest manifest, PlayerEmsgHandler.PlayerEmsgCallback playerEmsgCallback, Allocator allocator)` |

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `boolean` | `handleMessage​(Message message)` |
    `PlayerEmsgHandler.PlayerTrackEmsgHandler` | `newPlayerTrackEmsgHandler()` | Returns a `TrackOutput` that emsg messages could be written to.
    `void` | `release()` | Release this emsg handler.
    `void` | `updateManifest​(DashManifest newManifest)` | Updates the `DashManifest` that this handler works on.

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

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

- - ### Constructor Detail

    - #### PlayerEmsgHandler

          public PlayerEmsgHandler​(DashManifest manifest,
                                   PlayerEmsgHandler.PlayerEmsgCallback playerEmsgCallback,
                                   Allocator allocator)

      Parameters:
        `manifest` - The initial manifest.
        `playerEmsgCallback` - The callback that this event handler can invoke when handling emsg messages that generate DASH media source events.
        `allocator` - An `Allocator` from which allocations can be obtained.

  - ### Method Detail

    - #### updateManifest

          public void updateManifest​(DashManifest newManifest)

      Updates the `DashManifest` that this handler works on.
      Parameters:
        `newManifest` - The updated manifest.

    - #### newPlayerTrackEmsgHandler

          public PlayerEmsgHandler.PlayerTrackEmsgHandler newPlayerTrackEmsgHandler()

      Returns a `TrackOutput` that emsg messages could be written to.

    - #### release

          public void release()

      Release this emsg handler. It should not be reused after this call.

    - #### handleMessage

          public boolean handleMessage​(Message message)

      Specified by:
        `handleMessage` in interface `Handler.Callback`