Radiant Media Player

Error management


Documentation sections


Player-level unified error and warning

With Radiant Media Player 4.10.2 we introduced a new unified error management system for the player.

Error API events

  • error: the player has encountered a fatal error and cannot recover from it. This will result in an error message being displayed to the viewer. This error message can be tuned through player labels
  • warning: the player has encountered a non-fatal error. Either it could recover from the error or this warning may not interfere with playback (but may make some features unavailable)

Error API methods

getErrorData()
rmp.getErrorData();

Returns (Object|null) representing the (error|warning) that was just emitted by the player. When available this object will have the following properties offering more details on the (error|warning):

{
    code: Number, // the (error|warning) number
    message: String, // the (error|warning) message
    event: (Object|null), // the native (error|warning) DOM or library-specific event if available
    fatal: Boolean // if the error fatal (error) or not (warning)
}

Error codes and messages

For values obtained through the getErrorData API method:

error

  • 100: error on HTML5 media element
  • 101: error loading or parsing input playlist
  • 102: error loading or parsing input related
  • 200: failed to load required lib hls.js
  • 201: hls.js error - cannot recover
  • 202: IMA DAI backup stream not provided - cannot recover
  • 300: failed to load required lib Shaka player
  • 301: Shaka player error - cannot recover
  • 500: failed to load required lib three.js (360 video)
  • 600: FPS failed to retrieve the FPS server certificate
  • 601: FPS key System not supported
  • 602: FPS could not create MediaKeys
  • 603: FPS could not create key session
  • 604: FPS license request failed

warning

  • 1000: failed to load logo at provided URI
  • 1001: failed to load poster at provided URI
  • 1002: failed to load seek-bar thumbnails at provided URI
  • 1003: fullscreenerror
  • 1004: destroy currently running - wait for completion before invoking
  • 1005: setSrc currently running - wait for completion before invoking
  • 1006: cannot append playlist layout - missing rmp-playlist-container container
  • 1007: URI of backupSrc is unavailable - trying next
  • 1008: failed to load VTT thumbnail file at URI
  • 2000: hls.js warning
  • 3000: Shaka player warning
  • 4001: vtt.js parsing error
  • 4002: failed to load text track at provided URI
  • 6000: FPS decryption key error was encountered
  • 6001: FPS video playback error occured
  • 7000: failed to load cast_sender.js dependency
  • 7001: castSession.loadMedia failed on receiving device

Player code example for error management API

<script src="https://cdn.radiantmediatechs.com/rmp/5.0.6/js/rmp.min.js"></script>
<div id="rmpPlayer"></div>
<script>
var src = {
  hls: 'https://your-hls-url.m3u8'
};
var settings = {
  licenseKey: 'your-license-key',
  src: src,
  width: 640,
  height: 360,
  poster: 'https://your-poster-url.jpg'
};
var elementID = 'rmpPlayer';
var rmp = new RadiantMP(elementID);
// Reference to the player container which will receive API events
var rmpContainer = document.getElementById(elementID);
// Listening for (error|warning) events
rmpContainer.addEventListener('error', function() {
  console.log('fatal error detected');
  console.log(rmp.getErrorData());
});
rmpContainer.addEventListener('warning', function() {
  console.log('non-fatal error detected');
  console.log(rmp.getErrorData());
});
// Player initialisation only after API events are registered
rmp.init(settings);
</script>

Advanced error management with hls.js and Shaka player

hls.js and Shaka player offer advanced error data that are also exposed by the player unified error management design.

hls.js

The list of errors provided by hls.js in its API can be found here. Here is an example of how to extract those errors information in Radiant Media Player:

rmpContainer.addEventListener('error', function() {
  var errorData = rmp.getErrorData();
  if (errorData) {
    if (errorData.code === 201) {
      var data = errorData.event;
      if (data) {
        console.log(data.type);
        console.log(data.fatal);
        console.log(data.details);
        // Other properties from the data Object may be available - see hls.js docs
      }
    }
  }
});

In the same way we can listen for hls.js warning

rmpContainer.addEventListener('warning', function() {
  var errorData = rmp.getErrorData();
  if (errorData) {
    if (errorData.code === 2000) { 
      var data = errorData.event;
      if (data) {
        console.log(data.type);
        console.log(data.fatal);
        console.log(data.details);
        // Other properties from the data Object may be available - see hls.js docs
      }
    }
  }
});

Shaka player

The list of errors provided by Shaka player in its API can be found here. This notably includes error management for DRM (Widevine, PlayReady, ClearKey - FairPlay streaming errors are directly available at player level). Here is an example of how to extract those errors information in Radiant Media Player:

rmpContainer.addEventListener('error', function() {
  var errorData = rmp.getErrorData();
  if (errorData) {
    if (errorData.code === 301) {
      var data = errorData.event;
      if (data) {
        console.log(data.category);
        console.log(data.code);
        console.log(data.message);
        // Other properties from the data Object may be available - see Shaka player docs
      }
    }
  }
});

In the same way we can listen for hls.js warning

rmpContainer.addEventListener('warning', function() {
  var errorData = rmp.getErrorData();
  if (errorData) {
    if (errorData.code === 3000) {
      var data = errorData.event;
      if (data) {
        console.log(data.category);
        console.log(data.code);
        console.log(data.message);
      }
    }
  }
});

Video ads error management

Due to the unique nature of video ads error handling, ad error management is dealt with for each VAST parser offered by the player:


Offline API error management

See the offline API docs here.

Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 3.0 License.