Mediarouter
Latest Update | Stable Release | Release Candidate | Beta Release | Alpha Release |
---|---|---|---|---|
December 11, 2024 | 1.7.0 | - | - | 1.8.0-alpha01 |
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:
Groovy
dependencies { implementation "androidx.mediarouter:mediarouter:1.7.0" }
Kotlin
dependencies { implementation("androidx.mediarouter:mediarouter: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.
See the Issue Tracker documentation for more information.
Version 1.8
Version 1.8.0-alpha01
December 11, 2024
androidx.mediarouter:mediarouter:1.8.0-alpha01
and androidx.mediarouter:mediarouter-testing:1.8.0-alpha01
are released. Version 1.8.0-alpha01 contains these commits.
API Changes
- Add new API to support connecting (and disconnecting) to routes without affecting the route selection. (I64a8e).
- Add new API that allows providers to take parameters when creating a controller. (I703b9).
- Add new API for listening for changes in the list of bound
MediaRouteProviderService
clients. (I69996)
Bug Fixes
- Mitigate issue causing playback to be incorrectly routed to the built-in speakers while a Bluetooth device is connected.
- Removed manual outlining of access to new platform APIs since this happens automatically via API modeling when using R8 with AGP 7.3 or later (e.g. R8 version 3.3) and for all builds when using AGP 8.1 or later (e.g. D8 version 8.1). Clients who are not using AGP are advised to update to D8 version 8.1 or later. See this article for more details. (If6b4c, b/345472586)
- Fix Output Switcher invocation in certain
WearOs
scenarios (Iab44a). - Fix some translations for the
MediaRouteChooserDialog
. (26da14).
Version 1.7
Version 1.7.0
March 20, 2024
androidx.mediarouter:mediarouter:1.7.0
and androidx.mediarouter:mediarouter-testing:1.7.0
are released. Version 1.7.0 contains these commits.
API Changes
- Add
isSystemRoute()
toMediaRouteDescriptor
andRouteInfo
which returns true if the corresponding route is a system-managed route, which means that the system is the route provider and the app is in charge of feeding media samples to the system for their rendering (I949e4). Bluetooth headsets, wired headsets and built-in speakers are examples of system routes. - Deprecate
MediaRouter.removeRemoteControlClient
. You should callsetMediaSessionCompat(MediaSessionCompat)
instead ofaddRemoteControlClient(Object)
so that there is no need to callremoveRemoteControlClient(Object)
. (I8fc5e). - Make
MediaRouteButton
extendAppCompatImageView
. (Ib455e). - Add
DEVICE_TYPE_SMARTPHONE
, which indicates that a media route is a smartphone. (I39837). - Improve device type mappings from
MediaRouter2
to AndroidXMediaRouter
to describe system routes (for example: Bluetooth, HDMI, wired). (Iccffa)
Bug Fixes
- Add missing icon resolutions for the route button that was possibly causing some isolated crashes. (cddba9, b/261878418).
- Fix bug causing
isSystemRoute
to return true for user routes added viaandroid.media.MediaRouter#addUserRoute()
(a27f6b).
New Features
- Bump the minSdk to 19. (e8c4463)
Version 1.7.0-rc01
March 6, 2024
androidx.mediarouter:mediarouter:1.7.0-rc01
and androidx.mediarouter:mediarouter-testing:1.7.0-rc01
are released. Version 1.7.0-rc01 contains these commits.
Version 1.7.0-beta01
February 21, 2024
androidx.mediarouter:mediarouter:1.7.0-beta01
and androidx.mediarouter:mediarouter-testing:1.7.0-beta01
are released. Version 1.7.0-beta01 contains these commits.
Version 1.7.0-alpha02
February 7, 2024
androidx.mediarouter:mediarouter:1.7.0-alpha02
and androidx.mediarouter:mediarouter-testing:1.7.0-alpha02
are released. Version 1.7.0-alpha02 contains these commits.
New Features
- Bump the minSdk to 19. (e8c4463)
API Changes
- Improve device type mappings from
MediaRouter2
to AndroidXMediaRouter
to describe system routes (for example: Bluetooth, HDMI, wired). (Iccffa)
Bug Fixes
- Fix bug causing
isSystemRoute
to return true for user routes added viaandroid.media.MediaRouter#addUserRoute()
(a27f6b).
Version 1.7.0-alpha01
November 15, 2023
androidx.mediarouter:mediarouter:1.7.0-alpha01
and androidx.mediarouter:mediarouter-testing:1.7.0-alpha01
are released. Version 1.7.0-alpha01 contains these commits.
API Changes
- Add
isSystemRoute()
toMediaRouteDescriptor
andRouteInfo
which returns true if the corresponding route is a system-managed route, which means that the system is the route provider and the app is in charge of feeding media samples to the system for their rendering (I949e4). Bluetooth headsets, wired headsets and built-in speakers are examples of system routes. - Deprecate
MediaRouter.removeRemoteControlClient
. You should callsetMediaSessionCompat(MediaSessionCompat)
instead ofaddRemoteControlClient(Object)
so that there is no need to callremoveRemoteControlClient(Object)
. (I8fc5e). - Make
MediaRouteButton
extendAppCompatImageView
. (Ib455e). - Add
DEVICE_TYPE_SMARTPHONE
, which indicates that a media route is a smartphone. (I39837).
Bug Fixes
- Add missing icon resolutions for the route button that was possibly causing some isolated crashes. (cddba9, b/261878418).
Version 1.6
Version 1.6.0
September 20, 2023
androidx.mediarouter:mediarouter:1.6.0
and androidx.mediarouter:mediarouter-testing:1.6.0
are released. Version 1.6.0 contains these commits.
Major features since 1.4.0
- Route Listing preferences for output switcher
- Add route listing preference support to AndroidX MediaRouter.
- Add visibility support for MediaRouteDescriptor.
- Revamp the MediaRouteButton to provide a better user experience ((I9dbcb)[https://android-review.googlesource.com/#/q/I9dbcb8d9e5ee4902d48f1bfb4133e04781c6ae35)). Including:
- Add a hint to the user to check the searched device is on the same wifi.
- Add an end state with an error message to be shown at the end of a predefined period of time.
- Added automatic dismissal of the MediaRouter dialog when screen is turned off.
Version 1.6.0-rc01
August 23, 2023
androidx.mediarouter:mediarouter:1.6.0-rc01
and androidx.mediarouter:mediarouter-testing:1.6.0-rc01
are released. Version 1.6.0-rc01 contains these commits.
New Features
- Added automatic dismissal of the
MediaRouter
dialog when screen is turned off. (Ib25ee).
Bug Fixes
- Changed the
MediaRouter
logging tag toAxMediaRouter
to disambiguate from the platformMediaRouter
. (Ib619f).
Version 1.6.0-beta01
August 9, 2023
androidx.mediarouter:mediarouter:1.6.0-beta01
and androidx.mediarouter:mediarouter-testing:1.6.0-beta01
are released. Version 1.6.0-beta01 contains these commits.
API Changes
- Fix support for Android U platform APIs. (Ie9117, b/289269026)
Bug Fixes
- Fix translations in
MediaRouteChooserDialog
. (d39a7f)
Version 1.6.0-alpha05
June 21, 2023
androidx.mediarouter:mediarouter:1.6.0-alpha05
and androidx.mediarouter:mediarouter-testing:1.6.0-alpha05
are released. Version 1.6.0-alpha05 contains these commits.
New Features
- Improve the
MediaRouteChooserDialog
UI to handle the lack of discovered devices by providing written guidance to the user (I0cad9, I3d445).
Version 1.6.0-alpha04
June 7, 2023
androidx.mediarouter:mediarouter:1.6.0-alpha04
and androidx.mediarouter:mediarouter-testing:1.6.0-alpha04
are released. This version is developed in an internal branch.
New Features
- Revamp the
MediaRouteButton
to provide a better user experience (I9dbcb). Including:- Add a hint to the user to check the searched device is on the same wifi.
- Add an end state with an error message to be shown at the end of a predefined period of time.
API Changes
- Bring in new
MediaRouteDescriptor
device types from the platform. (I75ba6).
Bug Fixes
- Fixed volume adjustment on non-dynamic route controllers (I730ec).
- Make
MediaRouteButton
always enabled (I1e9ff). - Fix some android version runtime checks preventing Android U features from being accessible using the AndroidX media router library (I97cab).
Version 1.6.0-alpha03
April 12, 2023
androidx.mediarouter:mediarouter:1.6.0-alpha03
and androidx.mediarouter:mediarouter-testing:1.6.0-alpha03
are released. This was released from an internal branch.
- Make some changes around
MediaRouteDescriptor
’s visibility API. - Deprecate
MediaRouteActionProvider.setAlwaysVisible
andMediaRouteButton.setAlwaysVisible
, making the media route button always visible, regardless of the network connectivity, or the availability of media routes. - Fix volume adjustment for non-dynamic route controllers. This addresses a bug where trying to adjust the volume of a route in the output switcher would cause volume to go back to its original value (93f409).
Version 1.6.0-alpha02
March 8, 2023
androidx.mediarouter:mediarouter:1.6.0-alpha02
and androidx.mediarouter:mediarouter-testing:1.6.0-alpha02
are released. Developed on internal branch.
New Features
- Add route listing preference support to AndroidX
MediaRouter
. - Add visibility support for
MediaRouteDescriptor
.
Bug Fixes
- Improve SystemUI output switcher invocation on Android U+.
Version 1.6.0-alpha01
February 10, 2023
androidx.mediarouter:mediarouter:1.6.0-alpha01
is released. Version 1.6.0-alpha01 contains these commits.
New Features
- Route Listing preferences for output switcher
API Changes
- Mechanism for the app to configure the output switcher.
Version 1.4
Version 1.4.0
May 3, 2023
androidx.mediarouter:mediarouter:1.4.0
and androidx.mediarouter:mediarouter-testing:1.4.0
are released. Version 1.4.0 contains these commits.
Important changes since 1.3.1
- Add
SystemOutputSwitcherDialogController#showDialog
to show the system’s output switcher dialog, or the Bluetooth Settings Fragment on Wear devices where the system output switcher is not available. (Ic3d78) - Fix regression causing application crashes due
IllegalArgumentException
inMediaRouterProvider.notifyDynamicRoutesChanged
(7d17ea). - Add
MediaRouteDescriptor.Builder.clearControlFilters
(I3a4e1) - Add missing
MainThread
annotations inMediaRouter
. (I3ef6e) - Add broadcast receiver export flags on API 33+ (b2a663).
Version 1.4.0-rc01
April 5, 2023
androidx.mediarouter:mediarouter:1.4.0-rc01
and androidx.mediarouter:mediarouter-testing:1.4.0-rc01
are released. Version 1.4.0-rc01 contains these commits.
- Remove null lists in MediaRouteProviderDescriptor.
Version 1.4.0-beta02
February 22, 2023
androidx.mediarouter:mediarouter:1.4.0-beta02
is released. Version 1.4.0-beta02 contains these commits.
Bug Fixes
- Fix regression causing application crashes due
IllegalArgumentException
inMediaRouterProvider.notifyDynamicRoutesChanged
(7d17ea).
Version 1.4.0-beta01
January 25, 2023
androidx.mediarouter:mediarouter:1.4.0-beta01
is released. Version 1.4.0-beta01 contains these commits.
API Changes
DynamicGroupRouteController.notifyDynamicRoutesChanged()
now throws IllegalArgumentException
when no route passed is SELECTED or SELECTING. (8f6b3e)
Bug Fixes
- Fix crash caused by an api-compliant provider service implementation returning a null route provider. (63f16d)
- Make protected broadcast receivers work on apps targeting API 33+ by marking them as non-exported. (784f8b)
- Fix some spurious nullability annotations in
OverlayListView
. (472e3f) - Fix bug where
EXTRA_CLOSE_ON_CONNECT
inSystemOutputSwitcherDialogController.showDialog
would cause the bluetooth settings fragment to close suddenly on wear devices. (28c9d8) - Changed to Javadoc of Output Switcher’s public methods. (f0ae94, 44d2c9)
Version 1.4.0-alpha01
November 9, 2022
androidx.mediarouter:mediarouter:1.4.0-alpha01
is released. Version 1.4.0-alpha01 contains these commits.
New Features
- Add
SystemOutputSwitcherDialogController#showDialog
to show the system’s output switcher dialog, or the Bluetooth Settings Fragment on Wear devices where the system output switcher is not available. (Ic3d78)
API Changes
- Add
MediaRouteDescriptor.Builder.clearControlFilters
(I3a4e1) - Add missing
MainThread
annotations inMediaRouter
. (I3ef6e)
Bug Fixes
- Fix device-specific crash caused by calling
MediaRouter.removeUserRoute
(b/202931542). - Fix group descriptors not receiving volume handling updates consistently (461303).
- Add broadcast receiver export flags on API 33+ (b2a663).
- Fix crash caused by receiving invalid route descriptors from the platform (dd5c09).
Version 1.3
Version 1.3.1
July 27, 2022
androidx.mediarouter:mediarouter:1.3.1
is released. Version 1.3.1 contains these commits.
Bug Fixes
- Work around a device-specific issue where
MediaRouter.removeUserRoute()
would throw an unexpectedIllegalArgumentException
(b/202931542).
Version 1.3.0
April 20, 2022
androidx.mediarouter:mediarouter:1.3.0
is released. Version 1.3.0 contains these commits.
Important changes since 1.2.0
- Add a flag into
MediaRouterParams
that can be used to disable seamless transfer at runtime. - Added a testing artifact which can reset the
MediaRouter
. - Add a router param for UX tweak in
MediaRouterControllerDialog
. - Annotated nullness for public methods.
- API lint check for
MissingGetterMatchingBuilder
is enabled for androidx. - Update dependency on core for mediarouter to 1.6.0.
Version 1.3.0-rc01
March 23, 2022
androidx.mediarouter:mediarouter:1.3.0-rc01
is released. Version 1.3.0-rc01 contains these commits.
- No changes since the last beta release.
Version 1.3.0-beta01
March 9, 2022
androidx.mediarouter:mediarouter:1.3.0-beta01
is released. Version 1.3.0-beta01 contains these commits.
- No changes since the last alpha release.
Version 1.3.0-alpha01
December 15, 2021
androidx.mediarouter:mediarouter:1.3.0-alpha01
is released. Version 1.3.0-alpha01 contains these commits.
API Changes
- Add a flag into
MediaRouterParams
that can be used to disable seamless transfer at runtime (I53d68) - Added a testing artifact which can reset the
MediaRouter
. (Id167c) - Add a router param for UX tweak in
MediaRouterControllerDialog
(I7e574) - Annotated nullness for public methods (Ifc901)
Bug Fixes
- API lint check for
MissingGetterMatchingBuilder
is enabled for androidx (I4bbea, b/138602561)
Version 1.2
Version 1.2.6
January 26, 2022
androidx.mediarouter:mediarouter:1.2.6
is released. Version 1.2.6 contains these commits.
Bug Fixes
- Fix
RemotePlaybackClient
constructor crash on Android 12 b/210684559
Version 1.2.5
September 1, 2021
androidx.mediarouter:mediarouter:1.2.5
is released. Version 1.2.5 contains these commits.
Bug Fixes
- Hide the media route button in the Output switcher when there is no routes to transfer.
- Fix issues of controlling the volume of group member routes.
Version 1.2.4
June 16, 2021
androidx.mediarouter:mediarouter:1.2.4
is released. Version 1.2.4 contains these commits.
Bug Fixes
- Fixed an issue where MediaRouteButton replays connecting animation.
- Fixed the vertical alignment of routes in
MediaRouteChooserDialog
.
Version 1.2.3
May 5, 2021
androidx.mediarouter:mediarouter:1.2.3
is released. Version 1.2.3 contains these commits.
Bug Fixes
- Fixed the NullPointerException for customized chooser dialog.
- Fixed issue where the MediaRouteButton shows a disconnected state even when it's connected, if it is temporarily disabled.
Version 1.2.2
February 10, 2021
androidx.mediarouter:mediarouter:1.2.2
is released. Version 1.2.2 contains these commits.
Bug Fixes
- Do not try to reselect the selected route when
OnDynamicRouteChangedListener.onRouteChanged
is called.
Version 1.2.1
January 13, 2021
androidx.mediarouter:mediarouter:1.2.1
is released. Version 1.2.1 contains these commits.
Bug Fixes
- Fix selecting phone speaker when
unselect()
is called while BT is available - Fix MediaRouter.Callback timing.
Callback#onRouteSelected
andCallback#onRouteUnselected
will be called afterOnPrepareTransferListener#onPrepareTransfer
is completed.
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
inMediaRouteProvider#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
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
toNullPointerException
for the null arguments which marked as@NonNull
.
API changes
- Callback logic for
DynamicRouteDescriptor
was changed. NowMediaRouteProvider
will callMediaRouterProvider.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 inMediaRouteActionProvider
andMediaRouteButton
to enable dynamic group feature - Added
setAlwaysVisible(boolean)
method inMediaRouteActionProvider
andMediaRouteButton
to allowMediaRouteButton
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
- Added APIs to support dynamic group routes by