Radiant Media Player

Using fallback streaming URL

Mobile applications documentation



Fallback for initial loading error

Radiant Media Player provides support for fallback streaming URLs. At a given point in time a specific streaming URL may become unavailable. This could be caused by server outage or overload. Radiant Media Player is able to detect this kind of failure when it attempts to fetch media content from the server and in the event it cannot access the targeted resource it can automatically switch to an alternate backup resource thus increasing the chance for your viewer to still be able to access your content.

This features is supported for HLS, DASH or progressive download. It will work for live, DVR and on-demand streaming. It should be noted that the player will only use fallback streaming URL for a like-like streaming protocol. This means that if the player opts for HLS streaming in a specific environment it expects to have an HLS back-up streaming URL (e.g. it will not fallback to DASH or progressive download even if available).


Player code example

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

<!-- Include Radiant Media Player JavaScript file in your <body> or <head> -->
<script src="https://cdn.radiantmediatechs.com/rmp/4.3.10/js/rmp.min.js" 
  integrity="sha384-oqyrp9HkidOFyRcmx+X2yLeX4ICBkGqK+vCML6IeTlkD3JV9omoVl0lvZJNqdmTX"
  crossorigin="anonymous"></script>
<!-- Set up your wrapper div with its unique id -->
<div id="rmpPlayer"></div>
<!-- Set up player configuration options -->
<script>
// First we specify bitrates to feed to the player
var bitrates = {
  hls: 'https://dqwp3xzzbfhtw.cloudfront.net/vod/smil:bbb.smil/playlist.m3u8'
};
var backupBitrates = {
  hls: 'https://dqwp3xzzbfhtw.cloudfront.net/vod/smil:bbb-long.smil/playlist.m3u8'
};
// Then we set our player settings
var settings = {
  licenseKey: 'your-license-key',
  bitrates: bitrates,
  backupBitrates: backupBitrates,
  delayToFade: 3000,
  width: 640,
  height: 360,
  poster: 'https://www.radiantmediaplayer.com/images/poster-rmp-showcase.jpg'
};
// Reference to the wrapper div (unique id)
var elementID = 'rmpPlayer';
// Create an object based on RadiantMP constructor
var rmp = new RadiantMP(elementID);
// Initialization ... test your page and done!
rmp.init(settings);
</script>

The check for fallback streaming URL happens through JavaScript XMLHttpRequest for HTML5 video/audio. Hence your fallback stream must also be delivered with CORS headers permitting GET requests.

The backupBitrates setting does not cover playback/network error after the player has successfully started. To handle in-stream playback/network error you can do one of the following:

  • For HLS use the redundant streams feature described in the next section
  • Listen to the player API error event and implement some custom fallback

HLS redundant streams

This error resilience feature is specific to HLS and works with Radiant Media Player for HLS to HTML5 & Flash video. 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".

Note that this feature is a complement to the previously mentioned fallback mechanism. This mechanism can actually allow recovery of in-stream errors (like a specific level is not available). Fallback information needs to be present in the HLS playlist.

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