Documentation

Radiant Media Player

Using fallback streaming URL

backupSrc player setting

Radiant Media Player provides support for fallback streaming URLs through the backupSrc player setting. This features is supported for HLS, DASH or progressive download. It will work for live, DVR and on-demand streaming.

At a given point in time a specific streaming resource may become unavailable. This could be caused by server outage, latency in the streaming chain or encoder re-start. At player start-up Radiant Media Player is able to detect this kind of failure and can try to load an alternate resource provided one is made available in player configuration. The player can also detect in-stream fatal network error and attempt to load an alternate resource that may be accessible. Note that the player can also handle backup streams with HLS use the redundant streams feature described in the next section.

It should be noted that the player will only use fallback streaming URLs for a like-for-like streaming protocol. This means that if the player opts for HLS streaming in a specific environment it expects to have HLS back-up streaming URLs (e.g. it will not fallback to DASH or progressive download even if available).

When the player fails to load an item from the backupSrc setting a 1007 warning event will fire. If the last item also fails an additional error event will fire.

In this example we use a HLS fallback streaming URL. Fallback information are passed to the player through the backupSrc setting which is an Array of Object like the src setting.

<!-- Include Radiant Media Player - here we use the optimised build for hls.js -->
<script src="https://cdn.radiantmediatechs.com/rmp/6.2.3/js/rmp-hlsjs.min.js"></script>
<!-- Set up your wrapper div with its unique id -->
<div id="rmpPlayer"></div>
<!-- Player container element -->
<script>
// Your primary streaming source - in this example we use HLS
var src = {
  hls: 'https://your-hls-url.m3u8'
};
// Your fallback streaming source - must be of same type as above
var backupSrc = [{
  hls: 'https://your-fallback-hls-url-1.m3u8'
}, {
  hls: 'https://your-fallback-hls-url-2.m3u8'
}];
var settings = {
  licenseKey: 'your-license-key',
  src: src,
  // Here we tell the player to use fallback assets if primary asset fails to load
  backupSrc: backupSrc,
  width: 640,
  height: 360,
  contentMetadata: {
    poster: [
      'https://your-poster-url.jpg'
    ]
  }
};
var elementID = 'rmpPlayer';
var rmp = new RadiantMP(elementID);
rmp.init(settings);
</script>

HLS redundant streams

This error resilience feature is specific to HLS. More information on the subject can be found here.

In a nutshell: "If your playlist contains alternate streams, they can not only operate as bandwidth or device alternates, but as failure fallbacks. If the client is unable to reload the index file for a stream (due to a 404 error, for example), the client attempts to switch to an alternate stream".

Fallback streaming information need to be present in the HLS manifest for the player to pick up on this.

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

©2015-2021 Radiant Media Player. All rights reserved.