Welcome to Viblast Documentation

Everything you need to know about Viblast Solutions. For more information contact us.

Viblast Documentation

Error handling

When an error condition occurs Viblast tries to recover from it in a manner that would disturb viewer experience the least. For example if a segment of the stream cannot be transfered Viblast will retry. If after a certain time the segment still cannot be downloaded then Viblast will try to skip it and continue with the stream after the missing segment.

However sometimes it's useful to know if such an error condition has occurred. For these cases Viblast fires specific events on the on the viblast api object.

The Transfer Failure Event

When the transfer of a segment, HLS playlist or MPD fails, Viblast fires the transferfailure event.

var player = document.getElementById('my-player');
player.viblast.addEventListener('transferfailure', function(ev) {
    console.log('transfer of', ev.url, 'failed with', ev.status);
});
  • url is the url of the HTTP request that failed
  • status is the HTTP status code of the server response

Special status codes

It is possible for the player to discard the stream requests internally in case of the ABR algorithm quality switching, seek performed or timeout achieved. When the request is internally terminated, the application gets notified about transfer failure with non HTTP status code, but with special negative one.

  • -524 is a notification for a request terminated because of a timeout
  • -523 is a notification for a request which is aborted because the segment is not needed anymore. This might happen if the seek is performed, quality is switched or the chunk download is too slow for live streams and the player decides to move forward.

Here is the equivalent code when videojs is used.

var player = videojs('my-player');
player.viblast.addEventListener('transferfailure', function(ev) {
    console.log('transfer of', ev.url, 'failed with', ev.status);
});

You can find an example demoing how to use transferfailure in our codepen page.

This API is available since version 6.24.