MediaRouteDescriptor

class MediaRouteDescriptor
kotlin.Any
   ↳ androidx.mediarouter.media.MediaRouteDescriptor

Describes the properties of a route.

Each route is uniquely identified by an opaque id string. This token may take any form as long as it is unique within the media route provider.

This object is immutable once created using a Builder instance.

Summary

Nested classes

Builder for media route descriptors.

Public methods
Boolean

Gets whether the route is connecting.

String!

Gets the user-visible name of the route.

String!

Gets the unique id of the route.

Bundle!

Gets a bundle of extras for this route descriptor.

Int

Gets the type of playback associated with this route.

IntentSender!

Gets an IntentSender for starting a settings activity for this route.

Int

Gets information about how volume is handled on the route.

Int

Gets the route's current volume, or 0 if unknown.

Boolean

Gets whether the route can be disconnected without stopping playback.

String!

Gets the user-visible description of the route.

Boolean

Returns if this route is a dynamic group route.

Boolean

Returns true if the route descriptor has all of the required fields.

Int

Gets the type of the receiver device associated with this route.

Int

Gets the connection state of the route.

String

Boolean

Gets whether the route is enabled.

MutableList<IntentFilter!>!

Gets the route's media control intent filters.

Bundle!

Converts this object to a bundle for serialization.

Int

Gets the route's presentation display id, or -1 if none.

Uri!

Gets the URI of the icon representing this route.

Int

Gets the route's maximum volume, or 0 if unknown.

Int

Gets the route's playback stream.

static MediaRouteDescriptor!
fromBundle(bundle: Bundle!)

Creates an instance from a bundle.

Public methods

isConnecting

fun isConnecting(): Boolean

Gets whether the route is connecting.

getName

fun getName(): String!

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.

getId

fun getId(): String!

Gets the unique id of the route.

The route id associated with a route descriptor functions as a stable identifier for the route and must be unique among all routes offered by the provider.

getExtras

fun getExtras(): Bundle!

Gets a bundle of extras for this route descriptor. The extras will be ignored by the media router but they may be used by applications.

getPlaybackType

fun getPlaybackType(): Int

Gets the type of playback associated with this route.

Return
Int: The type of playback associated with this route: MediaRouter.RouteInfo#PLAYBACK_TYPE_LOCAL or MediaRouter.RouteInfo#PLAYBACK_TYPE_REMOTE.

getSettingsActivity

fun getSettingsActivity(): IntentSender!

Gets an IntentSender for starting a settings activity for this route. The activity may have specific route settings or general settings for the connected device or route provider.

Return
IntentSender!: An IntentSender to start a settings activity.

getVolumeHandling

fun getVolumeHandling(): Int

Gets information about how volume is handled on the route.

Return
Int: How volume is handled on the route: MediaRouter.RouteInfo#PLAYBACK_VOLUME_FIXED or MediaRouter.RouteInfo#PLAYBACK_VOLUME_VARIABLE.

getVolume

fun getVolume(): Int

Gets the route's current volume, or 0 if unknown.

canDisconnectAndKeepPlaying

fun canDisconnectAndKeepPlaying(): Boolean

Gets whether the route can be disconnected without stopping playback.

The route can normally be disconnected without stopping playback when the destination device on the route is connected to two or more source devices. The route provider should update the route immediately when the number of connected devices changes.

To specify that the route should disconnect without stopping use MediaRouter#unselect(int) with MediaRouter#UNSELECT_REASON_DISCONNECTED.

getDescription

fun getDescription(): String!

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.

isDynamicGroupRoute

fun isDynamicGroupRoute(): Boolean

Returns if this route is a dynamic group route.

MediaRouteProvider creates a dynamic group route when MediaRouteProvider#onCreateDynamicGroupRouteController(String) is called. It happens when a single route or a single static group is selected.

If a single device or a static group is selected, the associated dynamic group route should not be seen by any client app because there is already one for the device. After user added more devices into the session, it should be seen by the client app. The provider can treat this by not setting the media intent for the dynamic group route if it contains only one member.

>
Return
Boolean: true if this route is a dynamic group route.

isValid

fun isValid(): Boolean

Returns true if the route descriptor has all of the required fields.

getDeviceType

fun getDeviceType(): Int

Gets the type of the receiver device associated with this route.

Return
Int: The type of the receiver device associated with this route: MediaRouter.RouteInfo#DEVICE_TYPE_TV or MediaRouter.RouteInfo#DEVICE_TYPE_SPEAKER.

getConnectionState

fun getConnectionState(): Int

Gets the connection state of the route.

Return
Int: The connection state of this route: MediaRouter.RouteInfo#CONNECTION_STATE_DISCONNECTED, MediaRouter.RouteInfo#CONNECTION_STATE_CONNECTING, or MediaRouter.RouteInfo#CONNECTION_STATE_CONNECTED.

toString

fun toString(): String

isEnabled

fun isEnabled(): Boolean

Gets whether the route is enabled.

getControlFilters

fun getControlFilters(): MutableList<IntentFilter!>!

Gets the route's media control intent filters.

asBundle

fun asBundle(): Bundle!

Converts this object to a bundle for serialization.

Return
Bundle!: The contents of the object represented as a bundle.

getPresentationDisplayId

fun getPresentationDisplayId(): Int

Gets the route's presentation display id, or -1 if none.

getIconUri

fun getIconUri(): Uri!

Gets the URI of the icon representing this route.

This icon will be used in picker UIs if available.

getVolumeMax

fun getVolumeMax(): Int

Gets the route's maximum volume, or 0 if unknown.

getPlaybackStream

fun getPlaybackStream(): Int

Gets the route's playback stream.

fromBundle

static fun fromBundle(bundle: Bundle!): MediaRouteDescriptor!

Creates an instance from a bundle.

Parameters
bundle Bundle!: The bundle, or null if none.
Return
MediaRouteDescriptor!: The new instance, or null if the bundle was null.