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
  • Content protection
  • Closed captions and subtitles
  • Ad Insertion
  • Fast forward and reverse playback
  • Alternate audio
  • Fallback with Stream Alternates

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.

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
  • Prerecorded content: video on demand (VOD)
  • Alternate streams: multiple alternate streams at different bit rates
  • Intelligent switching: intelligent switching of streams in response to network bandwidth changes
  • Media encryption: encrypt the video content
  • User authentication: deliver the video/audio content with user authentication

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 ,

Better Programming

Advice for programmers.

More From Medium

More from Better Programming

More from Better Programming

More from Better Programming

More from Better Programming

Why Do Incompetent Managers Get Promoted?


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