How HLS Works: A Technical Guide to Apple's HTTP Live Streaming
HTTP Live Streaming (HLS) turned ordinary HTTP infrastructure into a reliable way to deliver adaptive video. Apple introduced it in 2009, and it remains the safest default for reaching iPhone, iPad, Apple TV, macOS, Safari, and a long list of other players.
HLS works by splitting media into small files, describing those files with playlists, and letting the player choose the best quality it can sustain. The protocol is simple enough to cache well and flexible enough to power both live and on-demand video.
The Basic Architecture
An HLS stream usually starts with two playlist layers:
- A master playlist that lists available variants.
- Media playlists that list the segment URLs for each variant.
A variant is a specific combination of resolution, bitrate, codec, audio group, subtitles, and other playback attributes. The player downloads the master playlist, selects a variant, then begins fetching segments from that variant's media playlist.
HLS playback path
The player moves from playlist to playable media
1
Master playlist
Lists bitrate, resolution, codecs, audio, and subtitles.
2
Variant choice
Player chooses based on device and network conditions.
3
Media playlist
Provides segment URLs and timing information.
4
Segments
Small media files are downloaded and appended to the buffer.
The Master Playlist
The master playlist is the entry point. It tells the player what renditions are available and what each one costs in bandwidth.
#EXTM3U
#EXT-X-STREAM-INF:BANDWIDTH=5000000,RESOLUTION=1920x1080
1080p.m3u8
#EXT-X-STREAM-INF:BANDWIDTH=3000000,RESOLUTION=1280x720
720p.m3u8
#EXT-X-STREAM-INF:BANDWIDTH=1500000,RESOLUTION=854x480
480p.m3u8The player does not simply pick the biggest rendition. It weighs throughput, buffer health, screen size, codec support, and past download behavior.
Media Playlists and Segments
Each variant has its own media playlist. That playlist contains a sequence of segment references and timing metadata.
#EXTM3U
#EXT-X-TARGETDURATION:6
#EXTINF:6.000,
segment_0.ts
#EXTINF:6.000,
segment_1.ts
#EXTINF:6.000,
segment_2.ts
#EXT-X-ENDLISTFor on-demand video, the playlist can include the full list of segments. For live video, the playlist updates as new segments become available and older segments fall out of the live window.
Adaptive Bitrate Switching
HLS is designed to protect playback continuity. If bandwidth drops, the player should step down before the buffer runs out. If bandwidth improves, the player can step up once there is enough confidence that the higher bitrate will not stall.
The key inputs are:
- Segment download speed
- Current buffer depth
- Device decode capability
- Screen size and viewport
- Historical throughput stability
Adaptive decision
Quality rises only when the buffer can afford it
Switching usually happens at segment boundaries, which is why segment duration affects how quickly the player can respond.
TS, fMP4, and CMAF
Traditional HLS used MPEG-2 Transport Stream segments with .ts extensions. TS is mature and widely supported, but it does not share media cleanly with DASH.
Modern HLS workflows often use fragmented MP4 segments through CMAF. That lets HLS and DASH reference the same media files while keeping their own manifests.
| Segment format | Common extension | Operational fit |
|---|---|---|
| MPEG-2 TS | .ts | Legacy compatibility |
| Fragmented MP4 / CMAF | .m4s | Shared HLS and DASH media |
This is why modern streaming stacks often keep HLS as the playback protocol while moving the media layer to CMAF.
Live Streaming with HLS
For live streams, the media playlist advances over time. The server adds new segments, the player reloads the playlist, and the live window moves forward.
#EXTM3U
#EXT-X-TARGETDURATION:6
#EXT-X-MEDIA-SEQUENCE:100
#EXTINF:6.000,
segment_100.ts
#EXTINF:6.000,
segment_101.ts
#EXTINF:6.000,
segment_102.ts#EXT-X-MEDIA-SEQUENCE tells the player which segment is currently the oldest available in the live window. This keeps the player oriented as old segments expire and new ones arrive.
DRM and HLS
HLS supports encrypted playback with AES-128, SAMPLE-AES, and FairPlay Streaming. For Apple environments, FairPlay is the commercial DRM path most teams care about.
DRM adds more than encryption. The player also needs license acquisition, key rotation behavior, and compatibility across browsers, operating systems, and devices. HLS remains important because it is the native path for protected playback on Apple devices.
Low-Latency HLS
Low-Latency HLS reduces live delay by using partial segments, preload hints, blocking playlist reload, and tighter player behavior. Instead of waiting for full segments to appear, the player can receive smaller parts earlier and stay closer to the live edge.
LL-HLS can support very low delays, but only when the full chain cooperates: encoder, origin, CDN, playlist generation, and player. A low-latency playlist cannot overcome a slow origin or a CDN that buffers partial responses poorly.
When HLS Is the Right Choice
HLS is usually the safest default when:
- Apple playback matters.
- You need broad device compatibility.
- You need FairPlay DRM support.
- You are delivering live or on-demand adaptive video.
- You want a mature protocol with strong CDN behavior.
Many platforms pair HLS with DASH, especially when Android, web, and multi-DRM workflows matter. HLS remains the most important protocol to get right because it sits at the center of the Apple playback ecosystem.
The Practical Takeaway
HLS is durable because it is simple at the infrastructure layer and adaptive at the player layer. Text playlists describe the ladder. HTTP segments move through standard caches. The player chooses the best quality it can sustain.
Whether the media underneath is legacy TS or modern CMAF, HLS remains one of the foundational protocols for reliable streaming at scale.
Read more
How HLS Works: A Technical Guide to Apple's HTTP Live Streaming
A practical guide to HLS, from master playlists and media segments to adaptive bitrate switching, live playback, Low-Latency HLS, DRM, and CMAF support.
Why Videospan Uses CMAF for Scalable Video Delivery
How CMAF lets Videospan run a unified HLS and DASH delivery pipeline with lower storage cost, cleaner DRM operations, and faster playback adaptation.
How CMAF Works: The Common Media Application Format Explained
A practical technical breakdown of CMAF, the segmented media format that lets HLS and DASH share files while improving cache efficiency, DRM workflows, and low-latency delivery.