Skip to main content

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 in application.properties or via REST API:

HLS Playlist Types

Adaptive Bitrate Configuration

Enable ABR in application.properties:
Master playlist structure:

Advanced Features

HLS Encryption (AES-128)

Source: HLSMuxer.java:144-169

Low 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:
Benefits of fMP4:
  • Better HEVC/H.265 support
  • Improved seeking
  • Smaller file sizes
  • Better for VOD

Troubleshooting

Playback Issues

CORS Errors:
Add to nginx/web server config:
404 Not Found:
Segments Not Loading:

Performance Optimization

Reduce Latency:
Optimize for CDN:
Memory Usage:

Best Practices

Production Recommendations

  1. Segment Duration: Use 6 seconds for standard HLS, 2-4 seconds for low latency
  2. Playlist Size: Keep 3-5 segments for live, unlimited for VOD
  3. Codec Settings: Use H.264 baseline/main profile for maximum compatibility
  4. HTTPS: Always serve HLS over HTTPS in production
  5. CDN: Use CDN for scalability (CloudFront, Cloudflare, Akamai)
  6. Monitoring: Track segment generation and player errors

API Reference

For complete HLS implementation details: