HLS

After completing your HLS ingest setup for MSL5, configure your encoder to capture and push your stream to the entry points.

To prevent stream vulnerability to potential network problems, you must actively use both primary and backup streams. This adds redundancy by implementing an automatic failover feature should one stream or the other fail. The easiest way to use primary/backup streams is to set them up in a single encoder. Not all third-party encoders support this, however, and with those it becomes necessary to use separate encoders to stream primary and backup.

While primary/backup streaming is possible with dual encoders, it is not automated and requires certain manual steps to enable it. With typical single encoder primary/backup functionality, the encoder automatically creates a variant playlist that includes all primary and backup bitrates. This ensures that the primary and backup streams are always aware of each other's existence and allows for automatic failover from one to the other. With situations that require dual encoders, this automatic playlist generation does not occur. Here, each encoder creates variant playlists for the primary or backup stream only, requiring manual manipulation to create a merged playlist that includes both primary and backup streams.

In addition, there might be circumstances where you need dual encoders in two separate geographical locations, with one streaming the primary and the other streaming the backup. In this case, even encoders that support primary/backup from a single encoder will require the dual encoder solution with regard to variant playlist generation.

HLS Publishing URL

The encoder publishes primary and backup streams for the HLS protocol according to the following URL syntax.

StreamHostnamePathExample
Primaryp-ep{stream_id}.i.mslentrypoint.net{stream_id}/{event_name}https://p-ep50002.i.mslentrypoint.net/50002/event1/master.m3u8
Backupb-ep{stream_id}.i.mslentrypoint.net{stream_id}-b/{event_name}https://b-ep50002.i.mslentrypoint.net/50002-b/event1/master.m3u8

The MSL5 system defines a stream as a combination of stream_id and event_name. All ingested content, such as variant playlists, bitrate playlists, and segments, should have a common event_name in the path.
In Backup URLs, note the -b in the path.

HLS Playback URL

To playback HLS streams, construct the URL according to the following syntax.
The following URLs are used for playback. The {stream_id} and {event_name} placeholders correspond to the stream's configuration.

Delivery PathStream TypePlayback URL FormatNotes
CDNPrimaryhttps://<cdn_hostname>/hls/live/ <stream_id>/<event_name>/<filename>.m3u8The CDN hostname depends on your configuration (e.g., Akamai AMD). Refer to Create a new AMD property for setup instructions.
CDNBackuphttps://<cdn_hostname>/hls/live/<stream_id>-b/<event_name>/<filename>.m3u8The CDN hostname depends on your configuration (e.g., Akamai AMD). Refer to Create a new AMD property for setup instructions.

In Backup URLs, note the -b in the path.

Playback URL example

PathExample
CDN-Primaryhttps://<cdn_hostname>/hls/live/50002/event1/index.m3u8

Create a merged variant playlist

To create a merged playlist, you must extract the variant playlists from each encoder and manually merge them. For example, assume a primary variant playlist URL of:

https://<cdn_hostname>/hls/live/50002/event1/master.m3u8

Start your encoder, and then use the UNIX curl command to acquire the variant playlist's contents.

curl https://<cdn_hostname>/hls/live/50002/event1/master.m3u8
 
#EXTM3U
#EXT-X-STREAM-INF:PROGRAM-ID=1, BANDWIDTH=165135
https://<cdn_hostname>/hls/live/50002/event1/iphone110.m3u8
#EXT-X-STREAM-INF:PROGRAM-ID=1, BANDWIDTH=262346
https://<cdn_hostname>/hls/live/50002/event1/iphone200.m3u8
#EXT-X-STREAM-INF:PROGRAM-ID=1, BANDWIDTH=481677
https://<cdn_hostname>/hls/live/50002/event1/iphone400.m3u8
#EXT-X-STREAM-INF:PROGRAM-ID=1, BANDWIDTH=688301
https://<cdn_hostname>/hls/live/50002/event1/ipad600.m3u8
#EXT-X-STREAM-INF:PROGRAM-ID=1, BANDWIDTH=894877
https://<cdn_hostname>/hls/live/50002/event1/ipad800.m3u8
#EXT-X-STREAM-INF:PROGRAM-ID=1, BANDWIDTH=1308077
https://<cdn_hostname>/hls/live/50002/event1/ipad1200.m3u8
#EXT-X-STREAM-INF:PROGRAM-ID=1, BANDWIDTH=40000
https://<cdn_hostname>/hls/live/50002/event1/iphone110audio.m3u8 
📘

Notice that each line denotes a different bitrate.

Now, do the same for the backup variant playlist URL:

https://<cdn_hostname>/hls/live/50002-b/event1/master.m3u8

