Overview
HLS (HTTP Live Streaming) is Apple’s adaptive bitrate streaming protocol that delivers video over HTTP. It’s widely supported across browsers, mobile devices, and smart TVs, making it the de facto standard for VOD and live streaming.Key Benefits
- Universal compatibility: Works on iOS, Android, browsers, smart TVs
- Adaptive bitrate: Automatically adjusts quality based on bandwidth
- HTTP-based: Uses standard web servers, CDN-friendly
- Scalable: Easily distributed via CDNs
- DRM support: FairPlay Streaming, AES encryption
- Codec support: H.264, H.265/HEVC, AAC, AC3, MP3
Publishing for HLS
Ant Media Server automatically converts incoming streams to HLS. Publish using any supported protocol:Playing HLS Streams
Browser Players
Mobile Players
Desktop/CLI Players
Configuration Options
Server-Side Configuration
Configure HLS settings inapplication.properties or via REST API:
HLS Playlist Types
Adaptive Bitrate Configuration
Enable ABR inapplication.properties:
Advanced Features
HLS Encryption (AES-128)
Source: HLSMuxer.java:144-169Low Latency HLS (LL-HLS)
LL-HLS support requires Enterprise Edition. It reduces latency to 2-3 seconds.
HLS with fMP4 Segments
Use fragmented MP4 instead of MPEG-TS:- Better HEVC/H.265 support
- Improved seeking
- Smaller file sizes
- Better for VOD
Troubleshooting
Playback Issues
CORS Errors:Performance Optimization
Reduce Latency:Best Practices
Production Recommendations
- Segment Duration: Use 6 seconds for standard HLS, 2-4 seconds for low latency
- Playlist Size: Keep 3-5 segments for live, unlimited for VOD
- Codec Settings: Use H.264 baseline/main profile for maximum compatibility
- HTTPS: Always serve HLS over HTTPS in production
- CDN: Use CDN for scalability (CloudFront, Cloudflare, Akamai)
- Monitoring: Track segment generation and player errors
Recommended Settings by Use Case
API Reference
For complete HLS implementation details:- HLSMuxer.java - HLS muxer implementation
- Muxer.java - Base muxer class
- MuxAdaptor.java - Stream adaptation logic
