What is hls?
HLS stands for HTTP Live Streaming. It is a streaming protocol created by Apple that delivers video and audio over the internet by breaking the media into small, downloadable chunks and using a simple text playlist to tell the player which chunks to play and in what order.
Let's break it down
- Media files: The original video is encoded at several quality levels (bitrates).
- Segments: Each quality version is split into short pieces, usually 2‑10 seconds long.
- Playlist (.m3u8): A tiny text file that lists the URLs of the segments and tells the player which bitrate streams are available.
- Adaptive bitrate: The player can switch between quality levels on the fly, depending on the viewer’s internet speed.
- Delivery: All files are served over regular HTTP, so they can be cached by CDNs and pass through firewalls easily.
Why does it matter?
HLS makes streaming video smooth for users on any device or network condition. Because it uses ordinary web servers and can adjust quality automatically, viewers get fewer interruptions, and content providers can reach a wider audience without needing special infrastructure.
Where is it used?
- Apple devices (iPhone, iPad, Apple TV) use HLS natively.
- Many streaming services (e.g., Hulu, Disney+, some YouTube live streams) offer HLS as one of their delivery options.
- News broadcasters, sports leagues, and corporate webinars often rely on HLS for live events.
- Any website that needs to embed video that works across browsers and mobile platforms may use HLS behind the scenes.
Good things about it
- Works on almost every modern browser and mobile OS.
- Uses standard HTTP, so it benefits from existing CDNs, caching, and firewall rules.
- Adaptive bitrate provides a better viewing experience on fluctuating connections.
- Simple to set up: just generate segments and a playlist, then host them like any other files.
- Open and well‑documented, with many free tools for encoding and packaging.
Not-so-good things
- Higher latency than some low‑delay protocols, which can be an issue for real‑time interaction (e.g., gaming, live auctions).
- Segmenting adds overhead, slightly increasing bandwidth usage.
- DRM support is less flexible compared to newer standards like MPEG‑DASH with Widevine.
- Older versions of HLS lack support for newer codecs (e.g., AV1) without additional workarounds.
- Because it relies on many small files, a large number of requests can stress some servers if not properly cached.