ExoPlayer 2.16 — What’s new

Toni Heidenreich
AndroidX Media3
Published in
2 min readNov 19, 2021

ExoPlayer 2.16 is out and this post highlights some of the most significant changes. As always, we recommend also taking a look at the full release notes.

Android 12 compatibility

ExoPlayer 2.16 contains a variety of changes to ensure your app can target Android 12. Two changes are particularly important:

  • The new foreground service launch restrictions in Android 12 required us to adapt the DownloadService to stay in the foreground whilst waiting for requirements to be met. Apps using DownloadService should upgrade to ensure the service continues to work correctly on Android 12.
  • We’ve upgraded the WorkManager extension to depend on a version of WorkManager that’s compatible with Android 12. Apps using the WorkManager extension should also upgrade before targeting Android 12, as earlier versions of the WorkManager extension will throw an exception when used in apps targeting Android 12.

Simplified track selection

ExoPlayer now supports many track selection operations directly on the Player interface. In the past, you had to use the DefaultTrackSelector to change the selected tracks and query which tracks the player supports. This is no longer necessary, and you can instead perform these operations directly on a Player:

Preparing for AndroidX Media3

ExoPlayer will be moving to AndroidX Media3 in the future. See our What’s next for AndroidX Media and ExoPlayer video and blog post for more details.

To make this transition as seamless as possible, we’ve been busy adapting our API and code structure. You may have already noticed some new additions in past releases, like the generic Player interface, a simple way to define MediaItems, and support for playlists. This release contains simplified track selection functionality, as described above.

In addition, ExoPlayer 2.16 includes many deprecations and some code moves needed to clean our API surface for the AndroidX Media3 release. You’ll find equivalent replacements in the Javadoc of each deprecated method or class, and deleted and moved classes are listed in the release notes. One major deprecation is SimpleExoPlayer whose entire functionality has been moved to the ExoPlayer interface:

Please stay tuned for further updates regarding the move to AndroidX Media3. We are also planning to publish instructions on how to migrate your app from ExoPlayer to AndroidX Media3 soon.

As always, we recommend taking a look at the full release notes. Please feel free to get in touch via our issue tracker if you have any questions or encounter problems with the new release. Thanks for reading!

p.s., we’re hiring!

--

--