Tutorial: Listening for Errors

Player Errors vs Video Errors

Shaka Player dispatches 'error' events to the application. Although you may be used to listening for events on the video element, this is not recommended when using Shaka Player. There can be spurious events when unloading video sources, and Shaka Player will filter these out for you. In addition, Shaka Player will dispatch certain DASH-related or EME-related errors that you cannot receive any other way.

var video = document.getElementById('video');
var player = new shaka.player.Player(video);

// DO listen for errors from the Player.
player.addEventListener('error', function(event) { /* ... */ });

// DO NOT listen for errors from the video element.
//video.addEventListener('error', function(event) { /* ... */ });

See also the list of events fired by shaka.player.Player.