ExoPlayer 2.5 - What’s new
ExoPlayer 2.5 adds significant new functionality, including three new extensions. It also makes significant improvements to the core playback experience, and as always comes with a raft of miscellaneous improvements and bug fixes!
Extensions, extensions, extensions
IMA ads extension
ExoPlayer 2.5 includes a new IMA ads extension, which makes it easy to monetize your content using Google’s Interactive Media Ads SDK. You can read more about the IMA extension and how to use it here.
MediaSession extension
Secondly, we’ve added a MediaSession extension. This extension makes it easy to bind an ExoPlayer instance with a MediaSession. We intend to publish a blog post explaining how to use this extension in more detail soon!
RTMP extension
Last but not least, we’ve added an RTMP extension. This extension uses the LibRtmp client for Android to provide DataSource and DataSource.Factory implementations for the RTMP protocol. DefaultDataSource will automatically use the RTMP extension whenever it’s available (via reflection). Hence if your application is using DefaultDataSource or DefaultDataSourceFactory, adding support for RTMP streams is as simple as adding a dependency to the RTMP extension from your project! Special thanks to mekya, whose work on LibRtmp client for Android made this extension possible!
Improvements to core playback
Repeat modes
We’ve added the ability to set a repeat mode during playback. This replaces the need to use LoopingMediaSource in most scenarios, and is also more flexible as it can be turned on and off during playback. You can read more about this feature here.
Dynamic playlists
ConcatenatingMediaSource has long enabled sequential playback of multiple pieces of media. This went some way towards supporting playlist use cases. Unfortunately, since it did not support the ability to add, move and remove child media sources during playback, it did not naturally support use cases where playlists may be edited. ExoPlayer 2.5 sees the introduction of DynamicConcatenatingMediaSource, which does support adding, moving and removing child media source after construction. It even automatically handles the “awkward” cases, such as changing the position of the source that’s currently being played! We intend to publish a blog post explaining DynamicConcatenatingMediaSource in more detail soon.
Seamless track selections
Prior to the 2.5 release, enabling or switching between audio and text tracks would cause rebuffering during playback of progressive streams (i.e. regular media files) and most HLS streams. In ExoPlayer 2.5 this rebuffering has been eliminated, allowing audio and text track selections to be made in a seamless way.
Minimizing delays switching output surface
One issue that many developers encounter when using ExoPlayer is an unsightly delay in video output when switching playback from one surface to another. Avoiding this delay is difficult due to the way in which the underlying platform works. Nevertheless, thanks to a combination of a new platform API in Android Marshmallow and some OpenGL magic, we’ve been able to remove this delay when playing clear (non-protected) content on Android Marshmallow or later. The delay is also removed when playing protected content on devices that support the EGL_EXT_protected_content OpenGL extension.
Miscellaneous improvements
HLS EXT-X-INDEPENDENT-SEGMENTS tag support
The HLS specification does not require that segments begin with video key-frames. As a result, when switching from one variant to another, it’s traditionally been necessary to download overlapping segments from both variants to ensure that the switch can be performed in a seamless way. This is clearly inefficient when playing content in which every segment does begin with a video key-frame. The HLS specification recently added an EXT-X-INDEPENDENT-SEGMENTS tag that allows content providers to explicitly indicate to the client that segments are prepared in this way. In ExoPlayer 2.5 we’ve updated our HLS module to recognize this tag and avoid downloading overlapping segments when it’s present. A blog post describing use of this tag (and other ways in which you can prepare HLS content to be ideal for ExoPlayer) is coming soon!
DASH cross-adaptation-set switching
DASH IF Interoperability Points section 3.8 describes a way in which a DASH manifest can indicate support for seamless switching between different AdaptationSet elements. This makes it possible for a client to adapt between representations of the same content encoded with different codecs (e.g. H.264 and H.265). In ExoPlayer 2.5 we’ve updated our DASH module to support this functionality.
Bug fixes
As always the 2.5 release contains important bug fixes, including fixing an issue that would cause corruption during playback of H.262 MPEG-TS streams (#2891), fixing an overflow in FragmentedMp4Extractor that could result in dropped frames (#3139), fixing an IllegalStateException affecting some composite media playbacks (#2900), and many more.
As always, full release notes can be found here. If you encounter any issues, please head to our issue tracker and let us know!