MediaRouter2.RoutingController
  public
  
  
  
  class
  MediaRouter2.RoutingController
  
    extends Object
  
  
  
  
  
  
| java.lang.Object | |
| ↳ | android.media.MediaRouter2.RoutingController | 
Controls a media routing session.
Routing controllers wrap a RoutingSessionInfo, taking care of mapping route ids to
 MediaRoute2Info instances. You can still access the underlying session using getRoutingSessionInfo(), but keep in mind it can be changed by other threads. Changes to
 the routing session are notified via ControllerCallback.
Summary
| Public methods | |
|---|---|
| 
        
        
        
        
        
        void | 
      deselectRoute(MediaRoute2Info route)
      Deselects a route from the remote session. | 
| 
        
        
        
        
        
        Bundle | 
      getControlHints()
      Gets the control hints used to control routing session if available. | 
| 
        
        
        
        
        
        List<MediaRoute2Info> | 
      getDeselectableRoutes()
      Returns the unmodifiable list of deselectable routes for the session. | 
| 
        
        
        
        
        
        String | 
      getId()
       | 
| 
        
        
        
        
        
        RoutingSessionInfo | 
      getRoutingSessionInfo()
      Returns the current  | 
| 
        
        
        
        
        
        List<MediaRoute2Info> | 
      getSelectableRoutes()
      Returns the unmodifiable list of selectable routes for the session. | 
| 
        
        
        
        
        
        List<MediaRoute2Info> | 
      getSelectedRoutes()
      Returns the unmodifiable list of currently selected routes | 
| 
        
        
        
        
        
        List<MediaRoute2Info> | 
      getTransferableRoutes()
      Returns the unmodifiable list of transferable routes for the session. | 
| 
        
        
        
        
        
        int | 
      getVolume()
      Gets the current volume of the session. | 
| 
        
        
        
        
        
        int | 
      getVolumeHandling()
      Gets the information about how volume is handled on the session. | 
| 
        
        
        
        
        
        int | 
      getVolumeMax()
      Gets the maximum volume of the session. | 
| 
        
        
        
        
        
        boolean | 
      isReleased()
      Returns true if this controller is released, false otherwise. | 
| 
        
        
        
        
        
        void | 
      release()
      Releases this controller and the corresponding session. | 
| 
        
        
        
        
        
        void | 
      selectRoute(MediaRoute2Info route)
      Selects a route for the remote session. | 
| 
        
        
        
        
        
        void | 
      setVolume(int volume)
      Requests a volume change for the remote session asynchronously. | 
| 
        
        
        
        
        
        String | 
      toString()
      Returns a string representation of the object. | 
| 
        
        
        
        
        
        boolean | 
      wasTransferInitiatedBySelf()
      Returns whether the transfer was initiated by the calling app (as determined by comparing
  | 
| Inherited methods | |
|---|---|
Public methods
deselectRoute
public void deselectRoute (MediaRoute2Info route)
Deselects a route from the remote session. After a route is deselected, the media is expected to be stopped on the deselected route.
The given route must satisfy all of the following conditions:
- It should be included in getSelectedRoutes()
- It should be included in getDeselectableRoutes()
| Parameters | |
|---|---|
| route | MediaRoute2Info: This value cannot benull. | 
getControlHints
public Bundle getControlHints ()
Gets the control hints used to control routing session if available. It is set by the media route provider.
| Returns | |
|---|---|
| Bundle | This value may be null. | 
getDeselectableRoutes
public List<MediaRoute2Info> getDeselectableRoutes ()
Returns the unmodifiable list of deselectable routes for the session.
| Returns | |
|---|---|
| List<MediaRoute2Info> | This value cannot be null. | 
getId
public String getId ()
| Returns | |
|---|---|
| String | the ID of the controller. It is globally unique.
 This value cannot be null. | 
getRoutingSessionInfo
public RoutingSessionInfo getRoutingSessionInfo ()
Returns the current RoutingSessionInfo associated to this controller.
| Returns | |
|---|---|
| RoutingSessionInfo | This value cannot be null. | 
getSelectableRoutes
public List<MediaRoute2Info> getSelectableRoutes ()
Returns the unmodifiable list of selectable routes for the session.
| Returns | |
|---|---|
| List<MediaRoute2Info> | This value cannot be null. | 
See also:
getSelectedRoutes
public List<MediaRoute2Info> getSelectedRoutes ()
Returns the unmodifiable list of currently selected routes
| Returns | |
|---|---|
| List<MediaRoute2Info> | This value cannot be null. | 
See also:
getTransferableRoutes
public List<MediaRoute2Info> getTransferableRoutes ()
Returns the unmodifiable list of transferable routes for the session.
| Returns | |
|---|---|
| List<MediaRoute2Info> | This value cannot be null. | 
getVolume
public int getVolume ()
Gets the current volume of the session.
When it's available, it represents the volume of routing session, which is a group of
 selected routes. Use MediaRoute2Info.getVolume() to get the volume of a route,
| Returns | |
|---|---|
| int | |
See also:
getVolumeHandling
public int getVolumeHandling ()
Gets the information about how volume is handled on the session.
Please note that you may not control the volume of the session even when you can control the volume of each selected route in the session.
| Returns | |
|---|---|
| int | MediaRoute2Info.PLAYBACK_VOLUME_FIXEDorMediaRoute2Info.PLAYBACK_VOLUME_VARIABLEValue isMediaRoute2Info.PLAYBACK_VOLUME_FIXED, orMediaRoute2Info.PLAYBACK_VOLUME_VARIABLE | 
getVolumeMax
public int getVolumeMax ()
Gets the maximum volume of the session.
| Returns | |
|---|---|
| int | |
isReleased
public boolean isReleased ()
Returns true if this controller is released, false otherwise. If it is released, then all other getters from this instance may return invalid values. Also, any operations to this instance will be ignored once released.
| Returns | |
|---|---|
| boolean | |
See also:
release
public void release ()
Releases this controller and the corresponding session. Any operations on this controller after calling this method will be ignored. The devices that are playing media will stop playing it.
selectRoute
public void selectRoute (MediaRoute2Info route)
Selects a route for the remote session. After a route is selected, the media is expected
 to be played to the all the selected routes. This is different from transferring to a route, where the media is
 expected to 'move' from one route to another.
 
The given route must satisfy all of the following conditions:
- It should not be included in getSelectedRoutes()
- It should be included in getSelectableRoutes()
| Parameters | |
|---|---|
| route | MediaRoute2Info: This value cannot benull. | 
setVolume
public void setVolume (int volume)
Requests a volume change for the remote session asynchronously.
| Parameters | |
|---|---|
| volume | int: The new volume value between 0 andRoutingController.getVolumeMax(inclusive). | 
See also:
toString
public String toString ()
Returns a string representation of the object.
| Returns | |
|---|---|
| String | a string representation of the object. | 
wasTransferInitiatedBySelf
public boolean wasTransferInitiatedBySelf ()
Returns whether the transfer was initiated by the calling app (as determined by comparing
 UserHandle and package name).
| Returns | |
|---|---|
| boolean | |
