Media

Share media contents and controls with other apps. Superseded by media2.
Latest Update Stable Release Release Candidate Beta Release Alpha Release
November 29, 2023 1.7.0 - - -

Declaring dependencies

To add a dependency on Media, you must add the Google Maven repository to your project. Read Google's Maven repository for more information.

Add the dependencies for the artifacts you need in the build.gradle file for your app or module:

Groovy

dependencies {
    implementation "androidx.media:media:1.7.0"
}

Kotlin

dependencies {
    implementation("androidx.media:media:1.7.0")
}

For more information about dependencies, see Add build dependencies.

Feedback

Your feedback helps make Jetpack better. Let us know if you discover new issues or have ideas for improving this library. Please take a look at the existing issues in this library before you create a new one. You can add your vote to an existing issue by clicking the star button.

Create a new issue

See the Issue Tracker documentation for more information.

Version 1.7

Version 1.7.0

November 29, 2023

androidx.media:media:1.7.0 is released. Version 1.7.0 contains these commits.

Important changes since 1.6.0

  • Catch ForegroundServiceStartNotAllowedException in MediaButtonReceiver and forward it to onForegroundServiceStartNotAllowedException. (I0c939)
  • Add BROWSER_SERVICE_EXTRAS_KEY_FAVORITES_MEDIA_ITEM for passing Favorites media item in MediaBrowserCompat root extras. (Id3a11)
  • Add extras to set browse custom actions in MediaBrowserCompat root extras and MediaItem descriptions. (Iab163)
  • Fix IllegalStateException caused by returning null from MediaBrowserService.onLoadChildren on older Android versions.

Version 1.7.0-rc01

November 15, 2023

androidx.media:media:1.7.0-rc01 is released with no changes. Version 1.7.0-rc01 contains these commits.

Version 1.7.0-beta01

November 1, 2023

androidx.media:media:1.7.0-beta01 is released. Version 1.7.0-beta01 contains these commits.

Bug Fixes

  • Fix potential memory leak of MediaBrowserService and MediaBrowserServiceCompat. b/37137738.
  • Fix IllegalStateException caused by returning null from MediaBrowserService.onLoadChildren on older Android versions.

Version 1.7.0-alpha01

February 8, 2023

androidx.media:media:1.7.0-alpha01 is released. Version 1.7.0-alpha01 contains these commits.

New Features

  • Catch ForegroundServiceStartNotAllowedException in MediaButtonReceiver and forward it to onForegroundServiceStartNotAllowedException. (I0c939)
  • Add BROWSER_SERVICE_EXTRAS_KEY_FAVORITES_MEDIA_ITEM for passing Favorites media item in MediaBrowserCompat root extras. (Id3a11)
  • Add extras to set browse custom actions in MediaBrowserCompat root extras and MediaItem descriptions. (Iab163)

Version 1.6.0

Version 1.6.0

April 20, 2022

androidx.media:media:1.6.0 is released. Version 1.6.0 contains these commits.

Important changes since 1.5.0

  • Add extras necessary to set up signIn/Settings page using CarAppLibrary on a media app for Android Auto.

Version 1.6.0-rc01

April 6, 2022

androidx.media:media:1.6.0-rc01 is released. Version 1.6.0-rc01 contains these commits.

Version 1.6.0-beta01

March 23, 2022

androidx.media:media:1.6.0-beta01 is released. Version 1.6.0-beta01 contains these commits.

  • No changes since the last alpha release.

Version 1.6.0-alpha01

February 23, 2022

androidx.media:media:1.6.0-alpha01 is released. Version 1.6.0-alpha01 contains these commits.

API Changes

  • Add extras necessary to set up signIn/Settings page using CarAppLibrary on a media app for Android Auto. (Ifb3ca)

Version 1.5

Version 1.5.0

February 9, 2022

androidx.media:media:1.5.0 is released. Version 1.5.0 contains these commits.

