Media3 1.4.0 — what’s new?
Media3 1.4.0 is now released!
This release brings several exciting enhancements, including new preload utilities for playback with ExoPlayer
, improved HDR support in Transformer
, a revamped subtitle pipeline, out-of-the-box image support in PlayerView
, and more flexible error handling in MediaSession
.
We’ve also been busy fixing bugs and making various improvements throughout the library. For a complete list of changes, please refer to our release notes.
Preload media outside of ExoPlayer
Many applications, particularly those with short-form video feeds or highly interactive playback UIs, require multiple media items to be prepared for playback in advance. This allows playback to start almost instantly when a user swipes to a new item. Media3 ExoPlayer now supports preloading multiple media items to memory before adding them to the player, thanks to the new PreloadManager
.
With DefaultPreloadManager
, you can add media items that your user might play soon, obtain a pre-loaded MediaSource
for these items, and remove them when they’re no longer needed. As the user navigates between media items, you can use setCurrentPlayingIndex
and invalidate
to trigger preloading of items, automatically prioritizing those closer to the current item. You can also dynamically set the target preload status for each item (e.g., “load the first 5 seconds”) by implementing TargetPreloadStatusControl
. If DefaultPreloadManager
doesn’t perfectly suit your needs, you can extend BasePreloadManager
to create your own custom preload manager, allowing you to customize both prioritization and preloading strategies.
Currently, DefaultPreloadManager
requires many parameters that should be shared with ExoPlayer
. We’re working on simplifying this API so you won’t need to worry about this in the future.
Transformer improvements
HDR support for TextOverlay
Text overlaid on HDR content can sometimes appear dim or overly bright depending on the scene. To address this, Media3’s OverlaySettings
now has a new luminanceMultiplier
option for text overlays to adjust text brightness relative to the scene. This value is normalized so that 1 provides the default HDR luminance and 0.5 provides the default SDR luminance.
UltraHDR image support
The UltraHDR image format stores more light intensity information, resulting in more detailed highlights and shadows, and more intense colors. Transformer
now supports preserving this HDR information by converting UltraHDR images into HDR videos. Enable this by setting experimentalSetRetainHdrFromUltraHdrImage
to true when building the Composition
. If the sequence starts with HDR video assets, this feature is automatically enabled, defaulting to the colorspace of the first asset. This allows you to create compositions mixing HDR videos and images.
Media3 also now supports UltraHDR Bitmap overlays on HDR input content, preserving “that pop” in the picture! Transformer
will automatically decide whether to apply the gainmap based on the dynamic range of the background frame.
Revamped subtitle pipeline
ExoPlayer
now enables a new subtitles pipeline by default, which shifts most of the decoding work to an earlier stage. This provides support for more accurate subtitle clipping, resolves various issues with overlapping subtitles, and enables future optimizations to start playback faster when handling large subtitle files.
Images in PlayerView
Media3’s UI module now comes with out-of-the-box image support. If you add images to ExoPlayer as playlist items, they will be displayed in the UI as expected. The demo app contains an example for a playlist that mixes still images with video:
Simplified MediaSession error handling
Our Media3 MediaSession
integration has also been further improved. In 1.4.0, we’ve added easier ways to signal policy errors, for example, to inform Android Automotive if a premium account is required or if user authentication has expired. You can send non-fatal errors to controllers anytime using the new MediaSession.sendError
method. We also automatically propagate MediaBrowser
requests that fail with “authentication required” as an error, simplifying the typical login flow when users connect for the first time.
If you encounter any issues, have feature requests, or want to share feedback, please let us know using the Media3 issue tracker on GitHub. We look forward to hearing from you!