Player Events

dash.js dispatches various events during playback to inform the application about changes of the playback state and metrics being added or updated. A complete list of the available events can be found here.

Example

An example is available as part of the sample section.

dash.js usage

To register for a specific event use the on method of the media player instance:

player.on(dashjs.MediaPlayer.events.BUFFER_LOADED, showEvent);

The payload of the event is passed as an object to the callback function

function showEvent(e) {
    log("Event received: " + e.type);
}

To remove the listener for an event use the off method:

player.off(dashjs.MediaPlayer.events.BUFFER_LOADED, showEvent);