Mastering HTTP Live Streaming

Part 2: Components of HTTP Live Streaming

Balaji Malliswamy
Swift India
3 min readOct 1, 2019

--

Components of HTTP Live Streaming

This article is a part of Mastering HTTP Live Streaming series. In my previous article, I described about HTTP Live Streaming

In this article, I’m going to explain setup architecture of HLS and basic tags of .m3u8 playlist file.

Server Component

The server component consists of three important things, using these we will create the master playlist file (.m3u8)

  • Encoder : Converting data from one format to another using defined compression mechanism
  • Transcoder: Creating multiple quality variants of the same content.
  • Stream Segmenter: Breaking the content into a series of short media files

Distribution Component

The distribution system is generally a combination web server and a web-caching system (CDN) that delivers the media files and index files to the client over HTTP.

  • Origin web server : System that delivers the media files and index files of the client over HTTP
  • CDN (Content delivery network)

Client (Player)

The player is a client here, it’s responsible for playing the HLS content in the user’s device. The player begins by fetching the content of the .m3u8 file, using the media playlist URL’s it will download the media chunks in sequence and reassembles them to present the continuous streaming to the user.

This process continues until the player encounters an end tag in the .m3u8 file. If no end tag is present, the .m3u8 file is part of an ongoing broadcast i.e live event.

During ongoing broadcasts, the player loads a new version of the .m3u8 file periodically to download updated media chunks.

AVPlayer for play the HLS video

M3U8 Playlist

This image shows how the index file (master.m3u8) was constructed and these are the important tags we need to know about the HSL.

.m3u8 file structure

EXTM3U: Indicates that the playlist is an extended M3U file. All HLS playlists must start with this tag.

EXT-X-PLAYLIST-TYPE: This tag may contain a value of either EVENT (Live) or VOD. If the tag is present and has a value of EVENT, the server must not change or delete any part of the playlist file. If the tag is present and has a value of VOD, the playlist file must not change.

EXT-X-TARGETDURATION: Specifies the maximum media-file duration.

EXT-X-VERSION: HLS protocol version.

EXT-X-MEDIA-SEQUENCE: Indicates the sequence number of the first URL that appears in a playlist file.

EXTINF: A record marker that describes the media file identified by the URL that follows it. Each media file URL must be preceded by an EXTINF tag.

EXT-X-STREAM-INF: Indicates that the next URL in the playlist file identifies another playlist file, parameter defines stream’s metadata like BANDWIDTH, AVERAGE-BANDWIDTH, RESOLUTION, CODECS, etc.

EXT-X-ENDLIST: Indicates that no more media files will be added to the playlist file.

The next step will be how to integrate HLS with your app. I think this deserves a separate post. I’m planning to write one soon, keep watching this space for updates.

Find it a good read?

Recommend this post (by clicking 👏 button) so other people can see it too…
reach me on Twitter Balaji Malliswamy

--

--

Balaji Malliswamy
Swift India

iOS Engineer, Technical Lead @ivymobility • Writer @ Swift India Publication • Event Organizer @swiftindiagroup meetups. • https://unsplash.com/@blahji