ExoPlayer 2.9 — What’s new
ExoPlayer 2.9 includes lots of new features, improvements and bug fixes. This post highlights some of the most significant changes. Please consult the full release notes for a comprehensive list.
Java 8
In ExoPlayer 2.9 we’ve upgraded to Java 8 in order to take advantage of new language features, like default method implementations in interfaces. As a result of this change you may need to add compileOptions { targetCompatibility JavaVersion.VERSION_1_8 }
in your app’s build.gradle when you upgrade.
Audio focus handling
The Android system coordinates audio playback across apps using audio focus. From ExoPlayer 2.9 you can choose to have ExoPlayer take care of audio focus handling, which means you no longer need to implement this in your app. See Easy audio focus with ExoPlayer for instructions and more details.
Simplified player setup with BandwidthMeter
If you’ve set up ExoPlayer for adaptive streaming you’ll be familiar with passing a BandwidthMeter to different player components. This was unnecessarily complicated and error-prone. The latest release brings simplifications to reduce the amount of code needed to set up the player. Simplified bandwidth meter usage describes the new API and related changes you’ll need to be aware of if you’ve implemented custom components.
Support for spherical (180°/360°) playback
As part of our ongoing efforts to support new video use cases, we’ve added support for “magic window” playback, which can be used to view spherical videos without a VR headset. Playing 360 degree videos with ExoPlayer has more details.
Load error handling policy customization
We’ve added a new interface that allows for customization of the load error handling policy applied by the standard media sources. You can use this to control how retrying and blacklisting of adaptive variants works. Please read Load error handling in ExoPlayer for more information.
Improved seeking in progressive streams
In ExoPlayer 2.9 we’ve added support for seeking in progressive MPEG TS and MPEG PS streams, which were unseekable in previous versions of the library. One limitation to be aware of is that the implementation relies on binary search to determine seek destinations, so may be inefficient when reading from remote data sources.
In addition, we’ve also added an option to enable seeking based on the assumption that the media is constant bitrate for MP3, ADTS and AMR containers. You can turn this on selectively for individual extractors in DefaultExtractorsFactory, or enable it for all applicable container types like this:
Other highlights
Other notable improvements include ExoPlayer.retry()
for retrying playback after encountering player errors, support for detecting HLS chunk types, and fixes for playback of gapless MP4s and ad tags with empty ad groups.
As always, please feel free to get in touch via our issue tracker if you have any questions or encounter problems. Thanks for reading!