# RemotePlaybackClient

# RemotePlaybackClient

Artifact: [androidx.mediarouter:mediarouter](https://developer.android.com/jetpack/androidx/releases/mediarouter)  
[View Source](https://cs.android.com/search?q=file:androidx/mediarouter/media/RemotePlaybackClient.java+class:androidx.mediarouter.media.RemotePlaybackClient)  
Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/mediarouter#1.1.0)

*** ** * ** ***

Kotlin \|[Java](https://developer.android.com/reference/androidx/mediarouter/media/RemotePlaybackClient "View this page in Java")


```
class RemotePlaybackClient
```

<br />

*** ** * ** ***

A helper class for playing media on remote routes using the remote playback protocol defined by [MediaControlIntent](https://developer.android.com/reference/kotlin/androidx/mediarouter/media/MediaControlIntent).

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

## Summary

|                                                                                                                                                                                               ### Nested types                                                                                                                                                                                               |
|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `abstract class `[RemotePlaybackClient.ActionCallback](https://developer.android.com/reference/kotlin/androidx/mediarouter/media/RemotePlaybackClient.ActionCallback) Base callback type for remote playback requests.                                                                                                                                                                                       |
| `abstract class `[RemotePlaybackClient.ItemActionCallback](https://developer.android.com/reference/kotlin/androidx/mediarouter/media/RemotePlaybackClient.ItemActionCallback)` : `[RemotePlaybackClient.ActionCallback](https://developer.android.com/reference/kotlin/androidx/mediarouter/media/RemotePlaybackClient.ActionCallback) Callback for remote playback requests that operate on items.          |
| `interface `[RemotePlaybackClient.OnMessageReceivedListener](https://developer.android.com/reference/kotlin/androidx/mediarouter/media/RemotePlaybackClient.OnMessageReceivedListener) A callback that will receive messages from media sessions.                                                                                                                                                            |
| `abstract class `[RemotePlaybackClient.SessionActionCallback](https://developer.android.com/reference/kotlin/androidx/mediarouter/media/RemotePlaybackClient.SessionActionCallback)` : `[RemotePlaybackClient.ActionCallback](https://developer.android.com/reference/kotlin/androidx/mediarouter/media/RemotePlaybackClient.ActionCallback) Callback for remote playback requests that operate on sessions. |
| `abstract class `[RemotePlaybackClient.StatusCallback](https://developer.android.com/reference/kotlin/androidx/mediarouter/media/RemotePlaybackClient.StatusCallback) A callback that will receive media status updates.                                                                                                                                                                                     |

|                                                                                                                                                                                                                                       ### Public constructors                                                                                                                                                                                                                                        |
|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| [RemotePlaybackClient](https://developer.android.com/reference/kotlin/androidx/mediarouter/media/RemotePlaybackClient#RemotePlaybackClient(android.content.Context,androidx.mediarouter.media.MediaRouter.RouteInfo))`(context: `[Context](https://developer.android.com/reference/android/content/Context.html)`, route: `[MediaRouter.RouteInfo](https://developer.android.com/reference/kotlin/androidx/mediarouter/media/MediaRouter.RouteInfo)`)` Creates a remote playback client for a route. |

|                                 ### Public functions                                 |
|--------------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| [Unit](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html)        | [endSession](https://developer.android.com/reference/kotlin/androidx/mediarouter/media/RemotePlaybackClient#endSession(android.os.Bundle,androidx.mediarouter.media.RemotePlaybackClient.SessionActionCallback))`(` ` extras: `[Bundle](https://developer.android.com/reference/android/os/Bundle.html)`?,` ` callback: `[RemotePlaybackClient.SessionActionCallback](https://developer.android.com/reference/kotlin/androidx/mediarouter/media/RemotePlaybackClient.SessionActionCallback)`?` `)` Sends a request to end the media playback session.                                                                                                                                                                                                                                                                                                                                                                                                                       |
| [Unit](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html)        | [enqueue](https://developer.android.com/reference/kotlin/androidx/mediarouter/media/RemotePlaybackClient#enqueue(android.net.Uri,java.lang.String,android.os.Bundle,long,android.os.Bundle,androidx.mediarouter.media.RemotePlaybackClient.ItemActionCallback))`(` ` contentUri: `[Uri](https://developer.android.com/reference/android/net/Uri.html)`,` ` mimeType: `[String](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html)`?,` ` metadata: `[Bundle](https://developer.android.com/reference/android/os/Bundle.html)`?,` ` positionMillis: `[Long](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html)`,` ` extras: `[Bundle](https://developer.android.com/reference/android/os/Bundle.html)`?,` ` callback: `[RemotePlaybackClient.ItemActionCallback](https://developer.android.com/reference/kotlin/androidx/mediarouter/media/RemotePlaybackClient.ItemActionCallback)`?` `)` Sends a request to enqueue a media item. |
| [String](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html)`?` | [getSessionId](https://developer.android.com/reference/kotlin/androidx/mediarouter/media/RemotePlaybackClient#getSessionId())`()` Gets the current session id if there is one.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              |
| [Unit](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html)        | [getSessionStatus](https://developer.android.com/reference/kotlin/androidx/mediarouter/media/RemotePlaybackClient#getSessionStatus(android.os.Bundle,androidx.mediarouter.media.RemotePlaybackClient.SessionActionCallback))`(` ` extras: `[Bundle](https://developer.android.com/reference/android/os/Bundle.html)`?,` ` callback: `[RemotePlaybackClient.SessionActionCallback](https://developer.android.com/reference/kotlin/androidx/mediarouter/media/RemotePlaybackClient.SessionActionCallback)`?` `)` Sends a request to get the status of the media playback session.                                                                                                                                                                                                                                                                                                                                                                                             |
| [Unit](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html)        | [getStatus](https://developer.android.com/reference/kotlin/androidx/mediarouter/media/RemotePlaybackClient#getStatus(java.lang.String,android.os.Bundle,androidx.mediarouter.media.RemotePlaybackClient.ItemActionCallback))`(` ` itemId: `[String](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html)`,` ` extras: `[Bundle](https://developer.android.com/reference/android/os/Bundle.html)`?,` ` callback: `[RemotePlaybackClient.ItemActionCallback](https://developer.android.com/reference/kotlin/androidx/mediarouter/media/RemotePlaybackClient.ItemActionCallback)`?` `)` Sends a request to get the status of a media item.                                                                                                                                                                                                                                                                                                                 |
| [Boolean](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html)  | [hasSession](https://developer.android.com/reference/kotlin/androidx/mediarouter/media/RemotePlaybackClient#hasSession())`()` Returns true if the client currently has a session.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           |
| [Boolean](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html)  | [isMessagingSupported](https://developer.android.com/reference/kotlin/androidx/mediarouter/media/RemotePlaybackClient#isMessagingSupported())`()` Returns true if the route supports messages.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              |
| [Boolean](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html)  | [isQueuingSupported](https://developer.android.com/reference/kotlin/androidx/mediarouter/media/RemotePlaybackClient#isQueuingSupported())`()` Returns true if the route supports queuing features.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          |
| [Boolean](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html)  | [isRemotePlaybackSupported](https://developer.android.com/reference/kotlin/androidx/mediarouter/media/RemotePlaybackClient#isRemotePlaybackSupported())`()` Returns true if the route supports remote playback.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             |
| [Boolean](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html)  | [isSessionManagementSupported](https://developer.android.com/reference/kotlin/androidx/mediarouter/media/RemotePlaybackClient#isSessionManagementSupported())`()` Returns true if the route supports session management features.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           |
| [Unit](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html)        | [pause](https://developer.android.com/reference/kotlin/androidx/mediarouter/media/RemotePlaybackClient#pause(android.os.Bundle,androidx.mediarouter.media.RemotePlaybackClient.SessionActionCallback))`(` ` extras: `[Bundle](https://developer.android.com/reference/android/os/Bundle.html)`?,` ` callback: `[RemotePlaybackClient.SessionActionCallback](https://developer.android.com/reference/kotlin/androidx/mediarouter/media/RemotePlaybackClient.SessionActionCallback)`?` `)` Sends a request to pause media playback.                                                                                                                                                                                                                                                                                                                                                                                                                                           |
| [Unit](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html)        | [play](https://developer.android.com/reference/kotlin/androidx/mediarouter/media/RemotePlaybackClient#play(android.net.Uri,java.lang.String,android.os.Bundle,long,android.os.Bundle,androidx.mediarouter.media.RemotePlaybackClient.ItemActionCallback))`(` ` contentUri: `[Uri](https://developer.android.com/reference/android/net/Uri.html)`,` ` mimeType: `[String](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html)`?,` ` metadata: `[Bundle](https://developer.android.com/reference/android/os/Bundle.html)`?,` ` positionMillis: `[Long](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html)`,` ` extras: `[Bundle](https://developer.android.com/reference/android/os/Bundle.html)`?,` ` callback: `[RemotePlaybackClient.ItemActionCallback](https://developer.android.com/reference/kotlin/androidx/mediarouter/media/RemotePlaybackClient.ItemActionCallback)`?` `)` Sends a request to play a media item.          |
| [Unit](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html)        | [release](https://developer.android.com/reference/kotlin/androidx/mediarouter/media/RemotePlaybackClient#release())`()` Releases resources owned by the client.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             |
| [Unit](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html)        | [remove](https://developer.android.com/reference/kotlin/androidx/mediarouter/media/RemotePlaybackClient#remove(java.lang.String,android.os.Bundle,androidx.mediarouter.media.RemotePlaybackClient.ItemActionCallback))`(` ` itemId: `[String](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html)`,` ` extras: `[Bundle](https://developer.android.com/reference/android/os/Bundle.html)`?,` ` callback: `[RemotePlaybackClient.ItemActionCallback](https://developer.android.com/reference/kotlin/androidx/mediarouter/media/RemotePlaybackClient.ItemActionCallback)`?` `)` Sends a request to remove a media item from the queue.                                                                                                                                                                                                                                                                                                                   |
| [Unit](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html)        | [resume](https://developer.android.com/reference/kotlin/androidx/mediarouter/media/RemotePlaybackClient#resume(android.os.Bundle,androidx.mediarouter.media.RemotePlaybackClient.SessionActionCallback))`(` ` extras: `[Bundle](https://developer.android.com/reference/android/os/Bundle.html)`?,` ` callback: `[RemotePlaybackClient.SessionActionCallback](https://developer.android.com/reference/kotlin/androidx/mediarouter/media/RemotePlaybackClient.SessionActionCallback)`?` `)` Sends a request to resume (unpause) media playback.                                                                                                                                                                                                                                                                                                                                                                                                                              |
| [Unit](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html)        | [seek](https://developer.android.com/reference/kotlin/androidx/mediarouter/media/RemotePlaybackClient#seek(java.lang.String,long,android.os.Bundle,androidx.mediarouter.media.RemotePlaybackClient.ItemActionCallback))`(` ` itemId: `[String](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html)`,` ` positionMillis: `[Long](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html)`,` ` extras: `[Bundle](https://developer.android.com/reference/android/os/Bundle.html)`?,` ` callback: `[RemotePlaybackClient.ItemActionCallback](https://developer.android.com/reference/kotlin/androidx/mediarouter/media/RemotePlaybackClient.ItemActionCallback)`?` `)` Sends a request to seek to a new position in a media item.                                                                                                                                                                                                          |
| [Unit](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html)        | [sendMessage](https://developer.android.com/reference/kotlin/androidx/mediarouter/media/RemotePlaybackClient#sendMessage(android.os.Bundle,androidx.mediarouter.media.RemotePlaybackClient.SessionActionCallback))`(` ` message: `[Bundle](https://developer.android.com/reference/android/os/Bundle.html)`?,` ` callback: `[RemotePlaybackClient.SessionActionCallback](https://developer.android.com/reference/kotlin/androidx/mediarouter/media/RemotePlaybackClient.SessionActionCallback)`?` `)` Sends a message.                                                                                                                                                                                                                                                                                                                                                                                                                                                      |
| [Unit](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html)        | [setOnMessageReceivedListener](https://developer.android.com/reference/kotlin/androidx/mediarouter/media/RemotePlaybackClient#setOnMessageReceivedListener(androidx.mediarouter.media.RemotePlaybackClient.OnMessageReceivedListener))`(` ` listener: `[RemotePlaybackClient.OnMessageReceivedListener](https://developer.android.com/reference/kotlin/androidx/mediarouter/media/RemotePlaybackClient.OnMessageReceivedListener)`?` `)` 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.                                                                                                                                                                                                                                                                                                                                                                            |
| [Unit](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html)        | [setSessionId](https://developer.android.com/reference/kotlin/androidx/mediarouter/media/RemotePlaybackClient#setSessionId(java.lang.String))`(sessionId: `[String](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html)`?)` Sets the current session id.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               |
| [Unit](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html)        | [setStatusCallback](https://developer.android.com/reference/kotlin/androidx/mediarouter/media/RemotePlaybackClient#setStatusCallback(androidx.mediarouter.media.RemotePlaybackClient.StatusCallback))`(callback: `[RemotePlaybackClient.StatusCallback](https://developer.android.com/reference/kotlin/androidx/mediarouter/media/RemotePlaybackClient.StatusCallback)`?)` 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.                                                                                                                                                                                                                                                                                                                                                                                                                               |
| [Unit](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html)        | [startSession](https://developer.android.com/reference/kotlin/androidx/mediarouter/media/RemotePlaybackClient#startSession(android.os.Bundle,androidx.mediarouter.media.RemotePlaybackClient.SessionActionCallback))`(` ` extras: `[Bundle](https://developer.android.com/reference/android/os/Bundle.html)`?,` ` callback: `[RemotePlaybackClient.SessionActionCallback](https://developer.android.com/reference/kotlin/androidx/mediarouter/media/RemotePlaybackClient.SessionActionCallback)`?` `)` Sends a request to start a new media playback session.                                                                                                                                                                                                                                                                                                                                                                                                               |
| [Unit](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html)        | [stop](https://developer.android.com/reference/kotlin/androidx/mediarouter/media/RemotePlaybackClient#stop(android.os.Bundle,androidx.mediarouter.media.RemotePlaybackClient.SessionActionCallback))`(` ` extras: `[Bundle](https://developer.android.com/reference/android/os/Bundle.html)`?,` ` callback: `[RemotePlaybackClient.SessionActionCallback](https://developer.android.com/reference/kotlin/androidx/mediarouter/media/RemotePlaybackClient.SessionActionCallback)`?` `)` Sends a request to stop media playback and clear the media playback queue.                                                                                                                                                                                                                                                                                                                                                                                                           |

## Public constructors

### RemotePlaybackClient

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/mediarouter#1.1.0)  

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

Creates a remote playback client for a route.  

|                                                            Parameters                                                             |
|-----------------------------------------------------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------|
| `context: `[Context](https://developer.android.com/reference/android/content/Context.html)                                        | The [Context](https://developer.android.com/reference/android/content/Context.html). |
| `route: `[MediaRouter.RouteInfo](https://developer.android.com/reference/kotlin/androidx/mediarouter/media/MediaRouter.RouteInfo) | The media route.                                                                     |

## Public functions

### endSession

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/mediarouter#1.1.0)  

```
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](https://developer.android.com/reference/kotlin/androidx/mediarouter/media/RemotePlaybackClient#getSessionId()) will be set to null after the callback is invoked.

Please refer to [ACTION_END_SESSION](https://developer.android.com/reference/kotlin/androidx/mediarouter/media/MediaControlIntent#ACTION_END_SESSION()) for more information about the semantics of this request.  

|                                                                                    Parameters                                                                                     |
|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `extras: `[Bundle](https://developer.android.com/reference/android/os/Bundle.html)`?`                                                                                             | A bundle of extra arguments to be added to the [ACTION_END_SESSION](https://developer.android.com/reference/kotlin/androidx/mediarouter/media/MediaControlIntent#ACTION_END_SESSION()) intent, or null if none. |
| `callback: `[RemotePlaybackClient.SessionActionCallback](https://developer.android.com/reference/kotlin/androidx/mediarouter/media/RemotePlaybackClient.SessionActionCallback)`?` | A callback to invoke when the request has been processed, or null if none.                                                                                                                                      |

|                                                             Throws                                                              |
|---------------------------------------------------------------------------------------------------------------------------------|---------------------------------------------------|
| [java.lang.IllegalStateException](https://developer.android.com/reference/java/lang/IllegalStateException.html)                 | if there is no current session.                   |
| [java.lang.UnsupportedOperationException](https://developer.android.com/reference/java/lang/UnsupportedOperationException.html) | if the route does not support session management. |

|                                                                           See also                                                                            |
|---------------------------------------------------------------------------------------------------------------------------------------------------------------|---|
| [ACTION_END_SESSION](https://developer.android.com/reference/kotlin/androidx/mediarouter/media/MediaControlIntent#ACTION_END_SESSION())                       |   |
| [isRemotePlaybackSupported](https://developer.android.com/reference/kotlin/androidx/mediarouter/media/RemotePlaybackClient#isRemotePlaybackSupported())       |   |
| [isSessionManagementSupported](https://developer.android.com/reference/kotlin/androidx/mediarouter/media/RemotePlaybackClient#isSessionManagementSupported()) |   |

### enqueue

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/mediarouter#1.1.0)  

```
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 current session. If no session is available, then one is created implicitly.

Please refer to [ACTION_ENQUEUE](https://developer.android.com/reference/kotlin/androidx/mediarouter/media/MediaControlIntent#ACTION_ENQUEUE()) for more information about the semantics of this request.  

|                                                                                 Parameters                                                                                  |
|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `contentUri: `[Uri](https://developer.android.com/reference/android/net/Uri.html)                                                                                           | The content Uri to enqueue.                                                                                                                                                                             |
| `mimeType: `[String](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html)`?`                                                                            | The mime type of the content, or null if unknown.                                                                                                                                                       |
| `metadata: `[Bundle](https://developer.android.com/reference/android/os/Bundle.html)`?`                                                                                     | The media item metadata bundle, or null if none.                                                                                                                                                        |
| `positionMillis: `[Long](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html)                                                                             | The initial content position for the item in milliseconds, or `0` to start at the beginning.                                                                                                            |
| `extras: `[Bundle](https://developer.android.com/reference/android/os/Bundle.html)`?`                                                                                       | A bundle of extra arguments to be added to the [ACTION_ENQUEUE](https://developer.android.com/reference/kotlin/androidx/mediarouter/media/MediaControlIntent#ACTION_ENQUEUE()) intent, or null if none. |
| `callback: `[RemotePlaybackClient.ItemActionCallback](https://developer.android.com/reference/kotlin/androidx/mediarouter/media/RemotePlaybackClient.ItemActionCallback)`?` | A callback to invoke when the request has been processed, or null if none.                                                                                                                              |

|                                                             Throws                                                              |
|---------------------------------------------------------------------------------------------------------------------------------|----------------------------------------|
| [java.lang.UnsupportedOperationException](https://developer.android.com/reference/java/lang/UnsupportedOperationException.html) | if the route does not support queuing. |

|                                                                        See also                                                                         |
|---------------------------------------------------------------------------------------------------------------------------------------------------------|---|
| [ACTION_ENQUEUE](https://developer.android.com/reference/kotlin/androidx/mediarouter/media/MediaControlIntent#ACTION_ENQUEUE())                         |   |
| [isRemotePlaybackSupported](https://developer.android.com/reference/kotlin/androidx/mediarouter/media/RemotePlaybackClient#isRemotePlaybackSupported()) |   |
| [isQueuingSupported](https://developer.android.com/reference/kotlin/androidx/mediarouter/media/RemotePlaybackClient#isQueuingSupported())               |   |

### getSessionId

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/mediarouter#1.1.0)  

```
fun getSessionId(): String?
```

Gets the current session id if there is one.  

|                                       Returns                                        |
|--------------------------------------------------------------------------------------|------------------------------------------|
| [String](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html)`?` | The current session id, or null if none. |

### getSessionStatus

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/mediarouter#1.1.0)  

```
fun getSessionStatus(
    extras: Bundle?,
    callback: RemotePlaybackClient.SessionActionCallback?
): Unit
```

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

The request is issued in the current session.

Please refer to [ACTION_GET_SESSION_STATUS](https://developer.android.com/reference/kotlin/androidx/mediarouter/media/MediaControlIntent#ACTION_GET_SESSION_STATUS()) for more information about the semantics of this request.  

|                                                                                    Parameters                                                                                     |
|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `extras: `[Bundle](https://developer.android.com/reference/android/os/Bundle.html)`?`                                                                                             | A bundle of extra arguments to be added to the [ACTION_GET_SESSION_STATUS](https://developer.android.com/reference/kotlin/androidx/mediarouter/media/MediaControlIntent#ACTION_GET_SESSION_STATUS()) intent, or null if none. |
| `callback: `[RemotePlaybackClient.SessionActionCallback](https://developer.android.com/reference/kotlin/androidx/mediarouter/media/RemotePlaybackClient.SessionActionCallback)`?` | A callback to invoke when the request has been processed, or null if none.                                                                                                                                                    |

|                                                             Throws                                                              |
|---------------------------------------------------------------------------------------------------------------------------------|---------------------------------------------------|
| [java.lang.IllegalStateException](https://developer.android.com/reference/java/lang/IllegalStateException.html)                 | if there is no current session.                   |
| [java.lang.UnsupportedOperationException](https://developer.android.com/reference/java/lang/UnsupportedOperationException.html) | if the route does not support session management. |

|                                                                           See also                                                                            |
|---------------------------------------------------------------------------------------------------------------------------------------------------------------|---|
| [ACTION_GET_SESSION_STATUS](https://developer.android.com/reference/kotlin/androidx/mediarouter/media/MediaControlIntent#ACTION_GET_SESSION_STATUS())         |   |
| [isRemotePlaybackSupported](https://developer.android.com/reference/kotlin/androidx/mediarouter/media/RemotePlaybackClient#isRemotePlaybackSupported())       |   |
| [isSessionManagementSupported](https://developer.android.com/reference/kotlin/androidx/mediarouter/media/RemotePlaybackClient#isSessionManagementSupported()) |   |

### getStatus

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/mediarouter#1.1.0)  

```
fun getStatus(
    itemId: String,
    extras: Bundle?,
    callback: RemotePlaybackClient.ItemActionCallback?
): Unit
```

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

The request is issued in the current session.

Please refer to [ACTION_GET_STATUS](https://developer.android.com/reference/kotlin/androidx/mediarouter/media/MediaControlIntent#ACTION_GET_STATUS()) for more information about the semantics of this request.  

|                                                                                 Parameters                                                                                  |
|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `itemId: `[String](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html)                                                                                 | The item id.                                                                                                                                                                                                  |
| `extras: `[Bundle](https://developer.android.com/reference/android/os/Bundle.html)`?`                                                                                       | A bundle of extra arguments to be added to the [ACTION_GET_STATUS](https://developer.android.com/reference/kotlin/androidx/mediarouter/media/MediaControlIntent#ACTION_GET_STATUS()) intent, or null if none. |
| `callback: `[RemotePlaybackClient.ItemActionCallback](https://developer.android.com/reference/kotlin/androidx/mediarouter/media/RemotePlaybackClient.ItemActionCallback)`?` | A callback to invoke when the request has been processed, or null if none.                                                                                                                                    |

|                                                     Throws                                                      |
|-----------------------------------------------------------------------------------------------------------------|---------------------------------|
| [java.lang.IllegalStateException](https://developer.android.com/reference/java/lang/IllegalStateException.html) | if there is no current session. |

|                                                                        See also                                                                         |
|---------------------------------------------------------------------------------------------------------------------------------------------------------|---|
| [ACTION_GET_STATUS](https://developer.android.com/reference/kotlin/androidx/mediarouter/media/MediaControlIntent#ACTION_GET_STATUS())                   |   |
| [isRemotePlaybackSupported](https://developer.android.com/reference/kotlin/androidx/mediarouter/media/RemotePlaybackClient#isRemotePlaybackSupported()) |   |

### hasSession

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/mediarouter#1.1.0)  

```
fun hasSession(): Boolean
```

Returns true if the client currently has a session.

Equivalent to checking whether [getSessionId](https://developer.android.com/reference/kotlin/androidx/mediarouter/media/RemotePlaybackClient#getSessionId()) returns a non-null result.  

|                                       Returns                                       |
|-------------------------------------------------------------------------------------|-------------------------------------|
| [Boolean](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html) | True if there is a current session. |

### isMessagingSupported

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/mediarouter#1.1.0)  

```
fun isMessagingSupported(): Boolean
```

Returns true if the route supports messages.

This method returns true if the route supports all of the basic remote playback actions and all of the following actions: [start session](https://developer.android.com/reference/kotlin/androidx/mediarouter/media/MediaControlIntent#ACTION_START_SESSION()), [send message](https://developer.android.com/reference/kotlin/androidx/mediarouter/media/MediaControlIntent#ACTION_SEND_MESSAGE()), [end session](https://developer.android.com/reference/kotlin/androidx/mediarouter/media/MediaControlIntent#ACTION_END_SESSION()).  

|                                       Returns                                       |
|-------------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| [Boolean](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html) | True if session management is supported. Implies [isRemotePlaybackSupported](https://developer.android.com/reference/kotlin/androidx/mediarouter/media/RemotePlaybackClient#isRemotePlaybackSupported()) is also true. |

|                                                                        See also                                                                         |
|---------------------------------------------------------------------------------------------------------------------------------------------------------|---|
| [isRemotePlaybackSupported](https://developer.android.com/reference/kotlin/androidx/mediarouter/media/RemotePlaybackClient#isRemotePlaybackSupported()) |   |

### isQueuingSupported

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/mediarouter#1.1.0)  

```
fun isQueuingSupported(): Boolean
```

Returns true if the route supports queuing features.

If the route does not support queuing, then at most one media item can be played at a time and the [enqueue](https://developer.android.com/reference/kotlin/androidx/mediarouter/media/RemotePlaybackClient#enqueue(android.net.Uri,java.lang.String,android.os.Bundle,long,android.os.Bundle,androidx.mediarouter.media.RemotePlaybackClient.ItemActionCallback)) method will not be available.

This method returns true if the route supports all of the basic remote playback actions and all of the following actions: [enqueue](https://developer.android.com/reference/kotlin/androidx/mediarouter/media/MediaControlIntent#ACTION_ENQUEUE()), [remove](https://developer.android.com/reference/kotlin/androidx/mediarouter/media/MediaControlIntent#ACTION_REMOVE()).  

|                                       Returns                                       |
|-------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| [Boolean](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html) | True if queuing is supported. Implies [isRemotePlaybackSupported](https://developer.android.com/reference/kotlin/androidx/mediarouter/media/RemotePlaybackClient#isRemotePlaybackSupported()) is also true. |

|                                                                        See also                                                                         |
|---------------------------------------------------------------------------------------------------------------------------------------------------------|---|
| [isRemotePlaybackSupported](https://developer.android.com/reference/kotlin/androidx/mediarouter/media/RemotePlaybackClient#isRemotePlaybackSupported()) |   |

### isRemotePlaybackSupported

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/mediarouter#1.1.0)  

```
fun isRemotePlaybackSupported(): Boolean
```

Returns true if the route supports remote playback.

If the route does not support remote playback, then none of the functionality offered by the client will be available.

This method returns true if the route supports all of the following actions: [play](https://developer.android.com/reference/kotlin/androidx/mediarouter/media/MediaControlIntent#ACTION_PLAY()), [seek](https://developer.android.com/reference/kotlin/androidx/mediarouter/media/MediaControlIntent#ACTION_SEEK()), [get status](https://developer.android.com/reference/kotlin/androidx/mediarouter/media/MediaControlIntent#ACTION_GET_STATUS()), [pause](https://developer.android.com/reference/kotlin/androidx/mediarouter/media/MediaControlIntent#ACTION_PAUSE()), [resume](https://developer.android.com/reference/kotlin/androidx/mediarouter/media/MediaControlIntent#ACTION_RESUME()), [stop](https://developer.android.com/reference/kotlin/androidx/mediarouter/media/MediaControlIntent#ACTION_STOP()).  

|                                       Returns                                       |
|-------------------------------------------------------------------------------------|---------------------------------------|
| [Boolean](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html) | True if remote playback is supported. |

### isSessionManagementSupported

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/mediarouter#1.1.0)  

```
fun isSessionManagementSupported(): Boolean
```

Returns true if the route supports session management features.

If the route does not support session management, then the session will not be created until the first media item is played.

This method returns true if the route supports all of the basic remote playback actions and all of the following actions: [start session](https://developer.android.com/reference/kotlin/androidx/mediarouter/media/MediaControlIntent#ACTION_START_SESSION()), [get session status](https://developer.android.com/reference/kotlin/androidx/mediarouter/media/MediaControlIntent#ACTION_GET_SESSION_STATUS()), [end session](https://developer.android.com/reference/kotlin/androidx/mediarouter/media/MediaControlIntent#ACTION_END_SESSION()).  

|                                       Returns                                       |
|-------------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| [Boolean](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html) | True if session management is supported. Implies [isRemotePlaybackSupported](https://developer.android.com/reference/kotlin/androidx/mediarouter/media/RemotePlaybackClient#isRemotePlaybackSupported()) is also true. |

|                                                                        See also                                                                         |
|---------------------------------------------------------------------------------------------------------------------------------------------------------|---|
| [isRemotePlaybackSupported](https://developer.android.com/reference/kotlin/androidx/mediarouter/media/RemotePlaybackClient#isRemotePlaybackSupported()) |   |

### pause

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/mediarouter#1.1.0)  

```
fun pause(
    extras: Bundle?,
    callback: RemotePlaybackClient.SessionActionCallback?
): Unit
```

Sends a request to pause media playback.

The request is issued in the current session. If playback is already paused then the request has no effect.

Please refer to [ACTION_PAUSE](https://developer.android.com/reference/kotlin/androidx/mediarouter/media/MediaControlIntent#ACTION_PAUSE()) for more information about the semantics of this request.  

|                                                                                    Parameters                                                                                     |
|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `extras: `[Bundle](https://developer.android.com/reference/android/os/Bundle.html)`?`                                                                                             | A bundle of extra arguments to be added to the [ACTION_PAUSE](https://developer.android.com/reference/kotlin/androidx/mediarouter/media/MediaControlIntent#ACTION_PAUSE()) intent, or null if none. |
| `callback: `[RemotePlaybackClient.SessionActionCallback](https://developer.android.com/reference/kotlin/androidx/mediarouter/media/RemotePlaybackClient.SessionActionCallback)`?` | A callback to invoke when the request has been processed, or null if none.                                                                                                                          |

|                                                     Throws                                                      |
|-----------------------------------------------------------------------------------------------------------------|---------------------------------|
| [java.lang.IllegalStateException](https://developer.android.com/reference/java/lang/IllegalStateException.html) | if there is no current session. |

|                                                                        See also                                                                         |
|---------------------------------------------------------------------------------------------------------------------------------------------------------|---|
| [ACTION_PAUSE](https://developer.android.com/reference/kotlin/androidx/mediarouter/media/MediaControlIntent#ACTION_PAUSE())                             |   |
| [isRemotePlaybackSupported](https://developer.android.com/reference/kotlin/androidx/mediarouter/media/RemotePlaybackClient#isRemotePlaybackSupported()) |   |

### play

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/mediarouter#1.1.0)  

```
fun play(
    contentUri: Uri,
    mimeType: String?,
    metadata: Bundle?,
    positionMillis: Long,
    extras: Bundle?,
    callback: RemotePlaybackClient.ItemActionCallback?
): Unit
```

Sends a request to play a media item.

Clears the queue and starts playing the new item immediately. If the queue was previously paused, then it is resumed as a side-effect of this request.

The request is issued in the current session. If no session is available, then one is created implicitly.

Please refer to [ACTION_PLAY](https://developer.android.com/reference/kotlin/androidx/mediarouter/media/MediaControlIntent#ACTION_PLAY()) for more information about the semantics of this request.  

|                                                                                 Parameters                                                                                  |
|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `contentUri: `[Uri](https://developer.android.com/reference/android/net/Uri.html)                                                                                           | The content Uri to play.                                                                                                                                                                          |
| `mimeType: `[String](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html)`?`                                                                            | The mime type of the content, or null if unknown.                                                                                                                                                 |
| `metadata: `[Bundle](https://developer.android.com/reference/android/os/Bundle.html)`?`                                                                                     | The media item metadata bundle, or null if none.                                                                                                                                                  |
| `positionMillis: `[Long](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html)                                                                             | The initial content position for the item in milliseconds, or `0` to start at the beginning.                                                                                                      |
| `extras: `[Bundle](https://developer.android.com/reference/android/os/Bundle.html)`?`                                                                                       | A bundle of extra arguments to be added to the [ACTION_PLAY](https://developer.android.com/reference/kotlin/androidx/mediarouter/media/MediaControlIntent#ACTION_PLAY()) intent, or null if none. |
| `callback: `[RemotePlaybackClient.ItemActionCallback](https://developer.android.com/reference/kotlin/androidx/mediarouter/media/RemotePlaybackClient.ItemActionCallback)`?` | A callback to invoke when the request has been processed, or null if none.                                                                                                                        |

|                                                             Throws                                                              |
|---------------------------------------------------------------------------------------------------------------------------------|------------------------------------------------|
| [java.lang.UnsupportedOperationException](https://developer.android.com/reference/java/lang/UnsupportedOperationException.html) | if the route does not support remote playback. |

|                                                                        See also                                                                         |
|---------------------------------------------------------------------------------------------------------------------------------------------------------|---|
| [ACTION_PLAY](https://developer.android.com/reference/kotlin/androidx/mediarouter/media/MediaControlIntent#ACTION_PLAY())                               |   |
| [isRemotePlaybackSupported](https://developer.android.com/reference/kotlin/androidx/mediarouter/media/RemotePlaybackClient#isRemotePlaybackSupported()) |   |

### release

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/mediarouter#1.1.0)  

```
fun release(): Unit
```

Releases resources owned by the client.  

### remove

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/mediarouter#1.1.0)  

```
fun remove(
    itemId: String,
    extras: Bundle?,
    callback: RemotePlaybackClient.ItemActionCallback?
): Unit
```

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

The request is issued in the current session.

Please refer to [ACTION_REMOVE](https://developer.android.com/reference/kotlin/androidx/mediarouter/media/MediaControlIntent#ACTION_REMOVE()) for more information about the semantics of this request.  

|                                                                                 Parameters                                                                                  |
|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `itemId: `[String](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html)                                                                                 | The item id.                                                                                                                                                                                          |
| `extras: `[Bundle](https://developer.android.com/reference/android/os/Bundle.html)`?`                                                                                       | A bundle of extra arguments to be added to the [ACTION_REMOVE](https://developer.android.com/reference/kotlin/androidx/mediarouter/media/MediaControlIntent#ACTION_REMOVE()) intent, or null if none. |
| `callback: `[RemotePlaybackClient.ItemActionCallback](https://developer.android.com/reference/kotlin/androidx/mediarouter/media/RemotePlaybackClient.ItemActionCallback)`?` | A callback to invoke when the request has been processed, or null if none.                                                                                                                            |

|                                                             Throws                                                              |
|---------------------------------------------------------------------------------------------------------------------------------|----------------------------------------|
| [java.lang.IllegalStateException](https://developer.android.com/reference/java/lang/IllegalStateException.html)                 | if there is no current session.        |
| [java.lang.UnsupportedOperationException](https://developer.android.com/reference/java/lang/UnsupportedOperationException.html) | if the route does not support queuing. |

|                                                                        See also                                                                         |
|---------------------------------------------------------------------------------------------------------------------------------------------------------|---|
| [ACTION_REMOVE](https://developer.android.com/reference/kotlin/androidx/mediarouter/media/MediaControlIntent#ACTION_REMOVE())                           |   |
| [isRemotePlaybackSupported](https://developer.android.com/reference/kotlin/androidx/mediarouter/media/RemotePlaybackClient#isRemotePlaybackSupported()) |   |
| [isQueuingSupported](https://developer.android.com/reference/kotlin/androidx/mediarouter/media/RemotePlaybackClient#isQueuingSupported())               |   |

### resume

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/mediarouter#1.1.0)  

```
fun resume(
    extras: Bundle?,
    callback: RemotePlaybackClient.SessionActionCallback?
): Unit
```

Sends a request to resume (unpause) media playback.

The request is issued in the current session. If playback is not paused then the request has no effect.

Please refer to [ACTION_RESUME](https://developer.android.com/reference/kotlin/androidx/mediarouter/media/MediaControlIntent#ACTION_RESUME()) for more information about the semantics of this request.  

|                                                                                    Parameters                                                                                     |
|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `extras: `[Bundle](https://developer.android.com/reference/android/os/Bundle.html)`?`                                                                                             | A bundle of extra arguments to be added to the [ACTION_RESUME](https://developer.android.com/reference/kotlin/androidx/mediarouter/media/MediaControlIntent#ACTION_RESUME()) intent, or null if none. |
| `callback: `[RemotePlaybackClient.SessionActionCallback](https://developer.android.com/reference/kotlin/androidx/mediarouter/media/RemotePlaybackClient.SessionActionCallback)`?` | A callback to invoke when the request has been processed, or null if none.                                                                                                                            |

|                                                     Throws                                                      |
|-----------------------------------------------------------------------------------------------------------------|---------------------------------|
| [java.lang.IllegalStateException](https://developer.android.com/reference/java/lang/IllegalStateException.html) | if there is no current session. |

|                                                                        See also                                                                         |
|---------------------------------------------------------------------------------------------------------------------------------------------------------|---|
| [ACTION_RESUME](https://developer.android.com/reference/kotlin/androidx/mediarouter/media/MediaControlIntent#ACTION_RESUME())                           |   |
| [isRemotePlaybackSupported](https://developer.android.com/reference/kotlin/androidx/mediarouter/media/RemotePlaybackClient#isRemotePlaybackSupported()) |   |

### seek

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/mediarouter#1.1.0)  

```
fun seek(
    itemId: String,
    positionMillis: Long,
    extras: Bundle?,
    callback: RemotePlaybackClient.ItemActionCallback?
): Unit
```

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

Seeks to a new position. If the queue was previously paused then it remains paused but the item's new position is still remembered.

The request is issued in the current session.

Please refer to [ACTION_SEEK](https://developer.android.com/reference/kotlin/androidx/mediarouter/media/MediaControlIntent#ACTION_SEEK()) for more information about the semantics of this request.  

|                                                                                 Parameters                                                                                  |
|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `itemId: `[String](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html)                                                                                 | The item id.                                                                                                                                                                                      |
| `positionMillis: `[Long](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html)                                                                             | The new content position for the item in milliseconds, or `0` to start at the beginning.                                                                                                          |
| `extras: `[Bundle](https://developer.android.com/reference/android/os/Bundle.html)`?`                                                                                       | A bundle of extra arguments to be added to the [ACTION_SEEK](https://developer.android.com/reference/kotlin/androidx/mediarouter/media/MediaControlIntent#ACTION_SEEK()) intent, or null if none. |
| `callback: `[RemotePlaybackClient.ItemActionCallback](https://developer.android.com/reference/kotlin/androidx/mediarouter/media/RemotePlaybackClient.ItemActionCallback)`?` | A callback to invoke when the request has been processed, or null if none.                                                                                                                        |

|                                                     Throws                                                      |
|-----------------------------------------------------------------------------------------------------------------|---------------------------------|
| [java.lang.IllegalStateException](https://developer.android.com/reference/java/lang/IllegalStateException.html) | if there is no current session. |

|                                                                        See also                                                                         |
|---------------------------------------------------------------------------------------------------------------------------------------------------------|---|
| [ACTION_SEEK](https://developer.android.com/reference/kotlin/androidx/mediarouter/media/MediaControlIntent#ACTION_SEEK())                               |   |
| [isRemotePlaybackSupported](https://developer.android.com/reference/kotlin/androidx/mediarouter/media/RemotePlaybackClient#isRemotePlaybackSupported()) |   |

### sendMessage

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/mediarouter#1.1.0)  

```
fun sendMessage(
    message: Bundle?,
    callback: RemotePlaybackClient.SessionActionCallback?
): Unit
```

Sends a message.

The request is issued in the current session.

Please refer to [ACTION_SEND_MESSAGE](https://developer.android.com/reference/kotlin/androidx/mediarouter/media/MediaControlIntent#ACTION_SEND_MESSAGE()) for more information about the semantics of this request.  

|                                                                                    Parameters                                                                                     |
|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------|
| `message: `[Bundle](https://developer.android.com/reference/android/os/Bundle.html)`?`                                                                                            | A bundle message denoting [EXTRA_MESSAGE](https://developer.android.com/reference/kotlin/androidx/mediarouter/media/MediaControlIntent#EXTRA_MESSAGE()). |
| `callback: `[RemotePlaybackClient.SessionActionCallback](https://developer.android.com/reference/kotlin/androidx/mediarouter/media/RemotePlaybackClient.SessionActionCallback)`?` | A callback to invoke when the request has been processed, or null if none.                                                                               |

|                                                             Throws                                                              |
|---------------------------------------------------------------------------------------------------------------------------------|-----------------------------------------|
| [java.lang.IllegalStateException](https://developer.android.com/reference/java/lang/IllegalStateException.html)                 | if there is no current session.         |
| [java.lang.UnsupportedOperationException](https://developer.android.com/reference/java/lang/UnsupportedOperationException.html) | if the route does not support messages. |

|                                                                   See also                                                                    |
|-----------------------------------------------------------------------------------------------------------------------------------------------|---|
| [ACTION_SEND_MESSAGE](https://developer.android.com/reference/kotlin/androidx/mediarouter/media/MediaControlIntent#ACTION_SEND_MESSAGE())     |   |
| [isMessagingSupported](https://developer.android.com/reference/kotlin/androidx/mediarouter/media/RemotePlaybackClient#isMessagingSupported()) |   |

### setOnMessageReceivedListener

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/mediarouter#1.1.0)  

```
fun setOnMessageReceivedListener(
    listener: RemotePlaybackClient.OnMessageReceivedListener?
): 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.

The callback should be set before the session is created.  

|                                                                                        Parameters                                                                                         |
|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|-------------------------------------------------------------------|
| `listener: `[RemotePlaybackClient.OnMessageReceivedListener](https://developer.android.com/reference/kotlin/androidx/mediarouter/media/RemotePlaybackClient.OnMessageReceivedListener)`?` | The callback to set. May be null to remove the previous callback. |

### setSessionId

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/mediarouter#1.1.0)  

```
fun setSessionId(sessionId: String?): Unit
```

Sets the current session id.

It is usually not necessary to set the session id explicitly since it is created as a side-effect of other requests such as [play](https://developer.android.com/reference/kotlin/androidx/mediarouter/media/RemotePlaybackClient#play(android.net.Uri,java.lang.String,android.os.Bundle,long,android.os.Bundle,androidx.mediarouter.media.RemotePlaybackClient.ItemActionCallback)), [enqueue](https://developer.android.com/reference/kotlin/androidx/mediarouter/media/RemotePlaybackClient#enqueue(android.net.Uri,java.lang.String,android.os.Bundle,long,android.os.Bundle,androidx.mediarouter.media.RemotePlaybackClient.ItemActionCallback)), and [startSession](https://developer.android.com/reference/kotlin/androidx/mediarouter/media/RemotePlaybackClient#startSession(android.os.Bundle,androidx.mediarouter.media.RemotePlaybackClient.SessionActionCallback)).  

|                                            Parameters                                             |
|---------------------------------------------------------------------------------------------------|--------------------------------------|
| `sessionId: `[String](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html)`?` | The new session id, or null if none. |

### setStatusCallback

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/mediarouter#1.1.0)  

```
fun setStatusCallback(callback: RemotePlaybackClient.StatusCallback?): 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.

The callback should be set before the session is created or any play commands are issued.  

|                                                                             Parameters                                                                              |
|---------------------------------------------------------------------------------------------------------------------------------------------------------------------|-------------------------------------------------------------------|
| `callback: `[RemotePlaybackClient.StatusCallback](https://developer.android.com/reference/kotlin/androidx/mediarouter/media/RemotePlaybackClient.StatusCallback)`?` | The callback to set. May be null to remove the previous callback. |

### startSession

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/mediarouter#1.1.0)  

```
fun startSession(
    extras: Bundle?,
    callback: RemotePlaybackClient.SessionActionCallback?
): Unit
```

Sends a request to start a new media playback session.

The application must wait for the callback to indicate that this request is complete before issuing other requests that affect the session. If this request is successful then the previous session will be invalidated.

Please refer to [ACTION_START_SESSION](https://developer.android.com/reference/kotlin/androidx/mediarouter/media/MediaControlIntent#ACTION_START_SESSION()) for more information about the semantics of this request.  

|                                                                                    Parameters                                                                                     |
|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `extras: `[Bundle](https://developer.android.com/reference/android/os/Bundle.html)`?`                                                                                             | A bundle of extra arguments to be added to the [ACTION_START_SESSION](https://developer.android.com/reference/kotlin/androidx/mediarouter/media/MediaControlIntent#ACTION_START_SESSION()) intent, or null if none. |
| `callback: `[RemotePlaybackClient.SessionActionCallback](https://developer.android.com/reference/kotlin/androidx/mediarouter/media/RemotePlaybackClient.SessionActionCallback)`?` | A callback to invoke when the request has been processed, or null if none.                                                                                                                                          |

|                                                             Throws                                                              |
|---------------------------------------------------------------------------------------------------------------------------------|---------------------------------------------------|
| [java.lang.UnsupportedOperationException](https://developer.android.com/reference/java/lang/UnsupportedOperationException.html) | if the route does not support session management. |

|                                                                           See also                                                                            |
|---------------------------------------------------------------------------------------------------------------------------------------------------------------|---|
| [ACTION_START_SESSION](https://developer.android.com/reference/kotlin/androidx/mediarouter/media/MediaControlIntent#ACTION_START_SESSION())                   |   |
| [isRemotePlaybackSupported](https://developer.android.com/reference/kotlin/androidx/mediarouter/media/RemotePlaybackClient#isRemotePlaybackSupported())       |   |
| [isSessionManagementSupported](https://developer.android.com/reference/kotlin/androidx/mediarouter/media/RemotePlaybackClient#isSessionManagementSupported()) |   |

### stop

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/mediarouter#1.1.0)  

```
fun stop(
    extras: Bundle?,
    callback: RemotePlaybackClient.SessionActionCallback?
): Unit
```

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

The request is issued in the current session. If the queue is already empty then the request has no effect.

Please refer to [ACTION_STOP](https://developer.android.com/reference/kotlin/androidx/mediarouter/media/MediaControlIntent#ACTION_STOP()) for more information about the semantics of this request.  

|                                                                                    Parameters                                                                                     |
|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `extras: `[Bundle](https://developer.android.com/reference/android/os/Bundle.html)`?`                                                                                             | A bundle of extra arguments to be added to the [ACTION_STOP](https://developer.android.com/reference/kotlin/androidx/mediarouter/media/MediaControlIntent#ACTION_STOP()) intent, or null if none. |
| `callback: `[RemotePlaybackClient.SessionActionCallback](https://developer.android.com/reference/kotlin/androidx/mediarouter/media/RemotePlaybackClient.SessionActionCallback)`?` | A callback to invoke when the request has been processed, or null if none.                                                                                                                        |

|                                                     Throws                                                      |
|-----------------------------------------------------------------------------------------------------------------|---------------------------------|
| [java.lang.IllegalStateException](https://developer.android.com/reference/java/lang/IllegalStateException.html) | if there is no current session. |

|                                                                        See also                                                                         |
|---------------------------------------------------------------------------------------------------------------------------------------------------------|---|
| [ACTION_STOP](https://developer.android.com/reference/kotlin/androidx/mediarouter/media/MediaControlIntent#ACTION_STOP())                               |   |
| [isRemotePlaybackSupported](https://developer.android.com/reference/kotlin/androidx/mediarouter/media/RemotePlaybackClient#isRemotePlaybackSupported()) |   |