DVR

This tutorial shows how to configure DVR playback on AMP properly.

  1. Pre-requisites

  2. Enabling DVR mode

  3. Media Temporal Types

  4. Calculating UTC timecode

1. Pre-requisites

To leverage the player’s API, the stream must have a valid sliding window regardless of the format HLS, or Dash; most live streams do not have this feature enabled by default and may depend on the CDN capabilities.

2. Enabling DVR mode

AMP does provide a player API to handle the DVR stream playback properly, progress on the sliding window, and a featured player UI.

To enable DVR mode on AMP, the "temporalType" attribute on the media configuration object should be set to "dvr" as follow.

var config = {
  media: {
	    guid: "Video 1",
		title: "Windowed DVR",
		temporalType: "dvr",
		source: [{
			src: "http://mcqalivesmdvr1-f.akamaihd.net/i/mav001_1@22121/index_800_av-p.m3u8?sd=10&dw=600&rebase=on",
			type: "application/x-mpegURL"
		}]
};

3. Media Temporal Types

The values for temporalType represent the following functionality:

  • "vod": Used for most finite streams, i.e., clips, movies, series.

  • "live": Stream will be set on the edge, and most of the player controls will be prohibited, i.e. seeking, rewinding, and forward jumping.

  • "dvr": Allows users to move through the sliding window during live streaming.

If the temporal type is not provided, the player will detect and choose between live and vod, but not for dvr.

4. Calculating UTC timecode

UTC timecode can be determined using toUTC player helper, this function

akamai.amp.AMP.create("amp", config, function(event) {
    amp = event.player;
    amp.addEventListener("timeupdate", function(event){
        const utc= amp.toUTC(event.detail)
    })
});

If required, the UTC timecode can be adjusted using startDate property only for for browser native playback

config = {
	autoplay: true,
	startDate: Date.now()
}
Last modified: Mar/2023, AMP Support.