Media3 1.2.0 — What’s new?

Ian Baker
AndroidX Media3
Published in
4 min readNov 21, 2023

Media3 1.2.0 is now available! This post highlights some of the most significant changes to our Editing libraries, the media3-session module, and ExoPlayer. As always, we recommend also taking a look at the full release notes.

This is the first androidx.media3 release without a corresponding com.google.android.exoplayer2 release — the exoplayer2 package is deprecated, and Media3 contains the same ExoPlayer functionality and more. Apps wanting to migrate from the exoplayer2 package name should upgrade to ExoPlayer 2.19.1 and then follow the instructions to migrate to Media3 1.1.1, before then upgrading to Media3 1.2.0.

Updates in Media3 Editing APIs

Back in 2021, we introduced the first version of Transformer with support for basic transmuxing operations. With the Media3 1.2.0 release, we’re continuing to expand media editing functionality. The latest release supports transcoding, single asset editing and concatenation of multiple media files.

Transformer is the main entry point for Editing APIs in Media3. In addition, there is a separate effect module which provides functionality for applying effects to video frames and a muxer module for producing media container files. Media3 supports a range of content creation use cases with seamless integration between Transformer and ExoPlayer. Apps can pass a Composition to Transformer, which is a structure that holds a set of MediaItem instances and effects to apply to each item.

For more information about Media3 Editing APIs, check our documentation to learn how to get started and the demo app.

MediaSession simplifications

We made setting up a MediaSession with Media3 even simpler. Based on your feedback on GitHub, we

New ExoPlayer features

We were also busy improving ExoPlayer with CMCD, MIDI support, audio offload, better testing utilities and Wear OS helpers.

Common Media Client Data (CMCD)

Common Media Client Data (CMCD) is a specification created by the Consumer Technology Association (CTA) to allow media players (clients) to send rich information about their current state to the servers providing the media. These servers are often part of Content Delivery Networks (CDNs). This additional information can be used by CDNs for a range of purposes, for example to optimize segment prefetching during playback, or to allow deeper insights during later analysis and troubleshooting. ExoPlayer added initial CMCD support in the 1.1.0 release. The 1.2.0 release extends this to support a wider range of data keys, as well as allowing the info to be optionally sent in an HTTP query parameter instead of an HTTP request header.

Diagram showing a device running ExoPlayer making an HTTP GET request for ‘/segment1.m4s’ to a CDN Edge server and including a CMCD-Object HTTP request header with value ‘br=3200,d=4004,ot=v,tb=6000’.

CMCD integration defaults to off, to protect privacy and information leakage. The opt-in API allows apps to customize their integration:

  • Easily enable sending all available keys with a single method call.
  • Customize data transmission by specifying filter list, request method, SessionID, ContentID, Requested Throughput (RTP), and custom keys.

Please see the developer documentation for more information.

MIDI extension

In this release, we have published the first version of the ExoPlayer MIDI extension, meaning it’s now possible to play MIDI content using logic you bundle into your app, without needing to rely on the behavior of Android platform MIDI APIs.

Audio Offload support

ExoPlayer has supported offloading audio playback as an experimental feature since 2020, resulting in low-power playback by allowing the device’s main processor to sleep while compressed audio is decoded by a dedicated processor. The 1.2.0 release moved the feature out of its experimental stage with a new, cleaned-up track selection APIs to indicate when offload playback should be used.

We also extended offload support to include gapless Opus content, so seamless low-power, audio-only playback is now available for even more content.

Realistic Espresso and Compose tests

Media3 includes testing utilities to assist apps that want to interact with a realistic ExoPlayer implementation in a Robolectric test environment. Apps can create an instance using TestExoPlayerBuilder and then use TestPlayerRunHelper to advance the Robolectric looper until various player events trigger. The 1.2.0 release improves these utilities to ensure they also work correctly when used in Espresso and Compose UI tests. We use these utilities throughout Media3’s own tests, so there’s plenty of examples to see how you can integrate them into your own app’s tests.

Improved Wear OS support

The 1.2.0 release adds some helpful ExoPlayer functionality for apps that target Wear OS devices, where media apps are recommended to avoid playing audio from the watch’s built-in speaker. Apps using ExoPlayer can now implement this recommendation by enabling playback suppression on ‘unsuitable’ output devices, and wiring up a Media3-provided listener which prompts the user to connect a device by showing an Output Switcher or Bluetooth settings UI when playback is suppressed. For more detail (including code snippets), see the full instructions.

If you run into any issues, have any feature requests, or would like to share any other sort of feedback, please let us know using the Media3 issue tracker on GitHub. We look forward to hearing from you!

--

--