Mastering HTTP Live Streaming

Part 1: Introduction to HLS

Balaji Malliswamy
Sep 26, 2019 · 3 min read

HTTP Live Streaming (HLS) sends audio and video over HTTP from an ordinary web server for playback on iOS-based devices. HLS is designed for reliability and dynamically adapts to network conditions by optimising playback for the available speed of wired and wireless connections.

Note: If your app delivers video content longer then 10 minutes or greater than 5MB of data, the App Store requires you to use HLS.

If your app uses HLS over cellular networks, you must provide at least one stream at 192Kbps or lower bandwidth. The low-bandwidth stream may be audio-only or audio with a still image.


Why HTTP Live Streaming?

In earlier days, streaming a video over a network was not an easy job to do. If you have a single HD file on your server and you have to play that video in a mobile that only has the 2G network bandwidth, just think how much time you have to wait to see the entire video. Also, we need a streaming server to serve the video to users.

HLS help us easily deploy media content in streams using common place web servers rather than specialized streaming servers. Lets discuss the key features of HLS

  • Adaptive streaming

Adaptive streaming

The basic idea behind adaptive streaming is to generate various versions of the media file on different resolutions and bitrate (bps in a video/audio). Then choose one of them based on the user’s bandwidth, screen size, and other factors.

Those different versions of the video files are split into multiple chunks that are then played according to the user’s bandwidth. You can clearly see how the adaptive streaming in HLS works from the image.

Adaptive streaming in HLS

Based on a wide range of user’s bandwidth environment (2G, 3G, 4G, LTE, WIFI Low, WIFI High), the video can be played with respective HLS bitrate versions 240p, 360p, 480p, 720p, and 1080p. This also allows the user to switch from one bitrate version to another, which will give the seamless streaming experience to the user.

Content protection

Media segments can be individually encrypted using sample-level encryption. References to the corresponding key files appear in the playlist file so the player can retrieve the keys for decryption.

HLS supports key exchange with the method of your choice. Static keys, encoder generated keys, and frequently updated keys are just a few of the possibilities.


What Does HLS Support?

HLS supports the following:

  • Live broadcasts

The next step will be a deep understanding of how the HLS works. For this we need to understand the architecture of HLS. I think this deserves a separate post. Part 2: Components of HTTP Live Streaming

Better Programming

Advice for programmers.

Balaji Malliswamy

Written by

 developer, Chennai & Writer at Swift India https://about.me/balajimalliswamy , https://unsplash.com/@blahji

Better Programming

Advice for programmers.

Welcome to a place where words matter. On Medium, smart voices and original ideas take center stage - with no ads in sight. Watch
Follow all the topics you care about, and we’ll deliver the best stories for you to your homepage and inbox. Explore
Get unlimited access to the best stories on Medium — and support writers while you’re at it. Just $5/month. Upgrade