HTTP Live Streaming (HLS)

The HLS streaming protocol was developed by Apple and is most suitable for those who wish to stream to mobile devices with less buffering time or with an HTML5 video player. Highly compatible, HTTP Live Streaming is considered a universal protocol and uses HTTP to transmit media streams over the Internet.

What is HTTP Live Streaming Protocol?

HTTP Live Streaming (HLS) is a protocol that leverages HTTP to deliver media files in small chunks to reduce buffering and lower latency. HLS responds to changes in transfer speeds and adjusts the quality of the streamed media accordingly, enabling the stream to continue at a lower video quality even if transfer speeds drop. It can increase the quality once transfer speeds have recovered.

Apple developed HLS streaming as a replacement for its QuickTime streaming server. Before the HLS protocol, streaming media over the internet entailed user diagram protocols (UDP) and proprietary services like QuickTime or Adobe Flash. But QuickTime and UDPs are easily susceptible to firewalls and have limited error-checking capabilities. And Flash required a plugin to be installed and contained design flaws that compromised its security. HLS circumvented these issues because its straightforward design works natively over HTTP.

How Does HTTP Live Streaming (HLS) Work?

HLS breaks media files into smaller chunks so that a client device can easily stream them. The client can then continuously play these chunks and append new ones to deliver a high-quality, uninterrupted stream. HLS streaming requires a server, distribution technology, and a receiving device to operate. The HLS protocol leverages a variable bitrate to increase or decrease the bitrate of a stream (if encoded in such a way) to accommodate the best fit for available screen resolution and network conditions.

Server

The server is where the on-demand media file originates and is stored. Also, the live stream is created here. Because the HLS protocol is based on HTTP, any web server can initiate a stream.

The server is responsible for two primary functions:

  1. Encoding: This process reformats the video data so that any device can recognize and interpret the data. HLS must use H.264 or H.265 encoding.
  2. Segmenting: This process divides the video into sections that are only a few seconds in length, typically 6 seconds. The HLS protocol creates an index file of these segments to record the order they belong in and duplicate them at different quality levels.

Distribution

The encoded video segments are distributed over a content delivery network (CDN) to client devices over the Internet when client devices request the stream.

Client Device

The end user’s device receives the stream and plays the video, like a smartphone or laptop. The client device uses the index file as a reference for assembling the video in order, adjusting from a higher quality to a lower quality picture according to Internet conditions.

Technical Overview of An HTTP Live Stream

The HLS protocol divides MP4 video content into 6-10 second chunks with the .ts file extension (MPEG2 Transport Stream). Then, an HTTP server stores those streams and delivers these short clips to viewers on their devices. The HLS stream will play video encoded with the H.264 or HEVC/H.265 codecs. The HTTP server also creates an M3U8 playlist file to index the video chunks, so the file will still exist even when broadcasting live with a single quality option.

When To Use An HTTP Live Stream

There are many streaming protocols to choose from, each with unique advantages and disadvantages. But there are two primary use cases in which HLS streaming is the best option.

Streaming to Mobile Devices

HLS mobile streaming supports all portable devices, including phones, tablets, and other streaming media players. When it comes to streaming to mobile devices and tablets, HLS streaming is a top choice. Given that mobile devices now make up the majority of internet and streaming traffic, any video streaming solution you use must be compatible with mobile devices.

Streaming with an HTML5 Video Player

The HTML5 video player comes standard issue for websites, apps, and mobile devices that play video content, but does not support RTMP or HDS streaming protocols. You must use HLS with an HTML5 video player.

Devices and Browsers That Support HTTP Live Streaming

HLS is considered a universal streaming protocol widely supported across multiple devices and browsers. Developed by Apple, HLS’s compatibility was originally limited to iOS devices like iPhones, iPads, and the iPod Touch but is now supported by the following:

  • Google Chrome
  • Safari
  • Microsoft Edge
  • iOS
  • Android
  • Linux
  • Microsoft
  • macOS

When Not To Use HTTP Live Streaming

HLS streaming has one disadvantage –its latency is relatively higher than other video streaming protocols. If you are looking to host a live broadcast or watch a live stream, HLS might not be the right protocol for you. HLS viewers can experience delays of up to 30 seconds or more in some cases. The majority of live streams can handle that kind of delay without causing any sort of user dissatisfaction. Still, it can be an issue when streaming something like a live sporting event or major news update.

Testing Your HLS Stream

Testing your HLS stream can help ensure a flawless live broadcast. By using one of the three tools below, you can measure the latency, buffer time, playback rate, and quality of your HLS video stream.

  • TheoPlayer: THEO supports the testing and streaming of protocols like HLS.
  • Akami: Akami is a free HLS stream testing and validating tool.
  • Bitmovin: Bitmovin is a free tool to help you test and prepare for your live HLS broadcast.

What is HLS Monitoring?

When using the HLS streaming protocol, you must monitor the network statistics around the jitter and performance of the objects with unique bitrates because if any of them are missing or unavailable, the entire user experience is negatively impacted. HLS monitoring companies like Catchpoint, Mividi, Qosifire, and Dualz keep a close watch on the following aspects of your content stream:

  • Connection events and issues
  • DNS-related events and issues
  • Redirects
  • General info
  • Playlist and chunklist issues
  • Chunk validation
  • Buffering

HTTP Live Streaming (HLS) Alternatives

Apple introduced Low-Latency HLS (LL-HLS) to bring latency down to an acceptable level for interactive applications. LL-HLS achieves latencies ranging from 3-5 seconds by using smaller segment durations, enabling real-time segment updates, and implementing other optimizations. Other protocols, like WebRTC are often preferred for video, audio, and livestreaming applications that require extremely low latency, as they are specifically designed for low-latency scenarios and can achieve latencies in the range of milliseconds to a few seconds.

Frequently Asked Questions

What is the difference of HLS vs DASH protocols?

HLS is more widely compatible with over a billion iOS users globally. Unless those users use third-party browsers, they can’t play MPEG-DASH video streams. Both offer high quality streaming and are equally reliable.

Is HLS proprietary?

HLS was developed by Apple and was originally exclusive to iPhones, but today almost every device supports this protocol, making it a proprietary format.

Is HLS a transport stream?

HLS is not a transport stream. Instead, it leverages the MPEG-2 Transport Stream protocol to deliver media files.

Is HLS Unicast or Multicast?

HLS video is a multicast streaming standard. Designed by Apple for Quicktime, Safari, and iOS devices, HLS breaks the video stream into small chunks that are delivered via HTTP.

Does HLS use RTMP?

HLS does not use RTMP, it uses HTTP. However, it's possible for RTMP to also use HTTP, which is called RTMPT.

Next Steps

Start by opening an account and trying out our products. We’re here to help you understand the best solution to your use case. Contact us any time to learn more about Stream.

Chat Messaging

Build any kind of chat messaging experience without scalability or reliability issues.

Learn more about $ Chat Messaging

Activity Feeds

Build any kind of feed without the headache of scalability or reliability of your feeds.

Learn more about $ Activity Feeds