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.

Summary

Public constructors

Public functions

Unit

Called when a media route provider has been added.

Unit
onProviderChanged(
    router: MediaRouter,
    provider: MediaRouter.ProviderInfo
)

Called when a property of the indicated media route provider has changed.

Unit
onProviderRemoved(
    router: MediaRouter,
    provider: MediaRouter.ProviderInfo
)

Called when a media route provider has been removed.

Unit

Called when a media route has been added.

Unit

Called when a property of the indicated media route has changed.

Unit

Called when a media route's presentation display changes.

Unit

Called when a media route has been removed.

Unit

This function is deprecated.

Use onRouteSelected instead.

Unit
onRouteSelected(
    router: MediaRouter,
    route: MediaRouter.RouteInfo,
    @MediaRouter.UnselectReason reason: Int
)

Called when the supplied media route becomes selected as the active route.

Unit
onRouteSelected(
    router: MediaRouter,
    selectedRoute: MediaRouter.RouteInfo,
    @MediaRouter.UnselectReason reason: Int,
    requestedRoute: MediaRouter.RouteInfo
)

Called when the supplied media route becomes selected as the active route, which may be different from the route requested by selectRoute.

Unit

This function is deprecated.

Use onRouteUnselected instead.

Unit
onRouteUnselected(
    router: MediaRouter,
    route: MediaRouter.RouteInfo,
    @MediaRouter.UnselectReason reason: Int
)

Called when the supplied media route becomes unselected as the active route.

Unit

Called when a media route's volume changes.

Public constructors

Callback

Added in 1.1.0
Callback()

Public functions

onProviderAdded

Added in 1.1.0
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

Added in 1.1.0
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

Added in 1.1.0
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

Added in 1.1.0
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

Added in 1.1.0
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.

onRoutePresentationDisplayChanged

Added in 1.1.0
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.

onRouteRemoved

Added in 1.1.0
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.

onRouteSelected

Added in 1.1.0
Deprecated in 1.2.0
fun onRouteSelected(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

Added in 1.2.0
fun onRouteSelected(
    router: MediaRouter,
    route: MediaRouter.RouteInfo,
    @MediaRouter.UnselectReason reason: Int
): Unit

Called when the supplied media route becomes selected as the active route.

The reason provided will be one of the following:

Parameters
router: MediaRouter

The media router reporting the event.

route: MediaRouter.RouteInfo

The route that has been selected.

@MediaRouter.UnselectReason reason: Int

The reason for unselecting the previous route.

onRouteSelected

Added in 1.2.0
fun onRouteSelected(
    router: MediaRouter,
    selectedRoute: MediaRouter.RouteInfo,
    @MediaRouter.UnselectReason 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.

@MediaRouter.UnselectReason reason: Int

The reason for unselecting the previous route.

requestedRoute: MediaRouter.RouteInfo

The route that was requested to be selected.

onRouteUnselected

Added in 1.1.0
Deprecated in 1.2.0
fun onRouteUnselected(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

Added in 1.1.0
fun onRouteUnselected(
    router: MediaRouter,
    route: MediaRouter.RouteInfo,
    @MediaRouter.UnselectReason 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:

Parameters
router: MediaRouter

The media router reporting the event.

route: MediaRouter.RouteInfo

The route that has been unselected.

@MediaRouter.UnselectReason reason: Int

The reason for unselecting the route.

onRouteVolumeChanged

Added in 1.1.0
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.