Tutorial: Event management

Event management

This tutorial will help you use the events emitted by the video player.

Available events

HTML documents loaded by the embedded web browser can retrieve events concerning various aspects of the system:

Event registration

Like any other standard event ("click", "mouseover", "load"...), the above events shall be registered using window.addEventListener() as defined by the DOM Specification.

For example, if you want to be informed when the playback of a file starts or ends:

window.addEventListener('idal-player-event', function(e) {
    switch (e.detail.type) {
        'file-start':
            // Do something with e.detail.filename
            break;
        'file-end':
            // Do something with e.detail.filename
            break;
    }
});

You will find examples on how to use a particular event in its own documentation.