Low-latency live streaming with ExoPlayer

Toni Heidenreich
AndroidX Media3
Published in
3 min readFeb 9, 2021

Low-latency live streaming was identified as one of the biggest challenges for video developers in the Bitmovin Video Developer Report 2020. So you may be pleased to hear that, from version 2.13.0, ExoPlayer supports new low-latency live streaming protocols.

Low-latency live streaming is all about reducing the live offset, also known as glass-to-glass latency, which is the amount of time it takes a frame from the camera to the user screen. Low-latency live streaming is different from regular live streaming in that it allows players to start loading unfinished media segments instead of waiting until they become fully available.

Diagram showing segments in a live stream with a low-latency playback position in the yet unfinished segment at the live edge

The newly supported protocols are Low-Latency DASH (also known as ULL-CMAF) and Apple’s Low-Latency HLS extension including server control options like delta updates and blocking requests.

If you want to play low-latency streams in ExoPlayer, there is nothing you need to configure other than providing the manifest or playlist URL in the usual way:

player.setMediaItem(
MediaItem.fromUri(“https://example.com/manifest.mpd"));

Automatic live offset adjustments

During playback the player will automatically adjust the live offset by slightly changing the playback speed. This helps to ensure we can get to and keep a configured target live offset. The target live offset is taken from the manifest or playlist, or may be set by the app. The player will also take the current network conditions into account. For example in case of rebuffers, the target live offset will be increased. And if network conditions improve and the player is able to build a healthy buffer, the live offset will be decreased again as far as the available buffer safely allows.

For more details on how to adjust this behaviour in ExoPlayer, please have a look at our live streaming documentation page.

The player will also continue to measure bandwidth whenever possible to adapt between different resolutions during playback. Note that this isn’t always possible, for example when loading unfinished segments in DASH that aren’t available at full network speed yet. The player will still always be able to switch down when the network speed decreases because the playback will rebuffer and the live offset will increase allowing the player to obtain new bandwidth measurements. However if the live offset is already small, you may find that the player does not switch up quickly when the network speed improves.

Stream requirements

To ensure ExoPlayer can make full use of the low-latency functionality, your live stream needs to follow the relevant specifications.

For Low-Latency DASH, it’s important to include the availabilityTimeOffset in the manifest to indicate how much earlier segments are available. Ideally, the manifest should also define a ServiceDescription to describe the preferred live playback configuration.

For Low-Latency HLS, your server should support the new #EXT-X-SERVER-CONTROL features, most importantly blocking playlist reloads. The unfinished segment needs to be split into individual parts and published with #EXT-X-PART tags, ideally also including #EXT-X-PRELOAD_HINT to indicate the next part as soon as possible.

Please give our new low-latency functionality a try and if you have any questions, feature requests or want to report a bug, please file an issue on our GitHub issue tracker.

--

--