MediaRouter.Callback
abstract class MediaRouter.Callback
Interface for receiving events about media routing changes. All methods of this interface will be called from the application's main thread.
A Callback will only receive events relevant to routes that the callback was registered for unless the CALLBACK_FLAG_UNFILTERED_EVENTS flag was specified in addCallback.
| See also | |
|---|---|
addCallback |
|
removeCallback |
Summary
Public constructors |
|---|
Callback() |
Public functions |
|
|---|---|
Unit |
onProviderAdded(router: MediaRouter, provider: MediaRouter.ProviderInfo)Called when a media route provider has been added. |
Unit |
onProviderChanged(Called when a property of the indicated media route provider has changed. |
Unit |
onProviderRemoved(Called when a media route provider has been removed. |
Unit |
onRouteAdded(router: MediaRouter, route: MediaRouter.RouteInfo)Called when a media route has been added. |
Unit |
onRouteChanged(router: MediaRouter, route: MediaRouter.RouteInfo)Called when a property of the indicated media route has changed. |
Unit |
onRouteConnected(Called when the supplied media route becomes connected. |
Unit |
onRouteDisconnected(Called when the supplied media route becomes disconnected. |
Unit |
onRoutePresentationDisplayChanged(Called when a media route's presentation display changes. |
Unit |
onRouteRemoved(router: MediaRouter, route: MediaRouter.RouteInfo)Called when a media route has been removed. |
Unit |
This function is deprecated. Use |
Unit |
onRouteSelected(Called when the supplied media route becomes selected as the active route. |
Unit |
onRouteSelected(Called when the supplied media route becomes selected as the active route, which may be different from the route requested by |
Unit |
This function is deprecated. Use |
Unit |
onRouteUnselected(Called when the supplied media route becomes unselected as the active route. |
Unit |
onRouteVolumeChanged(router: MediaRouter, route: MediaRouter.RouteInfo)Called when a media route's volume changes. |
Public constructors
Public functions
onProviderAdded
fun onProviderAdded(router: MediaRouter, provider: MediaRouter.ProviderInfo): Unit
Called when a media route provider has been added.
| Parameters | |
|---|---|
router: MediaRouter |
The media router reporting the event. |
provider: MediaRouter.ProviderInfo |
The provider that has become available for use. |
onProviderChanged
fun onProviderChanged(
router: MediaRouter,
provider: MediaRouter.ProviderInfo
): Unit
Called when a property of the indicated media route provider has changed.
| Parameters | |
|---|---|
router: MediaRouter |
The media router reporting the event. |
provider: MediaRouter.ProviderInfo |
The provider that was changed. |
onProviderRemoved
fun onProviderRemoved(
router: MediaRouter,
provider: MediaRouter.ProviderInfo
): Unit
Called when a media route provider has been removed.
| Parameters | |
|---|---|
router: MediaRouter |
The media router reporting the event. |
provider: MediaRouter.ProviderInfo |
The provider that has been removed from availability. |
onRouteAdded
fun onRouteAdded(router: MediaRouter, route: MediaRouter.RouteInfo): Unit
Called when a media route has been added.
| Parameters | |
|---|---|
router: MediaRouter |
The media router reporting the event. |
route: MediaRouter.RouteInfo |
The route that has become available for use. |
onRouteChanged
fun onRouteChanged(router: MediaRouter, route: MediaRouter.RouteInfo): Unit
Called when a property of the indicated media route has changed.
| Parameters | |
|---|---|
router: MediaRouter |
The media router reporting the event. |
route: MediaRouter.RouteInfo |
The route that was changed. |
onRouteConnected
fun onRouteConnected(
router: MediaRouter,
connectedRoute: MediaRouter.RouteInfo,
requestedRoute: MediaRouter.RouteInfo
): Unit
Called when the supplied media route becomes connected.
Route connection doesn't affect the selected route. Apps can keep their selected routes while connecting to other routes.
The connected route could be different from the route requested by connect. This can happen when the media transfer feature is enabled.
| Parameters | |
|---|---|
router: MediaRouter |
the media router reporting the event. |
connectedRoute: MediaRouter.RouteInfo |
the route that has been connected. |
requestedRoute: MediaRouter.RouteInfo |
the route that was requested to be connected. |
onRouteDisconnected
fun onRouteDisconnected(
router: MediaRouter,
disconnectedRoute: MediaRouter.RouteInfo?,
requestedRoute: MediaRouter.RouteInfo,
reason: Int
): Unit
Called when the supplied media route becomes disconnected.
Route disconnection doesn't affect the selected route. Apps can keep their selected route while disconnecting other connected routes.
The disconnected route could be different from the route requested by connect or disconnect.
| Parameters | |
|---|---|
router: MediaRouter |
the media router reporting the event. |
disconnectedRoute: MediaRouter.RouteInfo? |
the route that has been disconnected if the route has an established connection, or |
requestedRoute: MediaRouter.RouteInfo |
the route that originated the connection request through |
reason: Int |
the reason for disconnecting the route. |
onRoutePresentationDisplayChanged
fun onRoutePresentationDisplayChanged(
router: MediaRouter,
route: MediaRouter.RouteInfo
): Unit
Called when a media route's presentation display changes.
This method is called whenever the route's presentation display becomes available, is removed or has changes to some of its properties (such as its size).
| Parameters | |
|---|---|
router: MediaRouter |
The media router reporting the event. |
route: MediaRouter.RouteInfo |
The route whose presentation display changed. |
| See also | |
|---|---|
getPresentationDisplay |
onRouteRemoved
fun onRouteRemoved(router: MediaRouter, route: MediaRouter.RouteInfo): Unit
Called when a media route has been removed.
| Parameters | |
|---|---|
router: MediaRouter |
The media router reporting the event. |
route: MediaRouter.RouteInfo |
The route that has been removed from availability. |
funonRouteSelected(router: MediaRouter, route: MediaRouter.RouteInfo): Unit
Called when the supplied media route becomes selected as the active route.
| Parameters | |
|---|---|
router: MediaRouter |
The media router reporting the event. |
route: MediaRouter.RouteInfo |
The route that has been selected. |
onRouteSelected
fun onRouteSelected(
router: MediaRouter,
route: MediaRouter.RouteInfo,
reason: Int
): Unit
Called when the supplied media route becomes selected as the active route.
The reason provided will be one of the following:
UNSELECT_REASON_UNKNOWNUNSELECT_REASON_DISCONNECTEDUNSELECT_REASON_STOPPEDUNSELECT_REASON_ROUTE_CHANGED
| Parameters | |
|---|---|
router: MediaRouter |
The media router reporting the event. |
route: MediaRouter.RouteInfo |
The route that has been selected. |
reason: Int |
The reason for unselecting the previous route. |
onRouteSelected
fun onRouteSelected(
router: MediaRouter,
selectedRoute: MediaRouter.RouteInfo,
reason: Int,
requestedRoute: MediaRouter.RouteInfo
): Unit
Called when the supplied media route becomes selected as the active route, which may be different from the route requested by selectRoute. That can happen when media transfer feature is enabled. The default implementation calls onRouteSelected with the actually selected route.
| Parameters | |
|---|---|
router: MediaRouter |
The media router reporting the event. |
selectedRoute: MediaRouter.RouteInfo |
The route that has been selected. |
reason: Int |
The reason for unselecting the previous route. |
requestedRoute: MediaRouter.RouteInfo |
The route that was requested to be selected. |
funonRouteUnselected(router: MediaRouter, route: MediaRouter.RouteInfo): Unit
Called when the supplied media route becomes unselected as the active route. For detailed reason, override onRouteUnselected instead.
| Parameters | |
|---|---|
router: MediaRouter |
The media router reporting the event. |
route: MediaRouter.RouteInfo |
The route that has been unselected. |
onRouteUnselected
fun onRouteUnselected(
router: MediaRouter,
route: MediaRouter.RouteInfo,
reason: Int
): Unit
Called when the supplied media route becomes unselected as the active route. The default implementation calls onRouteUnselected.
The reason provided will be one of the following:
UNSELECT_REASON_UNKNOWNUNSELECT_REASON_DISCONNECTEDUNSELECT_REASON_STOPPEDUNSELECT_REASON_ROUTE_CHANGED
| Parameters | |
|---|---|
router: MediaRouter |
The media router reporting the event. |
route: MediaRouter.RouteInfo |
The route that has been unselected. |
reason: Int |
The reason for unselecting the route. |
onRouteVolumeChanged
fun onRouteVolumeChanged(router: MediaRouter, route: MediaRouter.RouteInfo): Unit
Called when a media route's volume changes.
| Parameters | |
|---|---|
router: MediaRouter |
The media router reporting the event. |
route: MediaRouter.RouteInfo |
The route whose volume changed. |