HLS Streaming
HLS (HTTP Live Streaming) is a video streaming protocol developed by Apple in 2009 and now the dominant standard for delivering video on the web. It works by slicing a video into small, sequential segments (typically 2-10 seconds each) and serving each segment over plain HTTP.
How it works
- Encoder produces multiple variants of the video at different resolutions/bitrates (360p, 720p, 1080p, etc.).
- Each variant is segmented — sliced into fixed-duration chunks.
- A master playlist (
.m3u8file) lists all variants and their bandwidth requirements. - Each variant has a media playlist listing its segments in order.
- The player downloads the master, picks a variant, downloads segments sequentially, and stitches them into continuous playback.
- The player adapts — measures download speed and switches variants up or down at segment boundaries.
Why HLS won
- HTTP delivery — works through every firewall, every CDN, every browser. No special protocols needed.
- Adaptive bitrate — quality adjusts to network conditions seamlessly.
- Cacheable segments — immutable segments cache well at CDN edge.
- Native support — every major browser, every TV platform, every mobile OS supports HLS natively or via libraries (HLS.js for Chrome/Firefox).
- Encryption-friendly — segments can be AES-128 encrypted at the segment level, with keys served separately.
Alternatives
- DASH (Dynamic Adaptive Streaming over HTTP) — similar to HLS but standardized via MPEG. More flexible codec support, less browser support out of the box.
- WebRTC — sub-second latency, peer-to-peer or via SFU. Used for live interactive (conferencing) — not for VOD.
- Progressive download (just an MP4 over HTTP) — simple, no adaptation, no streaming control. Fine for short clips, bad for long video.
File extensions
.m3u8— playlist file (master or media).ts— MPEG-TS segment (legacy).m4s— fragmented MP4 segment (modern, what HLS uses since 2017)
On AVCaption
Every video uploaded to AVCaption is encoded as HLS with AES-128 multi-key encryption. The player auto-selects HLS.js for non-Safari browsers and native HLS on Safari. See how this fits into the encrypted streaming pipeline and the adaptive bitrate streaming feature page.