added in version 22.1.0
belongs to Maven artifact com.android.support:mediarouter-v7:28.0.0-alpha1

MediaRouter

public final class MediaRouter
extends Object

java.lang.Object
   ↳ android.support.v7.media.MediaRouter


MediaRouter allows applications to control the routing of media channels and streams from the current device to external speakers and destination devices.

A MediaRouter instance is retrieved through getInstance(Context). Applications can query the media router about the currently selected route and its capabilities to determine how to send content to the route's destination. Applications can also send control requests to the route to ask the route's destination to perform certain remote control functions such as playing media.

See also MediaRouteProvider for information on how an application can publish new media routes to the media router.

The media router API is not thread-safe; all interactions with it must be done from the main thread of the process.

Summary

Nested classes

class MediaRouter.Callback

Interface for receiving events about media routing changes. 

class MediaRouter.ControlRequestCallback

Callback which is invoked with the result of a media control request. 

class MediaRouter.ProviderInfo

Provides information about a media route provider. 

class MediaRouter.RouteInfo

Provides information about a media route. 

Constants

int AVAILABILITY_FLAG_IGNORE_DEFAULT_ROUTE

Flag for isRouteAvailable(MediaRouteSelector, int): Ignore the default route.

int AVAILABILITY_FLAG_REQUIRE_MATCH

Flag for isRouteAvailable(MediaRouteSelector, int): Require an actual route to be matched.

int CALLBACK_FLAG_FORCE_DISCOVERY

Flag for addCallback(MediaRouteSelector, MediaRouter.Callback): Request passive route discovery while this callback is registered, even on low-RAM devices.

int CALLBACK_FLAG_PERFORM_ACTIVE_SCAN

Flag for addCallback(MediaRouteSelector, MediaRouter.Callback): Actively scan for routes while this callback is registered.

int CALLBACK_FLAG_REQUEST_DISCOVERY

Flag for addCallback(MediaRouteSelector, MediaRouter.Callback): Request passive route discovery while this callback is registered, except on low-RAM devices.

int CALLBACK_FLAG_UNFILTERED_EVENTS

Flag for addCallback(MediaRouteSelector, MediaRouter.Callback): Do not filter route events.

int UNSELECT_REASON_DISCONNECTED

Passed to onUnselect(int) and onRouteUnselected(MediaRouter, RouteInfo, int) when the user pressed the disconnect button to disconnect and keep playing.

int UNSELECT_REASON_ROUTE_CHANGED

Passed to onUnselect(int) and onRouteUnselected(MediaRouter, RouteInfo, int) when the user selected a different route.

int UNSELECT_REASON_STOPPED

Passed to onUnselect(int) and onRouteUnselected(MediaRouter, RouteInfo, int) when the user pressed the stop casting button.

int UNSELECT_REASON_UNKNOWN