How HLS Streaming Works: Protocol Explained in Detail
The HLS Protocol Stack
- Application — codecs such as H.264/HEVC + AAC.
- Transport packaging — MPEG-TS (.ts) or fragmented MP4.
- Playlist — M3U8 master + media playlists.
- Delivery — plain HTTP/HTTPS (CDN-friendly).
Master Playlist Structure
#EXTM3U #EXT-X-STREAM-INF:BANDWIDTH=1280000,RESOLUTION=720x480 medium.m3u8 #EXT-X-STREAM-INF:BANDWIDTH=2560000,RESOLUTION=1280x720 high.m3u8 #EXT-X-STREAM-INF:BANDWIDTH=5120000,RESOLUTION=1920x1080 fullhd.m3u8
The player chooses a variant, then loads that media playlist. Format details: M3U8 format explained.
Media Playlist Structure
#EXTM3U #EXT-X-TARGETDURATION:10 #EXT-X-VERSION:3 #EXTINF:10.000, segment-001.ts #EXTINF:10.000, segment-002.ts #EXT-X-ENDLIST
#EXT-X-ENDLIST marks VOD. Live lists omit it and keep updating.
Adaptive Bitrate Logic
ABR watches download speed, buffer health, and device limits, then switches variants between segments. Good players hide the switch; poor ones rebuffer. Explainer: adaptive bitrate streaming.
Latency Timeline
Classic HLS waits for full segments, so latency is often 15–30 seconds. LL-HLS uses partial segments and faster playlist updates to reach roughly 2–5 seconds. Trade-offs: understanding HLS latency.
Frequently Asked Questions
What files does HLS need?
Playlists (M3U8) plus segment files.
Who chooses quality?
Usually the player via ABR; users can override.
Why is HLS delayed?
Segment packaging and buffering add seconds by design.
How do I play HLS in Chrome?
Use hls.js or an online player.