Important changes since 1.4.0

  • Add isVolumeFixed to AudioManagerCompat
  • Add MediaConstants for single item styling and completion percentage.
  • For API level 30 or higher, the library won't inject the package visibility filter for MediaBrowserCompat. You need to specify a <queries> element in your apps manifest.
  • Fix the unexpected change of extras of getMediaDescription() on API 21
  • Prevent some IllegalStateException on API 19.
  • Fix a crash in MediaSessionCompat when targeting Android 12
  • Fix a crash in NotificationCompat on KitKat

Version 1.5.0-rc01

January 26, 2022

androidx.media:media:1.5.0-rc01 is released with no changes since 1.5.0-beta01. Version 1.5.0-rc01 contains these commits.

Version 1.5.0-beta01

December 1, 2021

androidx.media:media:1.5.0-beta01 is released with no changes since 1.5.0-alpha01. Version 1.5.0-beta01 contains these commits.

Version 1.5.0-alpha01

November 3, 2021

androidx.media:media:1.5.0-alpha01 is released. Version 1.5.0-alpha01 contains these commits.

New Features

  • Update dependency on core for media to 1.6.0

API Changes

  • Add isVolumeFixed to AudioManagerCompat
  • Add MediaConstants for single item styling and completion percentage.

Bug Fixes

  • For API level 30 or higher, the library won't inject the package visibility filter for MediaBrowserCompat. You need to specify a <queries> element in your apps manifest.
  • Fix the unexpected change of extras of getMediaDescription() on API 21
  • Fix inefficient use of ArrayList by setting default size.
  • Prevent some IllegalStateException on API 19.
  • Fix a crash in MediaSessionCompat when targeting Android 12
  • Fix a crash in NotificationCompat on KitKat

Version 1.4

Version 1.4.3

October 13, 2021

androidx.media:media:1.4.3 is released. Version 1.4.3 contains these commits.

Bug Fixes

  • The library won't inject the package visibility filter for MediaBrowserCompat anymore. Please specify a <queries> element in your apps manifest when targeting API level 30 or higher. (I0a964, b/185314633)

Version 1.4.2

September 15, 2021

androidx.media:media:1.4.2 is released. Version 1.4.2 contains these commits.

Bug Fixes

  • Fix side-effect of getMediaDescription() on API 21 (I5c05f)

Version 1.4.1

August 4, 2021

androidx.media:media:1.4.1 is released. Version 1.4.1 contains these commits.

Bug Fixes

  • Fix mutability flag for creating PendingIntent to prevent crash when targeting Android S.
  • Fix ClassVerificationFailure for NotificationCompat.MediaStyle.

Version 1.4.0

July 21, 2021

androidx.media:media:1.4.0 is released. Version 1.4.0 contains these commits.

Important changes since 1.3.0

  • Added a new bundle key METADATA_KEY_SERIES_CONTENT_ID used for the TV series's media content ID in MediaMetadataCompat
  • Added a new bundle key METADATA_KEY_NEXT_EPISODE_CONTENT_ID used for the TV episode’s next episode content ID in MediaMetadataCompat
  • Deprecate MediaControllerCompat.TransportControls#EXTRA_LEGACY_STREAM_TYPE and add MediaConstants#TRANSPORT_CONTROLS_EXTRAS_KEY_LEGACY_STREAM_TYPE instead
  • Add an extra key to shuffle media for playFromUri
  • Add @Nullable annotation to Result class
  • Fix missing EXTRA_KEY_EVENT of intent for MediaButtonReceiver

Version 1.4.0-rc01

June 30, 2021

androidx.media:media:1.4.0-rc01 is released with no changes since 1.4.0-beta01. Version 1.4.0-rc01 contains these commits.

Version 1.4.0-beta01

June 17, 2021

androidx.media:media:1.4.0-beta01 is released. Version 1.4.0-beta01 contains these commits.

API Changes

  • Added a new bundle key METADATA_KEY_SERIES_CONTENT_ID used for the TV series's media content ID in MediaMetadataCompat

  • Added a new bundle key METADATA_KEY_NEXT_EPISODE_CONTENT_ID used for the TV episode’s next episode content ID in MediaMetadataCompat

Version 1.4.0-alpha01

May 5, 2021

