ExoPlayer 2.6.1 - What’s new

Olly Woodman
AndroidX Media3
Published in
2 min readJan 4, 2018

This post outlines some of the improvements we’ve made in the 2.6.0 and 2.6.1 releases of ExoPlayer, including Factory classes for MediaSource implementation, a new shuffle mode, and a Leanback extension for TV applications. As always, these releases come with a raft of miscellaneous improvements and bug fixes. See the full release notes for details.

MediaSource factories

ExoPlayer 2.6.1 introduces factories for base MediaSource implementations provided by the library (ExtractorMediaSource, HlsMediaSource, SsMediaSource, DashMediaSource and SingleSampleMediaSource). These factories simplify MediaSource instantiation, particularly when an application wishes to configure one optional parameter whilst leaving others set to their default values. As an example, to instantiate a DashMediaSource with a custom manifest parser previously required the following code:

Using DashMediaSource.Factory, instantiation is now simplified to:

Going forward, these factories will allow us to add more optional parameters to base MediaSource implementations without having to further rely on the telescoping constructors anti-pattern.

Player.DefaultEventListener

Another small improvement that makes ExoPlayer easier to use is the addition of Player.DefaultEventListener in 2.6.0, which is a no-op implementation of Player.EventListener. Previously, application code interested in some (but not all) player events would typically look something like:

By extending Player.DefaultEventListener you need only override the methods you’re actually interested in, meaning the code above can be simplified to:

Shuffle mode

ExoPlayer now supports playlist shuffling as a built in feature! Shuffle mode can be enabled and disabled by calling setShuffleModeEnabled on the player. The current state can be queried by calling getShuffleModeEnabled.

Improved IMA extension

The 2.6.0 and 2.6.1 releases add multiple features to the IMA extension, including the ability to play HLS ads, access the AdsLoader and override the ad load timeout. We’ve also made stability improvements, so if you’re using the IMA extension we strongly recommend upgrading to 2.6.1.

Leanback extension

We’ve added a new Leanback extension to aid development of Android TV applications that wish to use standard Leanback UI components. The extension provides an implementation of Leanback’s PlayerAdapter class that wraps a SimpleExoPlayer instance.

Full release notes can be found here. If you encounter any issues, please head to our issue tracker and let us know!

--

--