HLS (HTTP Live Streaming) (HLS)
Apple's adaptive streaming protocol. Splits video into small segments listed in an M3U8 playlist. The dominant streaming format, supported by every browser and device.
Full Explanation
HLS works by chopping video into small HTTP-downloadable segments (typically 6 seconds each in .ts or .m4s format) and listing them in a playlist file (.m3u8). The player fetches the playlist, picks a quality level based on bandwidth, and downloads segments one by one.
For CDNs, HLS is ideal because every segment is just a regular HTTP object that caches perfectly. A live stream with 5 quality levels and 6-second segments generates about 50 new cacheable objects per minute. The playlist file is the only part that changes frequently and needs short TTLs.
Low-Latency HLS (LL-HLS) reduces latency from 20-30 seconds down to 2-4 seconds using partial segments and blocking playlist requests. This requires HTTP/2 and more aggressive cache management at the edge.
Examples
# Example HLS master playlist (master.m3u8)
#EXTM3U
#EXT-X-STREAM-INF:BANDWIDTH=800000,RESOLUTION=640x360
360p/playlist.m3u8
#EXT-X-STREAM-INF:BANDWIDTH=2400000,RESOLUTION=1280x720
720p/playlist.m3u8
#EXT-X-STREAM-INF:BANDWIDTH=5000000,RESOLUTION=1920x1080
1080p/playlist.m3u8
# Cache-Control for HLS segments (long-lived, immutable)
Cache-Control: public, max-age=86400
# Cache-Control for live playlist (short TTL)
Cache-Control: public, max-age=1, s-maxage=1
Video Explanation
Frequently Asked Questions
Apple's adaptive streaming protocol. Splits video into small segments listed in an M3U8 playlist. The dominant streaming format, supported by every browser and device.
# Example HLS master playlist (master.m3u8)
#EXTM3U
#EXT-X-STREAM-INF:BANDWIDTH=800000,RESOLUTION=640x360
360p/playlist.m3u8
#EXT-X-STREAM-INF:BANDWIDTH=2400000,RESOLUTION=1280x720
720p/playlist.m3u8
#EXT-X-STREAM-INF:BANDWIDTH=5000000,RESOLUTION=1920x1080
1080p/playlist.m3u8
# Cache-Control for HLS segments (long-lived, immutable)
Cache-Control: public, max-age=86400
# Cache-Control for live playlist (short TTL)
Cache-Control: public, max-age=1, s-maxage=1
Related CDN concepts include:
- CMAF (Common Media Application Format) — A standard that allows the same media segments to be used with both HLS and …
- LL-HLS (Low-Latency HLS) — Apple's low-latency extension to HLS. Uses partial segments (sub-second chunks pushed before the full segment …
- Manifest File — A text file that describes the video stream structure: available quality levels (bitrates), segment URLs, …
- Segment — A small chunk of encoded video/audio, typically 2-10 seconds duration. Segments are the actual media …
- Cache-Control — The primary HTTP header for controlling caching behavior. Tells browsers, CDNs, and proxies whether to …