androidx.media:media:1.4.0-alpha01 is released. Version 1.4.0-alpha01 contains these commits.

API Changes

  • Deprecate MediaControllerCompat.TransportControls#EXTRA_LEGACY_STREAM_TYPE and add MediaConstants#TRANSPORT_CONTROLS_EXTRAS_KEY_LEGACY_STREAM_TYPE instead (I62f17)
  • Add an extra key to shuffle media for playFromUri (Ibc63c)
  • Add @Nullable annotation to Result class (I2d617)

Bug Fixes

  • Fix missing EXTRA_KEY_EVENT of intent for MediaButtonReceiver (If7557)

Version 1.3.1

Version 1.3.1

May 5, 2021

androidx.media:media:1.3.1 is released. Version 1.3.1 contains these commits.

Bug Fixes

  • Fix missing EXTRA_KEY_EVENT of intent for MediaButtonReceiver (If7557)

Version 1.3.0

Version 1.3.0

April 7, 2021

androidx.media:media:1.3.0 is released. Version 1.3.0 contains these commits.

Major changes since 1.2.0

  • Migrated Android Auto extras into MediaConstants.

Version 1.3.0-rc02

March 24, 2021

androidx.media:media:1.3.0-rc02 is released. Version 1.3.0-rc02 contains these commits.

Bug Fixes

  • Set FLAG_IMMUTABLE to the PendingIntent of MediaButtonReceiver which is required for apps targeting Android 12.
  • Fixed a NullPointerException in MediaSessionCompat with API 27 after setCallback(null).

Version 1.3.0-rc01

March 10, 2021

androidx.media:media:1.3.0-rc01 is released. Version 1.3.0-rc01 contains these commits.

No changes since 1.3.0-beta01.

Version 1.3.0-beta01

February 10, 2021

androidx.media:media:1.3.0-beta01 is released. Version 1.3.0-beta01 contains these commits.

API Changes

  • Added a new constant PlaybackStateCompat.ACTION_SET_PLAYBACK_SPEED (I9d076)
  • Migrate Android Auto extras into MediaConstants. (I290ab)
  • Add constants for constraining root children of MediaBrowserService. (Ifcebd)

Bug Fixes

  • Add FLAG_RECEIVER_FOREGROUND for media button pending intent.

Version 1.2.1

Media Version 1.2.1

December 2, 2020

androidx.media:media:1.2.1 is released. Version 1.2.1 contains these commits.

Bug Fixes

  • Fix NPE after calling MediaSessionCompat#setCallback(null) in API 27

Version 1.2.0

Version 1.2.0

September 16, 2020

androidx.media:media:1.2.0 is released. Version 1.2.0 contains these commits.

Major changes since 1.1.0

  • Added support for AudioAttributesCompat#setLegacyStreamType for SDK < 21
  • Support volume control for the androidx.mediarouter library
  • Better support of interoperability between androidx.media and androidx.media2

Version 1.2.0-rc01

September 2, 2020

androidx.media:media:1.2.0-rc01 is released with no changes since 1.2.0-beta01. Version 1.2.0-rc01 contains these commits.

Version 1.2.0-beta01

August 19, 2020

androidx.media:media:1.2.0-beta01 is released. Version 1.2.0-beta01 contains these commits.

New Features

  • Added support for AudioAttributesCompat#setLegacyStreamType for API Leves Pre-21

API Changes

  • Added MediaConstants#PLAYBACK_STATE_EXTRAS_KEY_MEDIA_ID for the media id in PlaybackStateCompat extras, which is expected to be same as MediaMetadataCompat#METADATA_KEY_MEDIA_ID of the current metadata.

Bug Fixes

  • Fixed an issue with AudioAttributesCompat.Builder#setContentType

Version 1.2.0-alpha04

June 24, 2020

androidx.media:media:1.2.0-alpha04 is released. Version 1.2.0-alpha04 contains these commits.

New Features

  • Provided a way to support volume control for mediarouter library

API Changes

  • Added AudioManagerCompat#getStreamMaxVolume
  • Added AudioManagerCompat#getStreamMinVolume

