HTTP Live Streaming (HLS) is a modern streaming protocol designed to improve playback stability for listeners on mobile devices and Wi-Fi networks. In addition to traditional Icecast/SHOUTcast-style HTTP streaming, RSAS can convert and serve your stream as HLS, providing broadcasters with an easy upgrade path to adopt HLS audio streaming.
The main advantage of HLS audio streaming is that it provides a mechanism for players to seamlessly reconnect and download missed audio, so that a short loss of connectivity or bandwidth will not disrupt playback. A second key advantage is that by downloading audio in short bursts, HLS reduces power consumption and improves battery life on mobile devices by allowing cellular and Wi-Fi modems to sleep for more time during playback.
A limitation of HLS is that has increased latency during playback, which is mandated by the protocol specification. The exact latency will depend on the player, but is typically about 15-30 seconds.
HLS streaming with RSAS works with your existing MP3 or AAC encoder and is compatible with most of the major features in RSAS, including access logging, listener counts, and listener authentication. See Feature Compatibility below for more information.
HLS support is available for MP3 and AAC streams only.
To enable HLS in RSAS:
Set the <hostname>
in your RSAS configuration.
Enable HLS globally (all mounts) or on individual mounts, following the example below:
<icecast>
<hostname>streams.example.com</hostname>
<hls>
<!-- Enable HLS for all MP3 and AAC mounts -->
<enabled>1</enabled>
</hls>
<mount>
<mount-name>/mount</mount-name>
<username>source</username>
<password>hackme</password>
<hls>1</hls> <!-- Enable HLS for an individual mount -->
</mount>
</icecast>
After enabling HLS, you will be able to listen to your stream in HLS at http://hostname/mount/hls.m3u8
.
HLS-enabled streams will be playable in an HLS-compatible player using the URL /mount/hls.m3u8
.
HLS playback is tested with the following players:
Note that desktop Chrome, Edge, and Firefox do not natively play HLS, but their mobile equivalents do.
Feature | Supported with HLS | Notes |
---|---|---|
Codec Compatibility | MP3 and AAC | Works with existing Icecast-compatible encoders. |
Access Logging | ✅ Yes | Pseudo-sessions for Icecast log compatibility, playlist log, and segment files. |
Relaying | ✅ Yes | Can convert traditional relays into HLS or relay an existing HLS stream from another RSAS server. See HLS Relay below. |
Fallbacks | ❌ No | HLS provides a mechanism for client-side fallbacks, which should be used instead. |
Listener Authentication Webhook | ✅ Yes | |
Listener Removal Webhook | ✅ Yes | |
Preroll and Postroll ad insertion | ❌ No | Planned for a future release. |
Midroll ad insertion | ❌ No | Planned for a future release. |
RSAS supports two different modes of operation for HLS on relays.
In Segmentation Mode, RSAS relays a traditional HTTP stream and then converts it to HLS.
If a relayed stream is available in HLS on an upstream RSAS instance, then HLS Relay Mode will allow RSAS to mirror and cache the HLS playlist and segments from the upstream server. This mode is desirable when load balancing between multiple servers, so that each server presents the same consistent view of the HLS segments and playlist. (In this mode, RSAS essentially operates as a reverse caching proxy for HLS.) HLS Relay Mode is only compatible with upstream RSAS instances.
To summarize:
To configure HLS relay, see the example below:
<icecast>
<hostname>streams.example.com</hostname>
<mount>
<mount-name>/relay</mount-name>
<hls>1</hls>
</mount>
<relay>
<url>https://example.com/disco</url>
<local-mount>/relay</local-mount>
</relay>
</icecast>
<icecast>
<hostname>streams.example.com</hostname>
<mount>
<mount-name>/relay</mount-name>
</mount>
<relay>
<url>https://example.com/disco</url>
<local-mount>/relay</local-mount>
<hls-relay>1</hls-relay>
</relay>
</icecast>
For compatibility with existing log analysers that are used to generate listener statistics, RSAS logs HLS listener sessions
to the access.log
as if they were regular HTTP listener sessions. These pseudo-sessions are logged in addition to the
real HTTP requests by HLS listeners, which are the M3U8 playlist and segment files.
RSAS does not implement support for adaptive bitrate HLS streaming, as there is no practical benefit to doing so at the low bitrates that AAC/MP3 streams use.