Using time-shifted viewing with CDNs - AWS Elemental MediaTailor

Using time-shifted viewing with CDNs

To achieve a sliding window when provided with a start time or start program, MediaTailor translates the start time or start program value into an appropriate time delay. The value of that time delay depends on the time at which the player or CDN requests the manifest. Because of this, when using a CDN with MediaTailor’s start time or start program parameters, you must configure the appropriate caching behavior on your CDN.

HLS example

Suppose that you request an HLS primary manifest with a start time using a URL like the one below:

https://<some prefix>.channel-assembly.mediatailor.us-west-2.amazonaws.com/v1/channel/ExampleChannel/index_hls.m3u8?aws.mediatailor.channel.startTime=2017-12-19T13:00:28-08:00

MediaTailor responds with a manifest that includes time-delay parameters on the child manifest URLs. For example, if you request the manifest at time 2017-12-19T13:20:28-08:00, which is 1200 seconds after the requested start time, then MediaTailor responds with a primary manifest like the one below:

#EXTM3U #EXT-X-VERSION:6 #EXT-X-STREAM-INF:CODECS="avc1.4D401F,mp4a.40.2",AVERAGE-BANDWIDTH=1426714,RESOLUTION=852x480,FRAME-RATE=30.0,BANDWIDTH=1493368 index_hls/1.m3u8?aws.mediatailor.channel.timeDelay=1200 #EXT-X-STREAM-INF:CODECS="avc1.4D401E,mp4a.40.2",AVERAGE-BANDWIDTH=986714,RESOLUTION=640x360,FRAME-RATE=30.0,BANDWIDTH=1024034 index_hls/2.m3u8?aws.mediatailor.channel.timeDelay=1200 #EXT-X-STREAM-INF:CODECS="avc1.4D400D,mp4a.40.2",AVERAGE-BANDWIDTH=476305,RESOLUTION=320x240,FRAME-RATE=30.0,BANDWIDTH=498374 index_hls/3.m3u8?aws.mediatailor.channel.timeDelay=1200

DASH example

Suppose that you request a DASH manifest with a start time using a URL like the one below:

https://<some prefix>.channel-assembly.mediatailor.us-west-2.amazonaws.com/v1/channel/ExampleChannel/index_dash.mpd?aws.mediatailor.channel.startTime=2017-12-19T13:00:28-08:00

MediaTailor responds with a redirect to the same manifest, but with a time delay instead of a start time. For example, if you request the manifest at time 2017-12-19T13:20:28-08:00, which is 1200 seconds after the requested start time, then MediaTailor responds with HTTP status 302 Found and a Location header with value ./index_dash.mpd?aws.mediatailor.channel.timeDelay=1200.

CDN configuration requirements

When using time-shifting query parameters with a CDN, we recommend that you configure your CDN as follows:

  • If you use any time shifting query parameters, include those parameters in your CDN’s cache key. Additionally, include the time-delay query parameter in your CDN’s cache key if you use any time-shifting parameters.

  • If you use one of the start-time or start-program query parameters, then the following apply:

    • For HLS, configure your CDN to cache primary manifests for no longer than a typical segment duration on your channel.

    • For DASH, configure your CDN to cache redirects with HTTP status 302 for no longer than a typical segment duration on your channel, and to forward such redirects to the player.

For information on how to configure caching on Amazon CloudFront, refer to Managing how long content stays in the cache (expiration) in the CloudFront Developer guide. For information on how Amazon CloudFront handles redirects, refer to How CloudFront processes HTTP 3xx status codes from your origin. in the CloudFront Developer guide.