Summary

HTTP Live Streaming ref HLS format is an adaptive bitrate live streaming video protocol. Originally developed by Apple for use on iOS, Mac OS, and Apple TV devices, HLS streaming has become the most widely used live video protocol or web video.

Pros

  1. Excellent quality
  2. Supported on all devices
  3. Cost efficient
  4. Privacy and Security

Cons

  1. Latency
  2. Internet speed

Therefore, it usually adds a delay of 20-60 seconds to your stream

How it works?

  • At a high level, HLS works like all adaptive streaming technologies;

  • you create multiple files for distribution to the player, which can adaptively change streams to optimize the playback experience.

  • As an HTTP-based technology, no streaming server is required, so all the switching logic resides on the player.

    index.m3u8 file

Each chunk, .ts format, will be of the duration between 5-10 seconds. The index.m3u8 file directs the client or player to play next chunk.

This is what pretty much happens in tfarraj project. In this project, segments of .ts (MPEG2 Transport Stream) format were transmitted, each segment get returned with 206 (partial content) response.

index.m3u8 for different resolutions is fetched first.

Then Shaka Player determines which quality is ideal and select the playlist index to start playing. For instance in this example, the Shaka Player selected 1080.m3u8 index and started fetching the videos files of that resolutions. Even during the playback, if the network speed drops, the player can switch to different resolution index file.