MediaRouteProvider.DynamicGroupRouteController

public abstract class MediaRouteProvider.DynamicGroupRouteController extends MediaRouteProvider.RouteController


Provides control over a dynamic group route. A dynamic group route is a group of routes such that a route can be added or removed from the group by the user dynamically.

Summary

Nested types

Contains a route, its selection state and its capabilities.

Builder for DynamicRouteDescriptor

Public constructors

Public methods

@Nullable String

Gets the title of the groupable routes section which will be shown to the user.

@Nullable String

Gets the title of the transferable routes section which will be shown to the user.

final void

This method is deprecated.

Use notifyDynamicRoutesChanged instead to notify information of the group.

final void

Sets the group route descriptor and the dynamic route descriptors for the dynamic group.

abstract void

Called when a user adds a route into the casting session.

abstract void

Called when a user removes a route from casting session.

abstract void

Called when a user selects a new set of routes s/he wants the session to be played.

Inherited methods

From androidx.mediarouter.media.MediaRouteProvider.RouteController
boolean

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

void

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

void

Selects the route.

void
onSetVolume(int volume)

Requests to set the volume of the route.

void

This method is deprecated.

Use onUnselect instead.

void

Unselects the route and provides a reason.

void
onUpdateVolume(int delta)

Requests an incremental volume update for the route.

Public constructors

DynamicGroupRouteController

Added in 1.1.0
public DynamicGroupRouteController()

Public methods

getGroupableSelectionTitle

Added in 1.1.0
public @Nullable String getGroupableSelectionTitle()

Gets the title of the groupable routes section which will be shown to the user. It is provided by MediaRouteProvider. e.g. "Add a device."

getTransferableSectionTitle

Added in 1.1.0
public @Nullable String getTransferableSectionTitle()

Gets the title of the transferable routes section which will be shown to the user. It is provided by MediaRouteProvider. MediaRouteProvider. e.g. "Play on group."

notifyDynamicRoutesChanged

Added in 1.1.0
Deprecated in 1.2.0
public final void notifyDynamicRoutesChanged(
    @NonNull Collection<MediaRouteProvider.DynamicGroupRouteController.DynamicRouteDescriptor> routes
)

Sets the dynamic route descriptors for the dynamic group.

The dynamic group controller should call this method to notify the current dynamic group state.

Parameters
@NonNull Collection<MediaRouteProvider.DynamicGroupRouteController.DynamicRouteDescriptor> routes

The dynamic route descriptors for published routes. At least a selected or selecting route must be included.

notifyDynamicRoutesChanged

Added in 1.2.0
public final void notifyDynamicRoutesChanged(
    @NonNull MediaRouteDescriptor groupRoute,
    @NonNull Collection<MediaRouteProvider.DynamicGroupRouteController.DynamicRouteDescriptor> dynamicRoutes
)

Sets the group route descriptor and the dynamic route descriptors for the dynamic group.

The dynamic group controller should call this method to notify the current dynamic group state.

Parameters
@NonNull MediaRouteDescriptor groupRoute

The media route descriptor describing the dynamic group. The selected route of the media router will contain this information. If it is disabled, the media router will unselect the dynamic group and release the route controller.

@NonNull Collection<MediaRouteProvider.DynamicGroupRouteController.DynamicRouteDescriptor> dynamicRoutes

The dynamic route descriptors for published routes. At least a selected or selecting route should be included.

onAddMemberRoute

Added in 1.1.0
public abstract void onAddMemberRoute(@NonNull String routeId)

Called when a user adds a route into the casting session.

onRemoveMemberRoute

Added in 1.1.0
public abstract void onRemoveMemberRoute(@NonNull String routeId)

Called when a user removes a route from casting session.

onUpdateMemberRoutes

Added in 1.1.0
public abstract void onUpdateMemberRoutes(@Nullable List<String> routeIds)

Called when a user selects a new set of routes s/he wants the session to be played.