public abstract class

MediaRouteProvider.RouteController

extends java.lang.Object

 java.lang.Object

↳androidx.mediarouter.media.MediaRouteProvider.RouteController

Subclasses:

MediaRouteProvider.DynamicGroupRouteController

Overview

Provides control over a particular route.

The media router obtains a route controller for a route whenever it needs to control a route. When a route is selected, the media router invokes the MediaRouteProvider.RouteController.onSelect() method of its route controller. While selected, the media router may call other methods of the route controller to request that it perform certain actions to the route. When a route is unselected, the media router invokes the MediaRouteProvider.RouteController.onUnselect(int) method of its route controller. When the media route no longer needs the route controller it will invoke the MediaRouteProvider.RouteController.onRelease() method to allow the route controller to free its resources.

There may be multiple route controllers simultaneously active for the same route. Each route controller will be released separately.

All operations on the route controller are asynchronous and results are communicated via callbacks.

Summary

Constructors
publicRouteController()

Methods
public booleanonControlRequest(Intent intent, MediaRouter.ControlRequestCallback callback)

Performs a media control request asynchronously on behalf of the route.

public voidonRelease()

Releases the route controller, allowing it to free its resources.

public voidonSelect()

Selects the route.

public voidonSetVolume(int volume)

Requests to set the volume of the route.

public voidonUnselect()

Unselects the route.

public voidonUnselect(int reason)

Unselects the route and provides a reason.

public voidonUpdateVolume(int delta)

Requests an incremental volume update for the route.

from java.lang.Objectclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

Constructors

public RouteController()

Methods

public void onRelease()

Releases the route controller, allowing it to free its resources.

public void onSelect()

Selects the route.

public void onUnselect()

Deprecated: Use MediaRouteProvider.RouteController.onUnselect(int) instead.

Unselects the route.

public void onUnselect(int reason)

Unselects the route and provides a reason. The default implementation calls MediaRouteProvider.RouteController.onUnselect().

The reason provided will be one of the following:

Parameters:

reason: The reason for unselecting the route.

public void onSetVolume(int volume)

Requests to set the volume of the route.

Parameters:

volume: The new volume value between 0 and MediaRouteDescriptor.getVolumeMax().

public void onUpdateVolume(int delta)

Requests an incremental volume update for the route.

Parameters:

delta: The delta to add to the current volume.

public boolean onControlRequest(Intent intent, MediaRouter.ControlRequestCallback callback)

Performs a media control request asynchronously on behalf of the route.

Parameters:

intent: A media control intent.
callback: A MediaRouter.ControlRequestCallback to invoke with the result of the request, or null if no result is required.

Returns:

True if the controller intends to handle the request and will invoke the callback when finished. False if the controller will not handle the request and will not invoke the callback.

See also: MediaControlIntent