curl https://<cdn_hostname>/hls/live/50002-b/event1/master.m3u8
 
#EXTM3U
#EXT-X-STREAM-INF:PROGRAM-ID=1, BANDWIDTH=165135
https://<cdn_hostname>/hls/live/50002-b/event1/iphone110.m3u8
#EXT-X-STREAM-INF:PROGRAM-ID=1, BANDWIDTH=262346
https://<cdn_hostname>/hls/live/50002-b/event1/iphone200.m3u8
#EXT-X-STREAM-INF:PROGRAM-ID=1, BANDWIDTH=481677
https://<cdn_hostname>/hls/live/50002-b/event1/iphone400.m3u8
#EXT-X-STREAM-INF:PROGRAM-ID=1, BANDWIDTH=688301
https://<cdn_hostname>/hls/live/50002-b/event1/ipad600.m3u8
#EXT-X-STREAM-INF:PROGRAM-ID=1, BANDWIDTH=894877
https://<cdn_hostname>/hls/live/50002-b/event1/ipad800.m3u8
#EXT-X-STREAM-INF:PROGRAM-ID=1, BANDWIDTH=1308077
https://<cdn_hostname>/hls/live/50002-b/event1/ipad1200.m3u8
#EXT-X-STREAM-INF:PROGRAM-ID=1, BANDWIDTH=40000
https://<cdn_hostname>/hls/live/50002-b/event1/iphone110audio.m3u8 

Manually merge the contents of each of these files to produce the following:

#EXTM3U
#EXT-X-STREAM-INF:PROGRAM-ID=1, BANDWIDTH=165135
https://<cdn_hostname>/hls/live/50002/event1/iphone110.m3u8
#EXT-X-STREAM-INF:PROGRAM-ID=1, BANDWIDTH=165135
https://<cdn_hostname>/hls/live/50002-b/event1/iphone110.m3u8
#EXT-X-STREAM-INF:PROGRAM-ID=1, BANDWIDTH=262346
https://<cdn_hostname>/hls/live/50002/event1/iphone200.m3u8
#EXT-X-STREAM-INF:PROGRAM-ID=1, BANDWIDTH=262346
https://<cdn_hostname>/hls/live/50002-b/event1/iphone200.m3u8
#EXT-X-STREAM-INF:PROGRAM-ID=1, BANDWIDTH=481677
https://<cdn_hostname>/hls/live/50002/event1/iphone400.m3u8
#EXT-X-STREAM-INF:PROGRAM-ID=1, BANDWIDTH=481677
https://<cdn_hostname>/hls/live/50002-b/event1/iphone400.m3u8
#EXT-X-STREAM-INF:PROGRAM-ID=1, BANDWIDTH=688301
https://<cdn_hostname>/hls/live/50002/event1/ipad600.m3u8
#EXT-X-STREAM-INF:PROGRAM-ID=1, BANDWIDTH=688301
https://<cdn_hostname>/hls/live/50002-b/event1/ipad600.m3u8
#EXT-X-STREAM-INF:PROGRAM-ID=1, BANDWIDTH=894877
https://<cdn_hostname>/hls/live/50002/event1/ipad800.m3u8
#EXT-X-STREAM-INF:PROGRAM-ID=1, BANDWIDTH=894877
https://<cdn_hostname>/hls/live/50002-b/event1/ipad800.m3u8
#EXT-X-STREAM-INF:PROGRAM-ID=1, BANDWIDTH=1308077
https://<cdn_hostname>/hls/live/50002/event1/ipad1200.m3u8
#EXT-X-STREAM-INF:PROGRAM-ID=1, BANDWIDTH=1308077
https://<cdn_hostname>/hls/live/50002-b/event1/ipad1200.m3u8
#EXT-X-STREAM-INF:PROGRAM-ID=1, BANDWIDTH=40000
https://<cdn_hostname>/hls/live/50002/event1/iphone110audio.m3u8
#EXT-X-STREAM-INF:PROGRAM-ID=1, BANDWIDTH=40000
http://<cdn_hostname>/hls/live/50002-b/event1/iphone110audio.m3u8 

Notice that each bitrate in the list has a primary and a backup associated with it.

Finally, use the curl command to post the file to the primary ingress URL.

curl -T master.m3u8 https://p-ep50002.i.mslentrypoint.net/50002/event1/index.m3u8 
📘

As shown in the curl upload example, ensure that the merged variant playlist name is different from existing playlist names so that it is not overwritten. For example, if master.m3u8 is used by your primary and backup, you can rename the merged playlist to index.m3u8 or playlist.m3u8. If master.m3u8 is used by your primary and playlist.m3u8 is used by your backup, you could rename the merged playlist to index.m3u8.