@UnstableApi
public final class PlayerEmsgHandler 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.

Summary

Nested types

Callbacks for player emsg events encountered during DASH live stream.

public final inner class PlayerEmsgHandler.PlayerTrackEmsgHandler implements TrackOutput

Handles emsg messages for a specific track for the player.

Public constructors

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

Public methods

boolean
PlayerEmsgHandler.PlayerTrackEmsgHandler

Returns a TrackOutput that emsg messages could be written to.

void

Release this emsg handler.

void

Updates the DashManifest that this handler works on.

Public constructors

PlayerEmsgHandler

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

The initial manifest.

PlayerEmsgHandler.PlayerEmsgCallback playerEmsgCallback

The callback that this event handler can invoke when handling emsg messages that generate DASH media source events.

Allocator allocator

An Allocator from which allocations can be obtained.

Public methods

handleMessage

public boolean handleMessage(Message message)

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.

updateManifest

public void updateManifest(DashManifest newManifest)

Updates the DashManifest that this handler works on.

Parameters
DashManifest newManifest

The updated manifest.