Google is committed to advancing racial equity for Black communities. See how.

RemotePlaybackClient

open class RemotePlaybackClient
kotlin.Any
   ↳ androidx.mediarouter.media.RemotePlaybackClient

A helper class for playing media on remote routes using the remote playback protocol defined by MediaControlIntent.

The client maintains session state and offers a simplified interface for issuing remote playback media control intents to a single route.

Summary

Nested classes
abstract

Base callback type for remote playback requests.

abstract

Callback for remote playback requests that operate on items.

abstract

A callback that will receive messages from media sessions.

abstract

Callback for remote playback requests that operate on sessions.

abstract

A callback that will receive media status updates.

Public constructors
<init>(context: Context!, route: MediaRouter.RouteInfo!)

Creates a remote playback client for a route.

Public methods
open Unit

Sends a request to end the media playback session.

open Unit
enqueue(contentUri: Uri!, mimeType: String!, metadata: Bundle!, positionMillis: Long, extras: Bundle!, callback: RemotePlaybackClient.ItemActionCallback!)

Sends a request to enqueue a media item.

open String!

Gets the current session id if there is one.

open Unit

Sends a request to get the status of the media playback session.

open Unit

Sends a request to get the status of a media item.

open Boolean

Returns true if the client currently has a session.

open Boolean

Returns true if the route supports messages.

open Boolean

Returns true if the route supports queuing features.

open Boolean

Returns true if the route supports remote playback.

open Boolean

Returns true if the route supports session management features.

open Unit

Sends a request to pause media playback.

open Unit
play(contentUri: Uri!, mimeType: String!, metadata: Bundle!, positionMillis: Long, extras: Bundle!, callback: RemotePlaybackClient.ItemActionCallback!)

Sends a request to play a media item.

open Unit

Releases resources owned by the client.

open Unit
remove(itemId: String!, extras: Bundle!, callback: RemotePlaybackClient.ItemActionCallback!)

Sends a request to remove a media item from the queue.

open Unit

Sends a request to resume (unpause) media playback.

open Unit
seek(itemId: String!, positionMillis: Long, extras: Bundle!, callback: RemotePlaybackClient.ItemActionCallback!)

Sends a request to seek to a new position in a media item.

open Unit

Sends a message.

open Unit

Sets a callback that should receive messages when a message is sent from media sessions created by this instance of the remote playback client changes.

open Unit
setSessionId(sessionId: String!)

Sets the current session id.

open Unit

Sets a callback that should receive status updates when the state of media sessions or media items created by this instance of the remote playback client changes.

open Unit

Sends a request to start a new media playback session.

open Unit

Sends a request to stop media playback and clear the media playback queue.

Public constructors

<init>

RemotePlaybackClient(
    context: Context!,
    route: MediaRouter.RouteInfo!)

Creates a remote playback client for a route.

Parameters
route MediaRouter.RouteInfo!: The media route.

Public methods

endSession

open fun endSession(
    extras: Bundle!,
    callback: RemotePlaybackClient.SessionActionCallback!
): Unit

Sends a request to end the media playback session.

The request is issued in the current session. If this request is successful, the session id property will be set to null after the callback is invoked.

Please refer to ACTION_END_SESSION for more information about the semantics of this request.

Parameters
extras Bundle!: A bundle of extra arguments to be added to the MediaControlIntent#ACTION_END_SESSION intent, or null if none.
callback RemotePlaybackClient.SessionActionCallback!: A callback to invoke when the request has been processed, or null if none.
Exceptions
IllegalStateException if there is no current session.
UnsupportedOperationException if the route does not support session management.

enqueue

open fun enqueue(
    contentUri: Uri!,
    mimeType: String!,
    metadata: Bundle!,
    positionMillis: Long,
    extras: Bundle!,
    callback: RemotePlaybackClient.ItemActionCallback!
): Unit

Sends a request to enqueue a media item.

Enqueues a new item to play. If the queue was previously paused, then will remain paused.

The request is issued in the curren