Radiant Media Player

Live streaming



Documentation sections


Live streaming support in Radiant Media Player

Live streaming has become increasingly popular over the past few years in the streaming media industry. Radiant Media Player supports live video & audio streaming with the following streaming protocols:

  • HLS
  • DASH

You can use a full HLS solution or a combination of DASH & HLS depending on your project requirements. Our general recommendations and advanced player settings for HLS streaming and DASH streaming also apply to live streaming.

Radiant Media Player sports a variety of optimisations for live streaming and a dedicated live UI. Upon startup the player will detect if the stream is a live stream or an on-demand stream.

You can also insert video ads (including through VMAP or our ad scheduler), use DRM or AES encrypted content, stream 360 video content and query our player API with live streaming to our player.

Read our low-latency live HLS streaming or low-latency live DASH streaming documentation for details about how to achieve low-latency streaming with HLS or DASH.

Documentation for using Radiant Media Player with DVR streams can be found here.


Live HLS streaming player code example

Using HLS you can reach all supported devices by Radiant Media Player for live streaming.

<!-- Include Radiant Media Player - here we use the optimised build for hls.js -->
<script src="https://cdn.radiantmediatechs.com/rmp/5.11.5/js/rmp-hlsjs.min.js"></script>
<!-- Player container element -->
<div id="rmpPlayer"></div>
<!-- Set up player configuration options -->
<script>
  // Live HLS streaming source
  var src = {
    hls: 'https://your-live-hls-url.m3u8'
  };
  // Your player settings
  var settings = {
    licenseKey: 'your-license-key',
    src: src,
    width: 640,
    height: 360,
    contentMetadata: {
      poster: [
        'https://your-poster-url.jpg'
      ]
    }
  };
  var elementID = 'rmpPlayer';
  var rmp = new RadiantMP(elementID);
  rmp.init(settings);
</script>

Live DASH streaming player code example

iOS Safari requires HLS to stream live content so including an HLS fallback when using live DASH streaming is recommended.

<!-- Include Radiant Media Player - here we use the optimised build for Shaka player -->
<script src="https://cdn.radiantmediatechs.com/rmp/5.11.5/js/rmp-shaka.min.js"></script>
<!-- Player container element -->
<div id="rmpPlayer"></div>
<!-- Set up player configuration options -->
<script>
  // Live DASH streaming source
  // For iOS and older devices where DASH is not supported we use a live HLS fallback
  var src = {
    dash: 'https://your-live-dash-url.mpd',
    hls: 'https://your-live-hls-url.m3u8'
  };
  // Your player settings
  var settings = {
    licenseKey: 'your-license-key',
    src: src,
    width: 640,
    height: 360,
    // We tell the player to use DASH first over HLS when both are available
    dashFirst: true,
    contentMetadata: {
      poster: [
        'https://your-poster-url.jpg'
      ]
    }
  };
  var elementID = 'rmpPlayer';
  var rmp = new RadiantMP(elementID);
  rmp.init(settings);
</script>

Player API

getLivePresentationStartTimeAsDate()
rmp.getLivePresentationStartTimeAsDate()

Returns String (ISO/IEC 8601:2004), the presentation start time date for the live stream. For HLS this is the EXT-X-PROGRAM-DATETIME value of the manifest. For DASH this is the presentationTimeOffset|availabilityStartTime value. Returns '' if not available. For an epoch time in milliseconds use: new Date(rmp.getLivePresentationStartTimeAsDate().getTime())

getLiveCurrentTime()
rmp.getLiveCurrentTime()

Returns Number, the current time in milliseconds for the live stream. This value is relative to the current timestamp in the player (this is not an absolute value) and may only be used for relative computation. Returns -1 if player is not in live mode.

getLiveDuration()
rmp.getLiveDuration()

Returns Number, the duration in milliseconds for the live stream. This value is relative to the current timestamp in the player (this is not an absolute value) and may only be used for relative computation. Returns -1 if player is not in live mode.

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