Bug Fixes

  • Fixed an interoperability issue between media and media2 on SDK < 21

Version 1.2.0-alpha03

June 10, 2020

androidx.media:media:1.2.0-alpha03 is released. Version 1.2.0-alpha03 contains these commits.

API Changes

  • MediaConstants.SESSION_EXTRAS_KEY_AUTHTOKEN has been removed

Bug Fixes

  • Fixed an issue with equals() of RemoteUserInfo

Version 1.2.0-alpha02

April 15, 2020

androidx.media:media:1.2.0-alpha02 is released. Version 1.2.0-alpha02 contains these commits.

Bug Fixes

  • Prevent modifications of VersionedParcelable classes

Version 1.2.0-alpha01

October 23, 2019

androidx.media:media:1.2.0-alpha01 is released. Version 1.2.0-alpha01 contains these commits.

API changes

  • Added the following methods:
    • MediaSessionCompat.Callback.onSetPlaybackSpeed()
    • MediaControllerCompat.setPlaybackSpeed()
    • MediaControllerCompat.getSessionInfo()

Bug fixes

  • Implemented prevention against a BadParcelableException when passing a Bundle object via an IPC call
  • The constructor of MediaControllerCompat no longer throws a RemoteException
  • Implemented prevention against the calling of callback methods after MediaSessionCompat.release()

Version 1.1.0

Version 1.1.0

September 5, 2019

androidx.media:media:1.1.0 is released. The commits included in this version can be found here.

Import changes since 1.0.0

  • Introduced AudioAttributesCompat

Version 1.1.0-rc01

June 13, 2019

androidx.media:media:1.1.0-rc01 is released with no changes from 1.1.0-beta02. The commits included in this version can be found here.

Version 1.1.0-beta02

June 5, 2019

androidx.media:media:1.1.0-beta02 is released. The commits included in this version can be found here.

Bug fixes

  • The restriction scope of hidden methods that are used by media2-session has been relaxed to LIBRARY_GROUP_PREFIX.

Version 1.1.0-beta01

May 7, 2019

androidx.media:media:1.1.0-beta01 is released. The commits included in this version can be found here.

New features

  • Changed IllegalPointerException to NullPointerException for the null arguments which marked as @NonNull.

Version 1.1.0-alpha04

April 3, 2019

androidx.media:media:1.1.0-alpha04 is released. The commits included in this version can be found here.

Bug fixes

  • Tweak on a version-compat-test constant (aosp/933656)

Version 1.1.0-alpha03

March 21st, 2019

androidx.media:media:1.1.0-alpha03 is released. The full list of commits included in this version can be found here.

Bug fixes

  • Fixed crash of MedaBrowserServiceCompat when multiple MediaBrowserCompat try to connect to it. (aosp/930246)

Version 1.1.0-alpha02

March 13, 2019

androidx.media:media:1.1.0-alpha02 is released. The full list of commits included in this version can be found here.

Bug fixes

  • Fixed crash of MediaBrowserCompat while connecting
  • Fixed IllegalStateException happened in getCurrentBrowserInfo()/getBrowserRootHints()
  • Make MediaBrowserServiceCompat.getCurrentBrowserInfo() return the same RemoteUserInfo instance for the same MediaBrowserCompat in onGetRoot()

Version 1.0.1

Version 1.0.1

January 30, 2019

androidx.media:media 1.0.1 is released.

Bug fixes

  • Fixed bug of an unexpected IllegalStateException while using MediaBrowserCompat.connect() (aosp/858075)

Version 1.0.0

Version 1.0.0-alpha06

December 17, 2018

API changes

Renamed the media.widget package and class names as follows:

  • androidx.media.widget.VideoView2androidx.media2.widget.VideoView
  • androidx.media.widget.MediaControlView2androidx.media2.widget.MediaControlView

Version 1.0.0-alpha01

December 3, 2018

API changes

  • Deprecated two MediaSessionCompat flags:
    • FLAG_HANDLES_MEDIA_BUTTONS
    • FLAG_HANDLES_TRANSPORT_CONTROLS