Google is committed to advancing racial equity for Black communities. See how.

Mediarouter

Enable media display and playback on remote receiver devices using a common user interface.
Latest Update Current Stable Release Next Release Candidate Beta Release Alpha Release
October 14, 2020 1.2.0 - - -

Declaring dependencies

To add a dependency on MediaRouter, 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:

dependencies {
    implementation "androidx.mediarouter:mediarouter:1.2.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.2.0

Version 1.2.0

October 14, 2020

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

Major Features Since 1.1.0

  • Support seamless media transfer that enables media transfer via System UI: See the What's new in Media video for more details
  • Changed the guidance on registering callback. See the example code in the Javadoc of MediaRouter.addCallback()
  • Add a new listener MediaRouter#OnPrepareTransferListener for receiving events when the selected route is about to be changed
  • Add MediaRouterParams to denote routing functionality and UI types.
  • Prevent tentative usages of internal use only methods with @RestrictTo(LIBRARY)

Version 1.2.0-rc02

October 1, 2020

androidx.mediarouter:mediarouter:1.2.0-rc02 is released. Version 1.2.0-rc02 contains these commits.

Bug Fixes

  • Fixed an issue that RouteController#onUnselect may not be called when the user stopped casting via System UI.

Version 1.2.0-rc01

September 16, 2020

androidx.mediarouter:mediarouter:1.2.0-rc01 is released. Version 1.2.0-rc01 contains these commits.

Bug Fixes

  • Fixed the disconnection of the current casting when Bluetooth audio device is connected.
  • Fixed throwing IllegalArgumentException in MediaRouteProvider#notifyDynamicRoutesChanged().
  • Make stop casting from the output switcher work

Version 1.2.0-beta01

September 2, 2020

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

New Features

  • Support seamless media transfer that enables media transfer via System UI: See the What's new in Media video for more details

API Changes

  • Make MediaRouter.OnPrepareTransferListener use ListenableFuture

Bug Fixes

  • Fix volume controls of group routes.
  • When a group route is created, creates a group route first and member routes later.
  • Make “Stop” in Output switcher work.
  • Fix callbacks that are not called expected
    • RouteController#onSelect when a routing session is created.
    • MediaRouter.Callback#onRouteSelected when transferring to phone from cast.
    • MediaRouter.Callback#onRouteSelected with the correct group route info.
  • Make the callbacks be removed

Version 1.2.0-alpha02

July 22, 2020

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

API Changes

  • Add a new MediaRouter.Callback#onRouteSelected to get notified when the selected route are different from the requested route (Ieee16)
  • Add a new listener MediaRouter#OnPrepareTransferListener for receiving events when the selected route is about to be changed (I6ace1)
  • Add MediaRouterParam (I33150)
  • Changed the guidance on registering callback. See the example code in the Javadoc of MediaRouter.addCallback() (I58112)

Version 1.2.0-alpha01

April 15, 2020

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

API Changes

  • Prevent tentative usages of internal use only methods with @RestrictTo(LIBRARY)

Bug Fixes

  • Resolved talkback on cast dialog issue
  • Guard DynamicGroupRouterController’s listener with a Lock

Version 1.1.0

Version 1.1.0

September 5, 2019

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

Import changes since 1.0.0

  • Dynamic group support
    • Allows users to add or remove route devices dynamically.
    • To enable a dynamic group, call MediaRouteButton.enableDynamicGroup(); the app shows a new dialog for the dynamic group
    • The installed MediaRouteProvider should also support dynamic group to actually enable the functionality.

Version 1.1.0-rc01

June 13, 2019

androidx.mediarouter:mediarouter: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.mediarouter:mediarouter:1.1.0-beta02 is released. The commits included in this version can be found here.

New features

  • Support RTL languages in MediaRouter dialogues

Bug fixes

  • Fix the bottom padding of MediaRoute dialogues

Version 1.1.0-beta01

May 7, 2019

androidx.mediarouter:mediarouter:1.1.0-alpha01 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.

API changes

  • Callback logic for DynamicRouteDescriptor was changed. Now MediaRouteProvider will call MediaRouterProvider.DynamicGroupController.notifyDynamicRoutesChanged instead of directly calling the callback method.

Version 1.1.0-alpha03

April 3, 2019

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

Bug fixes

  • Fixed crashes on MediaRouteVolumeSlider and RegisteredMediaRouteProvider.

Version 1.1.0-alpha02

March 13, 2019

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

New features

  • Support MediaRouteButton in Android Studio layout preview

API changes

  • Added enableDynamicGroup() method in MediaRouteActionProvider and MediaRouteButton to enable dynamic group feature
  • Added setAlwaysVisible(boolean) method in MediaRouteActionProvider and MediaRouteButton to allow MediaRouteButton visible always

Bug fixes

  • Made MediaRouteCastDialog rows easy to click
  • Removed unnecessary calls of onRouteChanged callback

Version 1.1.0-alpha01

December 3, 2018

New features

  • Added support dynamic group routes
    • Added APIs to support dynamic group routes by MediaRouteProviders
    • Added new UX for route chooser and controller dialogues for dynamic group routes