Understanding HTTP Live Streaming (HLS)
HLS — HTTP Live Streaming — is one of the most widely deployed protocols for delivering audio and video over the internet. Originally developed by Apple and released in 2009, it is now an industry-standard approach used by major streaming platforms, broadcasters, and CDNs worldwide. Despite its name, HLS works for audio-only streams just as well as video.
The Core Concept: Chunks Over HTTP
Unlike traditional streaming protocols that maintained a persistent connection (like RTMP), HLS breaks media into small discrete segments — typically 2 to 10 seconds long — and delivers them over standard HTTP. This design choice has several major advantages:
- Works through firewalls and proxies that already allow HTTP traffic
- Compatible with standard CDN infrastructure
- Highly scalable to large audiences
- Naturally supports seeking by requesting specific segment files
Key Components of an HLS Stream
1. The Master Playlist (M3U8)
An HLS stream begins with a master playlist file (ending in .m3u8). This plain-text file lists all available quality variants of the stream, each with a corresponding bandwidth and resolution specification. Clients download this file first to discover what renditions are available.
#EXTM3U
#EXT-X-STREAM-INF:BANDWIDTH=128000,CODECS="mp4a.40.2"
audio-low.m3u8
#EXT-X-STREAM-INF:BANDWIDTH=256000,CODECS="mp4a.40.2"
audio-high.m3u8
2. Media Playlists
Each variant has its own media playlist listing the actual segment files. These playlists are updated continuously for live streams and remain static for video-on-demand (VOD) content.
3. Segments (TS or fMP4)
The actual audio data lives in segment files. Historically these were MPEG-2 Transport Stream (.ts) files, but modern HLS implementations increasingly use Fragmented MP4 (fMP4), which also aligns with the MPEG-DASH standard and allows better seeking precision.
Adaptive Bitrate Streaming (ABR)
One of HLS's most powerful features is adaptive bitrate switching. The client — whether a browser, mobile app, or media player — continuously monitors download speeds and buffer health. If bandwidth drops, the client seamlessly switches to requesting segments from a lower-bitrate variant playlist. When bandwidth improves, it switches back up. The viewer experiences fewer interruptions at the cost of occasional brief quality dips.
Audio-Only HLS Streams
HLS supports audio-only streams natively. This is common in:
- Podcast delivery: Some modern podcast networks use HLS for adaptive-quality audio
- Internet radio: Live audio broadcasts benefit from HLS's live streaming support
- Music streaming: Platforms can serve multiple audio quality tiers
In audio-only HLS, segments typically contain AAC audio wrapped in ADTS or packed into fMP4 containers. The ADTS format is particularly convenient here because each frame contains its own sync header, making the stream resilient to partial packet loss.
Latency Considerations
Traditional HLS has relatively high latency — often 20 to 30 seconds — because of how segments are buffered. For live events where real-time interaction matters, this is problematic. The HLS specification has since introduced Low-Latency HLS (LL-HLS), which uses partial segments and push delivery to achieve latency of 2–5 seconds, making it competitive with traditional broadcast delay.
HLS vs MPEG-DASH
| Feature | HLS | MPEG-DASH |
|---|---|---|
| Origin | Apple | MPEG consortium |
| Manifest format | M3U8 (plain text) | MPD (XML) |
| Native iOS/Safari support | Yes | Limited |
| DRM support | FairPlay, Widevine | Widevine, PlayReady |
| Codec flexibility | Good | Excellent |
Getting Started with HLS
To create an HLS stream for audio, you typically need an encoder (such as FFmpeg), a server to host the segment files and playlists, and a media player that supports HLS. FFmpeg can package audio into HLS with a single command, generating the .m3u8 playlist and .ts segment files automatically.
HLS remains the most reliable and broadly supported streaming protocol for reaching audiences on Apple devices — and thanks to HLS.js and similar JavaScript libraries, it now works natively in modern browsers as well.