Android APIs
public static class

MediaRouter.RouteInfo

extends Object
java.lang.Object
   ↳ android.media.MediaRouter.RouteInfo
Known Direct Subclasses

Class Overview

Information about a media route.

Summary

Constants
int PLAYBACK_TYPE_LOCAL The default playback type, "local", indicating the presentation of the media is happening on the same device (e.g.
int PLAYBACK_TYPE_REMOTE A playback type indicating the presentation of the media is happening on a different device (i.e.
int PLAYBACK_VOLUME_FIXED Playback information indicating the playback volume is fixed, i.e.
int PLAYBACK_VOLUME_VARIABLE Playback information indicating the playback volume is variable and can be controlled from this object.
Public Methods
MediaRouter.RouteCategory getCategory()
CharSequence getDescription()
Gets the user-visible description of the route.
MediaRouter.RouteGroup getGroup()
Drawable getIconDrawable()
Get the icon representing this route.
CharSequence getName(Context context)
Return the properly localized/resource user-visible name of this route.
CharSequence getName()
Gets the user-visible name of the route.
int getPlaybackStream()
int getPlaybackType()
Display getPresentationDisplay()
Gets the Display that should be used by the application to show a Presentation on an external display when this route is selected.
CharSequence getStatus()
int getSupportedTypes()
Object getTag()
int getVolume()
Return the current volume for this route.
int getVolumeHandling()
int getVolumeMax()
boolean isConnecting()
Returns true if the route is in the process of connecting and is not yet ready for use.
boolean isEnabled()
Returns true if this route is enabled and may be selected.
void requestSetVolume(int volume)
Request a volume change for this route.
void requestUpdateVolume(int direction)
Request an incremental volume update for this route.
void setTag(Object tag)
Set an application-specific tag object for this route.
String toString()
Returns a string containing a concise, human-readable description of this object.
[Expand]
Inherited Methods
From class java.lang.Object

Constants

public static final int PLAYBACK_TYPE_LOCAL

Added in API level 16

The default playback type, "local", indicating the presentation of the media is happening on the same device (e.g. a phone, a tablet) as where it is controlled from.

Constant Value: 0 (0x00000000)

public static final int PLAYBACK_TYPE_REMOTE

Added in API level 16

A playback type indicating the presentation of the media is happening on a different device (i.e. the remote device) than where it is controlled from.

Constant Value: 1 (0x00000001)

public static final int PLAYBACK_VOLUME_FIXED

Added in API level 16

Playback information indicating the playback volume is fixed, i.e. it cannot be controlled from this object. An example of fixed playback volume is a remote player, playing over HDMI where the user prefers to control the volume on the HDMI sink, rather than attenuate at the source.

Constant Value: 0 (0x00000000)

public static final int PLAYBACK_VOLUME_VARIABLE

Added in API level 16

Playback information indicating the playback volume is variable and can be controlled from this object.

Constant Value: 1 (0x00000001)

Public Methods

public MediaRouter.RouteCategory getCategory ()

Added in API level 16

Returns
  • the category this route belongs to.

public CharSequence getDescription ()

Added in API level 18

Gets the user-visible description of the route.

The route description describes the kind of destination represented by the route. It may be a user-supplied string, a model number or brand of device.

Returns
  • The description of the route, or null if none.

public MediaRouter.RouteGroup getGroup ()

Added in API level 16

Returns
  • The group that this route belongs to.

public Drawable getIconDrawable ()

Added in API level 16

Get the icon representing this route. This icon will be used in picker UIs if available.

Returns
  • the icon representing this route or null if no icon is available

public CharSequence getName (Context context)

Added in API level 16

Return the properly localized/resource user-visible name of this route.

The route name identifies the destination represented by the route. It may be a user-supplied name, an alias, or device serial number.

Parameters
context Context used to resolve the correct configuration to load
Returns
  • The user-visible name of a media route. This is the string presented to users who may select this as the active route.

public CharSequence getName ()

Added in API level 16

Gets the user-visible name of the route.

The route name identifies the destination represented by the route. It may be a user-supplied name, an alias, or device serial number.

Returns
  • The user-visible name of a media route. This is the string presented to users who may select this as the active route.

public int getPlaybackStream ()

Added in API level 16

Returns
  • the stream over which the playback associated with this route is performed

public int getPlaybackType ()

Added in API level 16

Returns
  • the type of playback associated with this route

public Display getPresentationDisplay ()

Added in API level 17

Gets the Display that should be used by the application to show a Presentation on an external display when this route is selected. Depending on the route, this may only be valid if the route is currently selected.

The preferred presentation display may change independently of the route being selected or unselected. For example, the presentation display of the default system route may change when an external HDMI display is connected or disconnected even though the route itself has not changed.

This method may return null if there is no external display associated with the route or if the display is not ready to show UI yet.

The application should listen for changes to the presentation display using the onRoutePresentationDisplayChanged(MediaRouter, MediaRouter.RouteInfo) callback and show or dismiss its Presentation accordingly when the display becomes available or is removed.

This method only makes sense for live video routes.

Returns
  • The preferred presentation display to use when this route is selected or null if none.

public CharSequence getStatus ()

Added in API level 16

Returns
  • The user-visible status for a media route. This may include a description of the currently playing media, if available.

public int getSupportedTypes ()

Added in API level 16

Returns
  • A media type flag set describing which types this route supports.

public Object getTag ()

Added in API level 16

Returns
  • The tag object previously set by the application
See Also

public int getVolume ()

Added in API level 16

Return the current volume for this route. Depending on the route, this may only be valid if the route is currently selected.

Returns
  • the volume at which the playback associated with this route is performed
See Also

public int getVolumeHandling ()

Added in API level 16

Returns
  • how volume is handling on the route

public int getVolumeMax ()

Added in API level 16

Returns
  • the maximum volume at which the playback associated with this route is performed

public boolean isConnecting ()

Added in API level 18

Returns true if the route is in the process of connecting and is not yet ready for use.

Returns
  • True if this route is in the process of connecting.

public boolean isEnabled ()

Added in API level 17

Returns true if this route is enabled and may be selected.

Returns
  • True if this route is enabled.

public void requestSetVolume (int volume)

Added in API level 16

Request a volume change for this route.

Parameters
volume value between 0 and getVolumeMax

public void requestUpdateVolume (int direction)

Added in API level 16

Request an incremental volume update for this route.

Parameters
direction Delta to apply to the current volume

public void setTag (Object tag)

Added in API level 16

Set an application-specific tag object for this route. The application may use this to store arbitrary data associated with the route for internal tracking.

Note that the lifespan of a route may be well past the lifespan of an Activity or other Context; take care that objects you store here will not keep more data in memory alive than you intend.

Parameters
tag Arbitrary, app-specific data for this route to hold for later use

public String toString ()

Added in API level 16

Returns a string containing a concise, human-readable description of this object. Subclasses are encouraged to override this method and provide an implementation that takes into account the object's type and data. The default implementation is equivalent to the following expression:

   getClass().getName() + '@' + Integer.toHexString(hashCode())

See Writing a useful toString method if you intend implementing your own toString method.

Returns
  • a printable representation of this object.