Radiant Media Player

Program date time with HLS



Documentation sections


Scope of support

The EXT-X-PROGRAM-DATE-TIME tag in HLS associates the first sample of a Media Segment with an absolute date and/or time. It applies only to the next Media Segment. More information can be found in HLS specification.

The retrieval of program date time is only supported when using hls.js with our player. It is thus not available on iOS. Support for macOS Safari can be added by enabling forceHlsJSOnMacOSSafari setting.


Program date time metadata through player API

Since Radiant Media Player version 5.2.1 we provide native and easy-to-use extraction of program date time metadata through our player API:

Program date time API event

meta: this event fires each time program date time metadata are updated.

Program date time API method

getMetadata()

When invoked, this method will return Object|null representing the current program date time metadata. The returned Object when available will have the following structure:

{
  data: {
    programDateTime: Number, // epoch time in seconds for start of program date time
    rawProgramDateTime: String, // Date time for program date time (ISO/IEC 8601:2004)
    endProgramDateTime: Number, // epoch time in seconds for end of program date time
    start: Number, // start time of the metadata in seconds
    end: Number // end time of the metadata in seconds
  },
  type: "program-date-time"
}

Depending on your HLS stream not all attributes from the data object may be available

Player code example

<script src="https://cdn.radiantmediatechs.com/rmp/5.4.0/js/rmp.min.js"></script>
<div id="rmpPlayer"></div>
<script>
  var src = {
    hls: 'your-hls-stream-with-program-date-time-metadata'
  };
  var settings = {
    licenseKey: 'your-license-key',
    src: src,
    width: 640,
    height: 360,
    isLive: true
  };
  var elementID = 'rmpPlayer';
  var rmp = new RadiantMP(elementID);
  var rmpContainer = document.getElementById('rmpPlayer');
  // We listen to meta API event
  rmpContainer.addEventListener('meta', function () {
    // Each time meta event fires, getMetadata API method is updated and can be queried
    console.log(rmp.getMetadata());
  });
  rmp.init(settings);
</script>
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 3.0 License.