# PlaybackStateCompat

added in[version 22.1.0](https://developer.android.com/topic/libraries/support-library/revisions)  
belongs to Maven artifact com.android.support:support-media-compat:28.0.0-alpha1  
Summary:[Nested Classes](https://developer.android.com/reference/android/support/v4-media-session/PlaybackStateCompat#nestedclasses)\|[Constants](https://developer.android.com/reference/android/support/v4-media-session/PlaybackStateCompat#constants)\|[Inherited Constants](https://developer.android.com/reference/android/support/v4-media-session/PlaybackStateCompat#inhconstants)\|[Fields](https://developer.android.com/reference/android/support/v4-media-session/PlaybackStateCompat#lfields)\|[Methods](https://developer.android.com/reference/android/support/v4-media-session/PlaybackStateCompat#pubmethods)\|[Inherited Methods](https://developer.android.com/reference/android/support/v4-media-session/PlaybackStateCompat#inhmethods)\|[\[Expand All\]](https://developer.android.com/reference/android/support/v4-media-session/PlaybackStateCompat#)  

# PlaybackStateCompat

| This package is part of the Android[support library](https://developer.android.com/topic/libraries/support-library)which is no longer maintained. The support library has been superseded by[AndroidX](https://developer.android.com/jetpack/androidx)which is part of[Jetpack](https://developer.android.com/jetpack). We recommend using the AndroidX libraries in all new projects. You should also consider[migrating](https://developer.android.com/jetpack/androidx/migrate)existing projects to AndroidX. To find the AndroidX class that maps to this deprecated class, see the AndroidX support library[class mappings](https://developer.android.com/jetpack/androidx/migrate/class-mappings).

`
public

final

class
PlaybackStateCompat
`  
`

extends Object


``


implements

`[Parcelable](https://developer.android.com/reference/android/os/Parcelable.html)`


`

|---|------------------------------------------------------|
| java.lang.Object                                        ||
| ↳ | android.support.v4.media.session.PlaybackStateCompat |

<br />

*** ** * ** ***

Playback state for a[MediaSessionCompat](https://developer.android.com/reference/android/support/v4/media/session/MediaSessionCompat). This includes a state like[STATE_PLAYING](https://developer.android.com/reference/android/support/v4/media/session/PlaybackStateCompat#STATE_PLAYING), the current playback position, and the current control capabilities.

## Summary

|                                                                                                                                                                                                                                              ### Nested classes                                                                                                                                                                                                                                               ||
|----------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| ` class` | [PlaybackStateCompat.Builder](https://developer.android.com/reference/android/support/v4/media/session/PlaybackStateCompat.Builder) Builder for[PlaybackStateCompat](https://developer.android.com/reference/android/support/v4/media/session/PlaybackStateCompat)objects.                                                                                                                                                                                                                          |
| ` class` | [PlaybackStateCompat.CustomAction](https://developer.android.com/reference/android/support/v4/media/session/PlaybackStateCompat.CustomAction) [CustomActions](https://developer.android.com/reference/android/support/v4/media/session/PlaybackStateCompat.CustomAction)can be used to extend the capabilities of the standard transport controls by exposing app specific actions to[Controllers](https://developer.android.com/reference/android/support/v4/media/session/MediaControllerCompat). |

|                                                                                                                                                                                               ### Constants                                                                                                                                                                                               ||
|--------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `long` | [ACTION_FAST_FORWARD](https://developer.android.com/reference/android/support/v4/media/session/PlaybackStateCompat#ACTION_FAST_FORWARD) Indicates this session supports the fast forward command.                                                                                                                                                                                                 |
| `long` | [ACTION_PAUSE](https://developer.android.com/reference/android/support/v4/media/session/PlaybackStateCompat#ACTION_PAUSE) Indicates this session supports the pause command.                                                                                                                                                                                                                      |
| `long` | [ACTION_PLAY](https://developer.android.com/reference/android/support/v4/media/session/PlaybackStateCompat#ACTION_PLAY) Indicates this session supports the play command.                                                                                                                                                                                                                         |
| `long` | [ACTION_PLAY_FROM_MEDIA_ID](https://developer.android.com/reference/android/support/v4/media/session/PlaybackStateCompat#ACTION_PLAY_FROM_MEDIA_ID) Indicates this session supports the play from media id command.                                                                                                                                                                               |
| `long` | [ACTION_PLAY_FROM_SEARCH](https://developer.android.com/reference/android/support/v4/media/session/PlaybackStateCompat#ACTION_PLAY_FROM_SEARCH) Indicates this session supports the play from search command.                                                                                                                                                                                     |
| `long` | [ACTION_PLAY_FROM_URI](https://developer.android.com/reference/android/support/v4/media/session/PlaybackStateCompat#ACTION_PLAY_FROM_URI) Indicates this session supports the play from URI command.                                                                                                                                                                                              |
| `long` | [ACTION_PLAY_PAUSE](https://developer.android.com/reference/android/support/v4/media/session/PlaybackStateCompat#ACTION_PLAY_PAUSE) Indicates this session supports the play/pause toggle command.                                                                                                                                                                                                |
| `long` | [ACTION_PREPARE](https://developer.android.com/reference/android/support/v4/media/session/PlaybackStateCompat#ACTION_PREPARE) Indicates this session supports the prepare command.                                                                                                                                                                                                                |
| `long` | [ACTION_PREPARE_FROM_MEDIA_ID](https://developer.android.com/reference/android/support/v4/media/session/PlaybackStateCompat#ACTION_PREPARE_FROM_MEDIA_ID) Indicates this session supports the prepare from media id command.                                                                                                                                                                      |
| `long` | [ACTION_PREPARE_FROM_SEARCH](https://developer.android.com/reference/android/support/v4/media/session/PlaybackStateCompat#ACTION_PREPARE_FROM_SEARCH) Indicates this session supports the prepare from search command.                                                                                                                                                                            |
| `long` | [ACTION_PREPARE_FROM_URI](https://developer.android.com/reference/android/support/v4/media/session/PlaybackStateCompat#ACTION_PREPARE_FROM_URI) Indicates this session supports the prepare from URI command.                                                                                                                                                                                     |
| `long` | [ACTION_REWIND](https://developer.android.com/reference/android/support/v4/media/session/PlaybackStateCompat#ACTION_REWIND) Indicates this session supports the rewind command.                                                                                                                                                                                                                   |
| `long` | [ACTION_SEEK_TO](https://developer.android.com/reference/android/support/v4/media/session/PlaybackStateCompat#ACTION_SEEK_TO) Indicates this session supports the seek to command.                                                                                                                                                                                                                |
| `long` | [ACTION_SET_CAPTIONING_ENABLED](https://developer.android.com/reference/android/support/v4/media/session/PlaybackStateCompat#ACTION_SET_CAPTIONING_ENABLED) Indicates this session supports the set captioning enabled command.                                                                                                                                                                   |
| `long` | [ACTION_SET_RATING](https://developer.android.com/reference/android/support/v4/media/session/PlaybackStateCompat#ACTION_SET_RATING) Indicates this session supports the set rating command.                                                                                                                                                                                                       |
| `long` | [ACTION_SET_REPEAT_MODE](https://developer.android.com/reference/android/support/v4/media/session/PlaybackStateCompat#ACTION_SET_REPEAT_MODE) Indicates this session supports the set repeat mode command.                                                                                                                                                                                        |
| `long` | [ACTION_SET_SHUFFLE_MODE](https://developer.android.com/reference/android/support/v4/media/session/PlaybackStateCompat#ACTION_SET_SHUFFLE_MODE) Indicates this session supports the set shuffle mode command.                                                                                                                                                                                     |
| `long` | [ACTION_SET_SHUFFLE_MODE_ENABLED](https://developer.android.com/reference/android/support/v4/media/session/PlaybackStateCompat#ACTION_SET_SHUFFLE_MODE_ENABLED) *This constant was deprecated in API level 27.1.0. Use[ACTION_SET_SHUFFLE_MODE](https://developer.android.com/reference/android/support/v4/media/session/PlaybackStateCompat#ACTION_SET_SHUFFLE_MODE)instead.*                    |
| `long` | [ACTION_SKIP_TO_NEXT](https://developer.android.com/reference/android/support/v4/media/session/PlaybackStateCompat#ACTION_SKIP_TO_NEXT) Indicates this session supports the next command.                                                                                                                                                                                                         |
| `long` | [ACTION_SKIP_TO_PREVIOUS](https://developer.android.com/reference/android/support/v4/media/session/PlaybackStateCompat#ACTION_SKIP_TO_PREVIOUS) Indicates this session supports the previous command.                                                                                                                                                                                             |
| `long` | [ACTION_SKIP_TO_QUEUE_ITEM](https://developer.android.com/reference/android/support/v4/media/session/PlaybackStateCompat#ACTION_SKIP_TO_QUEUE_ITEM) Indicates this session supports the skip to queue item command.                                                                                                                                                                               |
| `long` | [ACTION_STOP](https://developer.android.com/reference/android/support/v4/media/session/PlaybackStateCompat#ACTION_STOP) Indicates this session supports the stop command.                                                                                                                                                                                                                         |
| `int`  | [ERROR_CODE_ACTION_ABORTED](https://developer.android.com/reference/android/support/v4/media/session/PlaybackStateCompat#ERROR_CODE_ACTION_ABORTED) Error code when the action is interrupted due to some external event.                                                                                                                                                                         |
| `int`  | [ERROR_CODE_APP_ERROR](https://developer.android.com/reference/android/support/v4/media/session/PlaybackStateCompat#ERROR_CODE_APP_ERROR) Error code when the application state is invalid to fulfill the request.                                                                                                                                                                                |
| `int`  | [ERROR_CODE_AUTHENTICATION_EXPIRED](https://developer.android.com/reference/android/support/v4/media/session/PlaybackStateCompat#ERROR_CODE_AUTHENTICATION_EXPIRED) Error code when the request cannot be performed because authentication has expired.                                                                                                                                           |
| `int`  | [ERROR_CODE_CONCURRENT_STREAM_LIMIT](https://developer.android.com/reference/android/support/v4/media/session/PlaybackStateCompat#ERROR_CODE_CONCURRENT_STREAM_LIMIT) Error code when too many concurrent streams are detected.                                                                                                                                                                   |
| `int`  | [ERROR_CODE_CONTENT_ALREADY_PLAYING](https://developer.android.com/reference/android/support/v4/media/session/PlaybackStateCompat#ERROR_CODE_CONTENT_ALREADY_PLAYING) Error code when the requested content is already playing.                                                                                                                                                                   |
| `int`  | [ERROR_CODE_END_OF_QUEUE](https://developer.android.com/reference/android/support/v4/media/session/PlaybackStateCompat#ERROR_CODE_END_OF_QUEUE) Error code when the playback navigation (previous, next) is not possible because the queue was exhausted.                                                                                                                                         |
| `int`  | [ERROR_CODE_NOT_AVAILABLE_IN_REGION](https://developer.android.com/reference/android/support/v4/media/session/PlaybackStateCompat#ERROR_CODE_NOT_AVAILABLE_IN_REGION) Error code when the content is blocked due to being regionally unavailable.                                                                                                                                                 |
| `int`  | [ERROR_CODE_NOT_SUPPORTED](https://developer.android.com/reference/android/support/v4/media/session/PlaybackStateCompat#ERROR_CODE_NOT_SUPPORTED) Error code when the request is not supported by the application.                                                                                                                                                                                |
| `int`  | [ERROR_CODE_PARENTAL_CONTROL_RESTRICTED](https://developer.android.com/reference/android/support/v4/media/session/PlaybackStateCompat#ERROR_CODE_PARENTAL_CONTROL_RESTRICTED) Error code when the content is blocked due to parental controls.                                                                                                                                                    |
| `int`  | [ERROR_CODE_PREMIUM_ACCOUNT_REQUIRED](https://developer.android.com/reference/android/support/v4/media/session/PlaybackStateCompat#ERROR_CODE_PREMIUM_ACCOUNT_REQUIRED) Error code when a premium account is required for the request to succeed.                                                                                                                                                 |
| `int`  | [ERROR_CODE_SKIP_LIMIT_REACHED](https://developer.android.com/reference/android/support/v4/media/session/PlaybackStateCompat#ERROR_CODE_SKIP_LIMIT_REACHED) Error code when the application cannot skip any more songs because skip limit is reached.                                                                                                                                             |
| `int`  | [ERROR_CODE_UNKNOWN_ERROR](https://developer.android.com/reference/android/support/v4/media/session/PlaybackStateCompat#ERROR_CODE_UNKNOWN_ERROR) This is the default error code and indicates that none of the other error codes applies.                                                                                                                                                        |
| `long` | [PLAYBACK_POSITION_UNKNOWN](https://developer.android.com/reference/android/support/v4/media/session/PlaybackStateCompat#PLAYBACK_POSITION_UNKNOWN) Use this value for the position to indicate the position is not known.                                                                                                                                                                        |
| `int`  | [REPEAT_MODE_ALL](https://developer.android.com/reference/android/support/v4/media/session/PlaybackStateCompat#REPEAT_MODE_ALL) Use this value with[setRepeatMode(int)](https://developer.android.com/reference/android/support/v4/media/session/MediaControllerCompat.TransportControls#setRepeatMode(int))to indicate that the playback of the playing media list will be repeated.             |
| `int`  | [REPEAT_MODE_GROUP](https://developer.android.com/reference/android/support/v4/media/session/PlaybackStateCompat#REPEAT_MODE_GROUP) Use this value with[setRepeatMode(int)](https://developer.android.com/reference/android/support/v4/media/session/MediaControllerCompat.TransportControls#setRepeatMode(int))to indicate that the playback of the playing media group will be repeated.        |
| `int`  | [REPEAT_MODE_INVALID](https://developer.android.com/reference/android/support/v4/media/session/PlaybackStateCompat#REPEAT_MODE_INVALID) [getRepeatMode()](https://developer.android.com/reference/android/support/v4/media/session/MediaControllerCompat#getRepeatMode())returns this value when the session is not ready for providing its repeat mode.                                          |
| `int`  | [REPEAT_MODE_NONE](https://developer.android.com/reference/android/support/v4/media/session/PlaybackStateCompat#REPEAT_MODE_NONE) Use this value with[setRepeatMode(int)](https://developer.android.com/reference/android/support/v4/media/session/MediaControllerCompat.TransportControls#setRepeatMode(int))to indicate that the playback will be stopped at the end of the playing media list. |
| `int`  | [REPEAT_MODE_ONE](https://developer.android.com/reference/android/support/v4/media/session/PlaybackStateCompat#REPEAT_MODE_ONE) Use this value with[setRepeatMode(int)](https://developer.android.com/reference/android/support/v4/media/session/MediaControllerCompat.TransportControls#setRepeatMode(int))to indicate that the playback of the current playing media item will be repeated.     |
| `int`  | [SHUFFLE_MODE_ALL](https://developer.android.com/reference/android/support/v4/media/session/PlaybackStateCompat#SHUFFLE_MODE_ALL) Use this value with[setShuffleMode(int)](https://developer.android.com/reference/android/support/v4/media/session/MediaControllerCompat.TransportControls#setShuffleMode(int))to indicate that the media list will be played in shuffled order.                 |
| `int`  | [SHUFFLE_MODE_GROUP](https://developer.android.com/reference/android/support/v4/media/session/PlaybackStateCompat#SHUFFLE_MODE_GROUP) Use this value with[setShuffleMode(int)](https://developer.android.com/reference/android/support/v4/media/session/MediaControllerCompat.TransportControls#setShuffleMode(int))to indicate that the media group will be played in shuffled order.            |
| `int`  | [SHUFFLE_MODE_INVALID](https://developer.android.com/reference/android/support/v4/media/session/PlaybackStateCompat#SHUFFLE_MODE_INVALID) [getShuffleMode()](https://developer.android.com/reference/android/support/v4/media/session/MediaControllerCompat#getShuffleMode())returns this value when the session is not ready for providing its shuffle mode.                                     |
| `int`  | [SHUFFLE_MODE_NONE](https://developer.android.com/reference/android/support/v4/media/session/PlaybackStateCompat#SHUFFLE_MODE_NONE) Use this value with[setShuffleMode(int)](https://developer.android.com/reference/android/support/v4/media/session/MediaControllerCompat.TransportControls#setShuffleMode(int))to indicate that the media list will be played in order.                        |
| `int`  | [STATE_BUFFERING](https://developer.android.com/reference/android/support/v4/media/session/PlaybackStateCompat#STATE_BUFFERING) State indicating this item is currently buffering and will begin playing when enough data has buffered.                                                                                                                                                           |
| `int`  | [STATE_CONNECTING](https://developer.android.com/reference/android/support/v4/media/session/PlaybackStateCompat#STATE_CONNECTING) State indicating the class doing playback is currently connecting to a route.                                                                                                                                                                                   |
| `int`  | [STATE_ERROR](https://developer.android.com/reference/android/support/v4/media/session/PlaybackStateCompat#STATE_ERROR) State indicating this item is currently in an error state.                                                                                                                                                                                                                |
| `int`  | [STATE_FAST_FORWARDING](https://developer.android.com/reference/android/support/v4/media/session/PlaybackStateCompat#STATE_FAST_FORWARDING) State indicating this item is currently fast forwarding.                                                                                                                                                                                              |
| `int`  | [STATE_NONE](https://developer.android.com/reference/android/support/v4/media/session/PlaybackStateCompat#STATE_NONE) This is the default playback state and indicates that no media has been added yet, or the performer has been reset and has no content to play.                                                                                                                              |
| `int`  | [STATE_PAUSED](https://developer.android.com/reference/android/support/v4/media/session/PlaybackStateCompat#STATE_PAUSED) State indicating this item is currently paused.                                                                                                                                                                                                                         |
| `int`  | [STATE_PLAYING](https://developer.android.com/reference/android/support/v4/media/session/PlaybackStateCompat#STATE_PLAYING) State indicating this item is currently playing.                                                                                                                                                                                                                      |
| `int`  | [STATE_REWINDING](https://developer.android.com/reference/android/support/v4/media/session/PlaybackStateCompat#STATE_REWINDING) State indicating this item is currently rewinding.                                                                                                                                                                                                                |
| `int`  | [STATE_SKIPPING_TO_NEXT](https://developer.android.com/reference/android/support/v4/media/session/PlaybackStateCompat#STATE_SKIPPING_TO_NEXT) State indicating the player is currently skipping to the next item.                                                                                                                                                                                 |
| `int`  | [STATE_SKIPPING_TO_PREVIOUS](https://developer.android.com/reference/android/support/v4/media/session/PlaybackStateCompat#STATE_SKIPPING_TO_PREVIOUS) State indicating the player is currently skipping to the previous item.                                                                                                                                                                     |
| `int`  | [STATE_SKIPPING_TO_QUEUE_ITEM](https://developer.android.com/reference/android/support/v4/media/session/PlaybackStateCompat#STATE_SKIPPING_TO_QUEUE_ITEM) State indicating the player is currently skipping to a specific item in the queue.                                                                                                                                                      |
| `int`  | [STATE_STOPPED](https://developer.android.com/reference/android/support/v4/media/session/PlaybackStateCompat#STATE_STOPPED) State indicating this item is currently stopped.                                                                                                                                                                                                                      |

|                                                                                                                                                                               ### Inherited constants                                                                                                                                                                               |
|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| [![](https://developer.android.com/static/assets/images/styles/disclosure_down.png)](https://developer.android.com/reference/android/support/v4-media-session/PlaybackStateCompat#)From interface` android.os.Parcelable ` |-------|----------------------------------------| | `int` | `CONTENTS_FILE_DESCRIPTOR` <br />      | | `int` | `PARCELABLE_WRITE_RETURN_VALUE` <br /> | |

|                                                                                                                                                                          ### Fields                                                                                                                                                                           ||
|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------|
| ` public static final `[Creator](https://developer.android.com/reference/android/os/Parcelable.Creator.html)`<`[PlaybackStateCompat](https://developer.android.com/reference/android/support/v4/media/session/PlaybackStateCompat)`>` | [CREATOR](https://developer.android.com/reference/android/support/v4/media/session/PlaybackStateCompat#CREATOR) <br /> |

|                                                                                                                                                                                                                                 ### Public methods                                                                                                                                                                                                                                  ||
|----------------------------------------------------------------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| ` int`                                                                                                                                                   | ` `[describeContents](https://developer.android.com/reference/android/support/v4/media/session/PlaybackStateCompat#describeContents())`() `                                                                                                                                                                               |
| ` static `[PlaybackStateCompat](https://developer.android.com/reference/android/support/v4/media/session/PlaybackStateCompat)                            | ` `[fromPlaybackState](https://developer.android.com/reference/android/support/v4/media/session/PlaybackStateCompat#fromPlaybackState(java.lang.Object))`(Object stateObj) ` Creates an instance from a framework[PlaybackState](https://developer.android.com/reference/android/media/session/PlaybackState.html)object. |
| ` long`                                                                                                                                                  | ` `[getActions](https://developer.android.com/reference/android/support/v4/media/session/PlaybackStateCompat#getActions())`() ` Get the current actions available on this session.                                                                                                                                        |
| ` long`                                                                                                                                                  | ` `[getActiveQueueItemId](https://developer.android.com/reference/android/support/v4/media/session/PlaybackStateCompat#getActiveQueueItemId())`() ` Get the id of the currently active item in the queue.                                                                                                                 |
| ` long`                                                                                                                                                  | ` `[getBufferedPosition](https://developer.android.com/reference/android/support/v4/media/session/PlaybackStateCompat#getBufferedPosition())`() ` Get the current buffered position in ms.                                                                                                                                |
| ` List<`[PlaybackStateCompat.CustomAction](https://developer.android.com/reference/android/support/v4/media/session/PlaybackStateCompat.CustomAction)`>` | ` `[getCustomActions](https://developer.android.com/reference/android/support/v4/media/session/PlaybackStateCompat#getCustomActions())`() ` Get the list of custom actions.                                                                                                                                               |
| ` int`                                                                                                                                                   | ` `[getErrorCode](https://developer.android.com/reference/android/support/v4/media/session/PlaybackStateCompat#getErrorCode())`() ` Get the error code.                                                                                                                                                                   |
| ` CharSequence`                                                                                                                                          | ` `[getErrorMessage](https://developer.android.com/reference/android/support/v4/media/session/PlaybackStateCompat#getErrorMessage())`() ` Get the user readable optional error message.                                                                                                                                   |
| ` `[Bundle](https://developer.android.com/reference/android/os/Bundle.html)                                                                              | ` `[getExtras](https://developer.android.com/reference/android/support/v4/media/session/PlaybackStateCompat#getExtras())`() ` Get any custom extras that were set on this playback state.                                                                                                                                 |
| ` long`                                                                                                                                                  | ` `[getLastPositionUpdateTime](https://developer.android.com/reference/android/support/v4/media/session/PlaybackStateCompat#getLastPositionUpdateTime())`() ` Get the elapsed real time at which position was last updated.                                                                                               |
| ` float`                                                                                                                                                 | ` `[getPlaybackSpeed](https://developer.android.com/reference/android/support/v4/media/session/PlaybackStateCompat#getPlaybackSpeed())`() ` Get the current playback speed as a multiple of normal playback.                                                                                                              |
| ` Object`                                                                                                                                                | ` `[getPlaybackState](https://developer.android.com/reference/android/support/v4/media/session/PlaybackStateCompat#getPlaybackState())`() ` Gets the underlying framework[PlaybackState](https://developer.android.com/reference/android/media/session/PlaybackState.html)object.                                         |
| ` long`                                                                                                                                                  | ` `[getPosition](https://developer.android.com/reference/android/support/v4/media/session/PlaybackStateCompat#getPosition())`() ` Get the current playback position in ms.                                                                                                                                                |
| ` int`                                                                                                                                                   | ` `[getState](https://developer.android.com/reference/android/support/v4/media/session/PlaybackStateCompat#getState())`() ` Get the current state of playback.                                                                                                                                                            |
| ` static int`                                                                                                                                            | ` `[toKeyCode](https://developer.android.com/reference/android/support/v4/media/session/PlaybackStateCompat#toKeyCode(long))`(long action) ` Translates a given action into a matched key code defined in[KeyEvent](https://developer.android.com/reference/android/view/KeyEvent.html).                                  |
| ` String`                                                                                                                                                | ` `[toString](https://developer.android.com/reference/android/support/v4/media/session/PlaybackStateCompat#toString())`() `                                                                                                                                                                                               |
| ` void`                                                                                                                                                  | ` `[writeToParcel](https://developer.android.com/reference/android/support/v4/media/session/PlaybackStateCompat#writeToParcel(android.os.Parcel, int))`(`[Parcel](https://developer.android.com/reference/android/os/Parcel.html)` dest, int flags) `                                                                     |

| ### Inherited methods |
|-----------------------|---|
| [![](https://developer.android.com/static/assets/images/styles/disclosure_down.png)](https://developer.android.com/reference/android/support/v4-media-session/PlaybackStateCompat#)From class` java.lang.Object ` |-------------------|-------------------------------| | ` Object`         | ` clone() `                   | | ` boolean`        | ` equals(Object arg0) `       | | ` void`           | ` finalize() `                | | ` final Class<?>` | ` getClass() `                | | ` int`            | ` hashCode() `                | | ` final void`     | ` notify() `                  | | ` final void`     | ` notifyAll() `               | | ` String`         | ` toString() `                | | ` final void`     | ` wait(long arg0, int arg1) ` | | ` final void`     | ` wait(long arg0) `           | | ` final void`     | ` wait() `                    | ||
| [![](https://developer.android.com/static/assets/images/styles/disclosure_down.png)](https://developer.android.com/reference/android/support/v4-media-session/PlaybackStateCompat#)From interface` `[android.os.Parcelable](https://developer.android.com/reference/android/os/Parcelable.html)` ` |------------------|--------------------------------------------------------------------------------------------------------------| | ` abstract int`  | ` describeContents() `                                                                                       | | ` abstract void` | ` writeToParcel(`[Parcel](https://developer.android.com/reference/android/os/Parcel.html)` arg0, int arg1) ` | ||

## Constants

### ACTION_FAST_FORWARD

added in[version 22.1.0](https://developer.android.com/topic/libraries/support-library/revisions)  

```
long ACTION_FAST_FORWARD
```

Indicates this session supports the fast forward command.

<br />

**See also:**

- [setActions(long)](https://developer.android.com/reference/android/support/v4/media/session/PlaybackStateCompat.Builder#setActions(long))

Constant Value: 64 (0x0000000000000040)  

### ACTION_PAUSE

added in[version 22.1.0](https://developer.android.com/topic/libraries/support-library/revisions)  

```
long ACTION_PAUSE
```

Indicates this session supports the pause command.

<br />

**See also:**

- [setActions(long)](https://developer.android.com/reference/android/support/v4/media/session/PlaybackStateCompat.Builder#setActions(long))

Constant Value: 2 (0x0000000000000002)  

### ACTION_PLAY

added in[version 22.1.0](https://developer.android.com/topic/libraries/support-library/revisions)  

```
long ACTION_PLAY
```

Indicates this session supports the play command.

<br />

**See also:**

- [setActions(long)](https://developer.android.com/reference/android/support/v4/media/session/PlaybackStateCompat.Builder#setActions(long))

Constant Value: 4 (0x0000000000000004)  

### ACTION_PLAY_FROM_MEDIA_ID

added in[version 22.1.0](https://developer.android.com/topic/libraries/support-library/revisions)  

```
long ACTION_PLAY_FROM_MEDIA_ID
```

Indicates this session supports the play from media id command.

<br />

**See also:**

- [setActions(long)](https://developer.android.com/reference/android/support/v4/media/session/PlaybackStateCompat.Builder#setActions(long))

Constant Value: 1024 (0x0000000000000400)  

### ACTION_PLAY_FROM_SEARCH

added in[version 22.1.0](https://developer.android.com/topic/libraries/support-library/revisions)  

```
long ACTION_PLAY_FROM_SEARCH
```

Indicates this session supports the play from search command.

<br />

**See also:**

- [setActions(long)](https://developer.android.com/reference/android/support/v4/media/session/PlaybackStateCompat.Builder#setActions(long))

Constant Value: 2048 (0x0000000000000800)  

### ACTION_PLAY_FROM_URI

added in[version 24.1.0](https://developer.android.com/topic/libraries/support-library/revisions)  

```
long ACTION_PLAY_FROM_URI
```

Indicates this session supports the play from URI command.

<br />

**See also:**

- [setActions(long)](https://developer.android.com/reference/android/support/v4/media/session/PlaybackStateCompat.Builder#setActions(long))

Constant Value: 8192 (0x0000000000002000)  

### ACTION_PLAY_PAUSE

added in[version 22.1.0](https://developer.android.com/topic/libraries/support-library/revisions)  

```
long ACTION_PLAY_PAUSE
```

Indicates this session supports the play/pause toggle command.

<br />

**See also:**

- [setActions(long)](https://developer.android.com/reference/android/support/v4/media/session/PlaybackStateCompat.Builder#setActions(long))

Constant Value: 512 (0x0000000000000200)  

### ACTION_PREPARE

added in[version 24.1.0](https://developer.android.com/topic/libraries/support-library/revisions)  

```
long ACTION_PREPARE
```

Indicates this session supports the prepare command.

<br />

**See also:**

- [setActions(long)](https://developer.android.com/reference/android/support/v4/media/session/PlaybackStateCompat.Builder#setActions(long))

Constant Value: 16384 (0x0000000000004000)  

### ACTION_PREPARE_FROM_MEDIA_ID

added in[version 24.1.0](https://developer.android.com/topic/libraries/support-library/revisions)  

```
long ACTION_PREPARE_FROM_MEDIA_ID
```

Indicates this session supports the prepare from media id command.

<br />

**See also:**

- [setActions(long)](https://developer.android.com/reference/android/support/v4/media/session/PlaybackStateCompat.Builder#setActions(long))

Constant Value: 32768 (0x0000000000008000)  

### ACTION_PREPARE_FROM_SEARCH

added in[version 24.1.0](https://developer.android.com/topic/libraries/support-library/revisions)  

```
long ACTION_PREPARE_FROM_SEARCH
```

Indicates this session supports the prepare from search command.

<br />

**See also:**

- [setActions(long)](https://developer.android.com/reference/android/support/v4/media/session/PlaybackStateCompat.Builder#setActions(long))

Constant Value: 65536 (0x0000000000010000)  

### ACTION_PREPARE_FROM_URI

added in[version 24.1.0](https://developer.android.com/topic/libraries/support-library/revisions)  

```
long ACTION_PREPARE_FROM_URI
```

Indicates this session supports the prepare from URI command.

<br />

**See also:**

- [setActions(long)](https://developer.android.com/reference/android/support/v4/media/session/PlaybackStateCompat.Builder#setActions(long))

Constant Value: 131072 (0x0000000000020000)  

### ACTION_REWIND

added in[version 22.1.0](https://developer.android.com/topic/libraries/support-library/revisions)  

```
long ACTION_REWIND
```

Indicates this session supports the rewind command.

<br />

**See also:**

- [setActions(long)](https://developer.android.com/reference/android/support/v4/media/session/PlaybackStateCompat.Builder#setActions(long))

Constant Value: 8 (0x0000000000000008)  

### ACTION_SEEK_TO

added in[version 22.1.0](https://developer.android.com/topic/libraries/support-library/revisions)  

```
long ACTION_SEEK_TO
```

Indicates this session supports the seek to command.

<br />

**See also:**

- [setActions(long)](https://developer.android.com/reference/android/support/v4/media/session/PlaybackStateCompat.Builder#setActions(long))

Constant Value: 256 (0x0000000000000100)  

### ACTION_SET_CAPTIONING_ENABLED

added in[version 25.4.0](https://developer.android.com/topic/libraries/support-library/revisions)  

```
long ACTION_SET_CAPTIONING_ENABLED
```

Indicates this session supports the set captioning enabled command.

<br />

**See also:**

- [setActions(long)](https://developer.android.com/reference/android/support/v4/media/session/PlaybackStateCompat.Builder#setActions(long))

Constant Value: 1048576 (0x0000000000100000)  

### ACTION_SET_RATING

added in[version 22.1.0](https://developer.android.com/topic/libraries/support-library/revisions)  

```
long ACTION_SET_RATING
```

Indicates this session supports the set rating command.

<br />

**See also:**

- [setActions(long)](https://developer.android.com/reference/android/support/v4/media/session/PlaybackStateCompat.Builder#setActions(long))

Constant Value: 128 (0x0000000000000080)  

### ACTION_SET_REPEAT_MODE

added in[version 25.4.0](https://developer.android.com/topic/libraries/support-library/revisions)  

```
long ACTION_SET_REPEAT_MODE
```

Indicates this session supports the set repeat mode command.

<br />

**See also:**

- [setActions(long)](https://developer.android.com/reference/android/support/v4/media/session/PlaybackStateCompat.Builder#setActions(long))

Constant Value: 262144 (0x0000000000040000)  

### ACTION_SET_SHUFFLE_MODE

added in[version 27.1.0](https://developer.android.com/topic/libraries/support-library/revisions)  

```
long ACTION_SET_SHUFFLE_MODE
```

Indicates this session supports the set shuffle mode command.

<br />

**See also:**

- [setActions(long)](https://developer.android.com/reference/android/support/v4/media/session/PlaybackStateCompat.Builder#setActions(long))

Constant Value: 2097152 (0x0000000000200000)  

### ACTION_SET_SHUFFLE_MODE_ENABLED

added in[version 25.4.0](https://developer.android.com/topic/libraries/support-library/revisions)  

```
long ACTION_SET_SHUFFLE_MODE_ENABLED
```

<br />

**This constant was deprecated in API level 27.1.0.**   
Use[ACTION_SET_SHUFFLE_MODE](https://developer.android.com/reference/android/support/v4/media/session/PlaybackStateCompat#ACTION_SET_SHUFFLE_MODE)instead.

Indicates this session supports the set shuffle mode enabled command.

<br />

**See also:**

- [setActions(long)](https://developer.android.com/reference/android/support/v4/media/session/PlaybackStateCompat.Builder#setActions(long))

Constant Value: 524288 (0x0000000000080000)  

### ACTION_SKIP_TO_NEXT

added in[version 22.1.0](https://developer.android.com/topic/libraries/support-library/revisions)  

```
long ACTION_SKIP_TO_NEXT
```

Indicates this session supports the next command.

<br />

**See also:**

- [setActions(long)](https://developer.android.com/reference/android/support/v4/media/session/PlaybackStateCompat.Builder#setActions(long))

Constant Value: 32 (0x0000000000000020)  

### ACTION_SKIP_TO_PREVIOUS

added in[version 22.1.0](https://developer.android.com/topic/libraries/support-library/revisions)  

```
long ACTION_SKIP_TO_PREVIOUS
```

Indicates this session supports the previous command.

<br />

**See also:**

- [setActions(long)](https://developer.android.com/reference/android/support/v4/media/session/PlaybackStateCompat.Builder#setActions(long))

Constant Value: 16 (0x0000000000000010)  

### ACTION_SKIP_TO_QUEUE_ITEM

added in[version 22.1.0](https://developer.android.com/topic/libraries/support-library/revisions)  

```
long ACTION_SKIP_TO_QUEUE_ITEM
```

Indicates this session supports the skip to queue item command.

<br />

**See also:**

- [setActions(long)](https://developer.android.com/reference/android/support/v4/media/session/PlaybackStateCompat.Builder#setActions(long))

Constant Value: 4096 (0x0000000000001000)  

### ACTION_STOP

added in[version 22.1.0](https://developer.android.com/topic/libraries/support-library/revisions)  

```
long ACTION_STOP
```

Indicates this session supports the stop command.

<br />

**See also:**

- [setActions(long)](https://developer.android.com/reference/android/support/v4/media/session/PlaybackStateCompat.Builder#setActions(long))

Constant Value: 1 (0x0000000000000001)  

### ERROR_CODE_ACTION_ABORTED

added in[version 25.4.0](https://developer.android.com/topic/libraries/support-library/revisions)  

```
int ERROR_CODE_ACTION_ABORTED
```

Error code when the action is interrupted due to some external event. The error code should be set when entering[STATE_ERROR](https://developer.android.com/reference/android/support/v4/media/session/PlaybackStateCompat#STATE_ERROR).

<br />

Constant Value: 10 (0x0000000a)  

### ERROR_CODE_APP_ERROR

added in[version 25.4.0](https://developer.android.com/topic/libraries/support-library/revisions)  

```
int ERROR_CODE_APP_ERROR
```

Error code when the application state is invalid to fulfill the request. The error code should be set when entering[STATE_ERROR](https://developer.android.com/reference/android/support/v4/media/session/PlaybackStateCompat#STATE_ERROR).

<br />

Constant Value: 1 (0x00000001)  

### ERROR_CODE_AUTHENTICATION_EXPIRED

added in[version 25.4.0](https://developer.android.com/topic/libraries/support-library/revisions)  

```
int ERROR_CODE_AUTHENTICATION_EXPIRED
```

Error code when the request cannot be performed because authentication has expired. The error code should be set when entering[STATE_ERROR](https://developer.android.com/reference/android/support/v4/media/session/PlaybackStateCompat#STATE_ERROR).

<br />

Constant Value: 3 (0x00000003)  

### ERROR_CODE_CONCURRENT_STREAM_LIMIT

added in[version 25.4.0](https://developer.android.com/topic/libraries/support-library/revisions)  

```
int ERROR_CODE_CONCURRENT_STREAM_LIMIT
```

Error code when too many concurrent streams are detected. The error code should be set when entering[STATE_ERROR](https://developer.android.com/reference/android/support/v4/media/session/PlaybackStateCompat#STATE_ERROR).

<br />

Constant Value: 5 (0x00000005)  

### ERROR_CODE_CONTENT_ALREADY_PLAYING

added in[version 25.4.0](https://developer.android.com/topic/libraries/support-library/revisions)  

```
int ERROR_CODE_CONTENT_ALREADY_PLAYING
```

Error code when the requested content is already playing. The error code should be set when entering[STATE_ERROR](https://developer.android.com/reference/android/support/v4/media/session/PlaybackStateCompat#STATE_ERROR).

<br />

Constant Value: 8 (0x00000008)  

### ERROR_CODE_END_OF_QUEUE

added in[version 25.4.0](https://developer.android.com/topic/libraries/support-library/revisions)  

```
int ERROR_CODE_END_OF_QUEUE
```

Error code when the playback navigation (previous, next) is not possible because the queue was exhausted. The error code should be set when entering[STATE_ERROR](https://developer.android.com/reference/android/support/v4/media/session/PlaybackStateCompat#STATE_ERROR).

<br />

Constant Value: 11 (0x0000000b)  

### ERROR_CODE_NOT_AVAILABLE_IN_REGION

added in[version 25.4.0](https://developer.android.com/topic/libraries/support-library/revisions)  

```
int ERROR_CODE_NOT_AVAILABLE_IN_REGION
```

Error code when the content is blocked due to being regionally unavailable. The error code should be set when entering[STATE_ERROR](https://developer.android.com/reference/android/support/v4/media/session/PlaybackStateCompat#STATE_ERROR).

<br />

Constant Value: 7 (0x00000007)  

### ERROR_CODE_NOT_SUPPORTED

added in[version 25.4.0](https://developer.android.com/topic/libraries/support-library/revisions)  

```
int ERROR_CODE_NOT_SUPPORTED
```

Error code when the request is not supported by the application. The error code should be set when entering[STATE_ERROR](https://developer.android.com/reference/android/support/v4/media/session/PlaybackStateCompat#STATE_ERROR).

<br />

Constant Value: 2 (0x00000002)  

### ERROR_CODE_PARENTAL_CONTROL_RESTRICTED

added in[version 25.4.0](https://developer.android.com/topic/libraries/support-library/revisions)  

```
int ERROR_CODE_PARENTAL_CONTROL_RESTRICTED
```

Error code when the content is blocked due to parental controls. The error code should be set when entering[STATE_ERROR](https://developer.android.com/reference/android/support/v4/media/session/PlaybackStateCompat#STATE_ERROR).

<br />

Constant Value: 6 (0x00000006)  

### ERROR_CODE_PREMIUM_ACCOUNT_REQUIRED

added in[version 25.4.0](https://developer.android.com/topic/libraries/support-library/revisions)  

```
int ERROR_CODE_PREMIUM_ACCOUNT_REQUIRED
```

Error code when a premium account is required for the request to succeed. The error code should be set when entering[STATE_ERROR](https://developer.android.com/reference/android/support/v4/media/session/PlaybackStateCompat#STATE_ERROR).

<br />

Constant Value: 4 (0x00000004)  

### ERROR_CODE_SKIP_LIMIT_REACHED

added in[version 25.4.0](https://developer.android.com/topic/libraries/support-library/revisions)  

```
int ERROR_CODE_SKIP_LIMIT_REACHED
```

Error code when the application cannot skip any more songs because skip limit is reached. The error code should be set when entering[STATE_ERROR](https://developer.android.com/reference/android/support/v4/media/session/PlaybackStateCompat#STATE_ERROR).

<br />

Constant Value: 9 (0x00000009)  

### ERROR_CODE_UNKNOWN_ERROR

added in[version 25.4.0](https://developer.android.com/topic/libraries/support-library/revisions)  

```
int ERROR_CODE_UNKNOWN_ERROR
```

This is the default error code and indicates that none of the other error codes applies. The error code should be set when entering[STATE_ERROR](https://developer.android.com/reference/android/support/v4/media/session/PlaybackStateCompat#STATE_ERROR).

<br />

Constant Value: 0 (0x00000000)  

### PLAYBACK_POSITION_UNKNOWN

added in[version 22.1.0](https://developer.android.com/topic/libraries/support-library/revisions)  

```
long PLAYBACK_POSITION_UNKNOWN
```

Use this value for the position to indicate the position is not known.

<br />

Constant Value: -1 (0xffffffffffffffff)  

### REPEAT_MODE_ALL

added in[version 25.4.0](https://developer.android.com/topic/libraries/support-library/revisions)  

```
int REPEAT_MODE_ALL
```

Use this value with[setRepeatMode(int)](https://developer.android.com/reference/android/support/v4/media/session/MediaControllerCompat.TransportControls#setRepeatMode(int))to indicate that the playback of the playing media list will be repeated.

<br />

Constant Value: 2 (0x00000002)  

### REPEAT_MODE_GROUP

added in[version 26.1.0](https://developer.android.com/topic/libraries/support-library/revisions)  

```
int REPEAT_MODE_GROUP
```

Use this value with[setRepeatMode(int)](https://developer.android.com/reference/android/support/v4/media/session/MediaControllerCompat.TransportControls#setRepeatMode(int))to indicate that the playback of the playing media group will be repeated. A group is a logical block of media items which is specified in the section 5.7 of the Bluetooth AVRCP 1.6.

<br />

Constant Value: 3 (0x00000003)  

### REPEAT_MODE_INVALID

added in[version 27.1.0](https://developer.android.com/topic/libraries/support-library/revisions)  

```
int REPEAT_MODE_INVALID
```

[getRepeatMode()](https://developer.android.com/reference/android/support/v4/media/session/MediaControllerCompat#getRepeatMode())returns this value when the session is not ready for providing its repeat mode.

<br />

Constant Value: -1 (0xffffffff)  

### REPEAT_MODE_NONE

added in[version 25.4.0](https://developer.android.com/topic/libraries/support-library/revisions)  

```
int REPEAT_MODE_NONE
```

Use this value with[setRepeatMode(int)](https://developer.android.com/reference/android/support/v4/media/session/MediaControllerCompat.TransportControls#setRepeatMode(int))to indicate that the playback will be stopped at the end of the playing media list.

<br />

Constant Value: 0 (0x00000000)  

### REPEAT_MODE_ONE

added in[version 25.4.0](https://developer.android.com/topic/libraries/support-library/revisions)  

```
int REPEAT_MODE_ONE
```

Use this value with[setRepeatMode(int)](https://developer.android.com/reference/android/support/v4/media/session/MediaControllerCompat.TransportControls#setRepeatMode(int))to indicate that the playback of the current playing media item will be repeated.

<br />

Constant Value: 1 (0x00000001)  

### SHUFFLE_MODE_ALL

added in[version 26.1.0](https://developer.android.com/topic/libraries/support-library/revisions)  

```
int SHUFFLE_MODE_ALL
```

Use this value with[setShuffleMode(int)](https://developer.android.com/reference/android/support/v4/media/session/MediaControllerCompat.TransportControls#setShuffleMode(int))to indicate that the media list will be played in shuffled order.

<br />

Constant Value: 1 (0x00000001)  

### SHUFFLE_MODE_GROUP

added in[version 26.1.0](https://developer.android.com/topic/libraries/support-library/revisions)  

```
int SHUFFLE_MODE_GROUP
```

Use this value with[setShuffleMode(int)](https://developer.android.com/reference/android/support/v4/media/session/MediaControllerCompat.TransportControls#setShuffleMode(int))to indicate that the media group will be played in shuffled order. A group is a logical block of media items which is specified in the section 5.7 of the Bluetooth AVRCP 1.6.

<br />

Constant Value: 2 (0x00000002)  

### SHUFFLE_MODE_INVALID

added in[version 27.1.0](https://developer.android.com/topic/libraries/support-library/revisions)  

```
int SHUFFLE_MODE_INVALID
```

[getShuffleMode()](https://developer.android.com/reference/android/support/v4/media/session/MediaControllerCompat#getShuffleMode())returns this value when the session is not ready for providing its shuffle mode.

<br />

Constant Value: -1 (0xffffffff)  

### SHUFFLE_MODE_NONE

added in[version 26.1.0](https://developer.android.com/topic/libraries/support-library/revisions)  

```
int SHUFFLE_MODE_NONE
```

Use this value with[setShuffleMode(int)](https://developer.android.com/reference/android/support/v4/media/session/MediaControllerCompat.TransportControls#setShuffleMode(int))to indicate that the media list will be played in order.

<br />

Constant Value: 0 (0x00000000)  

### STATE_BUFFERING

added in[version 22.1.0](https://developer.android.com/topic/libraries/support-library/revisions)  

```
int STATE_BUFFERING
```

State indicating this item is currently buffering and will begin playing when enough data has buffered.

<br />

**See also:**

- [setState(int, long, float)](https://developer.android.com/reference/android/support/v4/media/session/PlaybackStateCompat.Builder#setState(int, long, float))

Constant Value: 6 (0x00000006)  

### STATE_CONNECTING

added in[version 24.1.0](https://developer.android.com/topic/libraries/support-library/revisions)  

```
int STATE_CONNECTING
```

State indicating the class doing playback is currently connecting to a route. Depending on the implementation you may return to the previous state when the connection finishes or enter[STATE_NONE](https://developer.android.com/reference/android/support/v4/media/session/PlaybackStateCompat#STATE_NONE). If the connection failed[STATE_ERROR](https://developer.android.com/reference/android/support/v4/media/session/PlaybackStateCompat#STATE_ERROR)should be used.

On devices earlier than API 21, this will appear as[STATE_BUFFERING](https://developer.android.com/reference/android/support/v4/media/session/PlaybackStateCompat#STATE_BUFFERING)

<br />

<br />

**See also:**

- [setState(int, long, float)](https://developer.android.com/reference/android/support/v4/media/session/PlaybackStateCompat.Builder#setState(int, long, float))

Constant Value: 8 (0x00000008)  

### STATE_ERROR

added in[version 22.1.0](https://developer.android.com/topic/libraries/support-library/revisions)  

```
int STATE_ERROR
```

State indicating this item is currently in an error state. The error code should also be set when entering this state.

<br />

**See also:**

- [setState(int, long, float)](https://developer.android.com/reference/android/support/v4/media/session/PlaybackStateCompat.Builder#setState(int, long, float))
- [setErrorMessage(int, CharSequence)](https://developer.android.com/reference/android/support/v4/media/session/PlaybackStateCompat.Builder#setErrorMessage(int, java.lang.CharSequence))

Constant Value: 7 (0x00000007)  

### STATE_FAST_FORWARDING

added in[version 22.1.0](https://developer.android.com/topic/libraries/support-library/revisions)  

```
int STATE_FAST_FORWARDING
```

State indicating this item is currently fast forwarding.

<br />

**See also:**

- [setState(int, long, float)](https://developer.android.com/reference/android/support/v4/media/session/PlaybackStateCompat.Builder#setState(int, long, float))

Constant Value: 4 (0x00000004)  

### STATE_NONE

added in[version 22.1.0](https://developer.android.com/topic/libraries/support-library/revisions)  

```
int STATE_NONE
```

This is the default playback state and indicates that no media has been added yet, or the performer has been reset and has no content to play.

<br />

**See also:**

- [setState(int, long, float)](https://developer.android.com/reference/android/support/v4/media/session/PlaybackStateCompat.Builder#setState(int, long, float))

Constant Value: 0 (0x00000000)  

### STATE_PAUSED

added in[version 22.1.0](https://developer.android.com/topic/libraries/support-library/revisions)  

```
int STATE_PAUSED
```

State indicating this item is currently paused.

<br />

**See also:**

- [setState(int, long, float)](https://developer.android.com/reference/android/support/v4/media/session/PlaybackStateCompat.Builder#setState(int, long, float))

Constant Value: 2 (0x00000002)  

### STATE_PLAYING

added in[version 22.1.0](https://developer.android.com/topic/libraries/support-library/revisions)  

```
int STATE_PLAYING
```

State indicating this item is currently playing.

<br />

**See also:**

- [setState(int, long, float)](https://developer.android.com/reference/android/support/v4/media/session/PlaybackStateCompat.Builder#setState(int, long, float))

Constant Value: 3 (0x00000003)  

### STATE_REWINDING

added in[version 22.1.0](https://developer.android.com/topic/libraries/support-library/revisions)  

```
int STATE_REWINDING
```

State indicating this item is currently rewinding.

<br />

**See also:**

- [setState(int, long, float)](https://developer.android.com/reference/android/support/v4/media/session/PlaybackStateCompat.Builder#setState(int, long, float))

Constant Value: 5 (0x00000005)  

### STATE_SKIPPING_TO_NEXT

added in[version 22.1.0](https://developer.android.com/topic/libraries/support-library/revisions)  

```
int STATE_SKIPPING_TO_NEXT
```

State indicating the player is currently skipping to the next item.

<br />

**See also:**

- [setState(int, long, float)](https://developer.android.com/reference/android/support/v4/media/session/PlaybackStateCompat.Builder#setState(int, long, float))

Constant Value: 10 (0x0000000a)  

### STATE_SKIPPING_TO_PREVIOUS

added in[version 22.1.0](https://developer.android.com/topic/libraries/support-library/revisions)  

```
int STATE_SKIPPING_TO_PREVIOUS
```

State indicating the player is currently skipping to the previous item.

<br />

**See also:**

- [setState(int, long, float)](https://developer.android.com/reference/android/support/v4/media/session/PlaybackStateCompat.Builder#setState(int, long, float))

Constant Value: 9 (0x00000009)  

### STATE_SKIPPING_TO_QUEUE_ITEM

added in[version 24.1.0](https://developer.android.com/topic/libraries/support-library/revisions)  

```
int STATE_SKIPPING_TO_QUEUE_ITEM
```

State indicating the player is currently skipping to a specific item in the queue.

On devices earlier than API 21, this will appear as[STATE_SKIPPING_TO_NEXT](https://developer.android.com/reference/android/support/v4/media/session/PlaybackStateCompat#STATE_SKIPPING_TO_NEXT)

<br />

<br />

**See also:**

- [setState(int, long, float)](https://developer.android.com/reference/android/support/v4/media/session/PlaybackStateCompat.Builder#setState(int, long, float))

Constant Value: 11 (0x0000000b)  

### STATE_STOPPED

added in[version 22.1.0](https://developer.android.com/topic/libraries/support-library/revisions)  

```
int STATE_STOPPED
```

State indicating this item is currently stopped.

<br />

**See also:**

- [setState(int, long, float)](https://developer.android.com/reference/android/support/v4/media/session/PlaybackStateCompat.Builder#setState(int, long, float))

Constant Value: 1 (0x00000001)

## Fields

### CREATOR

added in[version 22.1.0](https://developer.android.com/topic/libraries/support-library/revisions)  

```
Creator<PlaybackStateCompat> CREATOR
```

<br />

<br />

## Public methods

### describeContents

added in[version 22.1.0](https://developer.android.com/topic/libraries/support-library/revisions)  

```
int describeContents ()
```

<br />

<br />

|    Returns    ||
|-------|--------|
| `int` | <br /> |

### fromPlaybackState

added in[version 22.1.0](https://developer.android.com/topic/libraries/support-library/revisions)  

```
PlaybackStateCompat fromPlaybackState (Object stateObj)
```

Creates an instance from a framework[PlaybackState](https://developer.android.com/reference/android/media/session/PlaybackState.html)object.

This method is only supported on API 21+.

<br />

<br />

|                                                                       Parameters                                                                        ||
|------------|---------------------------------------------------------------------------------------------------------------------------------------------|
| `stateObj` | `Object`: A[PlaybackState](https://developer.android.com/reference/android/media/session/PlaybackState.html)object, or null if none. <br /> |

|                                                                                                                                       Returns                                                                                                                                        ||
|---------------------------------------------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------|
| [PlaybackStateCompat](https://developer.android.com/reference/android/support/v4/media/session/PlaybackStateCompat) | An equivalent[PlaybackStateCompat](https://developer.android.com/reference/android/support/v4/media/session/PlaybackStateCompat)object, or null if none. <br /> |

### getActions

added in[version 22.1.0](https://developer.android.com/topic/libraries/support-library/revisions)  

```
long getActions ()
```

Get the current actions available on this session. This should use a bitmask of the available actions.

- [ACTION_SKIP_TO_PREVIOUS](https://developer.android.com/reference/android/support/v4/media/session/PlaybackStateCompat#ACTION_SKIP_TO_PREVIOUS)
- [ACTION_REWIND](https://developer.android.com/reference/android/support/v4/media/session/PlaybackStateCompat#ACTION_REWIND)
- [ACTION_PLAY](https://developer.android.com/reference/android/support/v4/media/session/PlaybackStateCompat#ACTION_PLAY)
- [ACTION_PLAY_PAUSE](https://developer.android.com/reference/android/support/v4/media/session/PlaybackStateCompat#ACTION_PLAY_PAUSE)
- [ACTION_PAUSE](https://developer.android.com/reference/android/support/v4/media/session/PlaybackStateCompat#ACTION_PAUSE)
- [ACTION_STOP](https://developer.android.com/reference/android/support/v4/media/session/PlaybackStateCompat#ACTION_STOP)
- [ACTION_FAST_FORWARD](https://developer.android.com/reference/android/support/v4/media/session/PlaybackStateCompat#ACTION_FAST_FORWARD)
- [ACTION_SKIP_TO_NEXT](https://developer.android.com/reference/android/support/v4/media/session/PlaybackStateCompat#ACTION_SKIP_TO_NEXT)
- [ACTION_SEEK_TO](https://developer.android.com/reference/android/support/v4/media/session/PlaybackStateCompat#ACTION_SEEK_TO)
- [ACTION_SET_RATING](https://developer.android.com/reference/android/support/v4/media/session/PlaybackStateCompat#ACTION_SET_RATING)
- [ACTION_PLAY_FROM_MEDIA_ID](https://developer.android.com/reference/android/support/v4/media/session/PlaybackStateCompat#ACTION_PLAY_FROM_MEDIA_ID)
- [ACTION_PLAY_FROM_SEARCH](https://developer.android.com/reference/android/support/v4/media/session/PlaybackStateCompat#ACTION_PLAY_FROM_SEARCH)
- [ACTION_SKIP_TO_QUEUE_ITEM](https://developer.android.com/reference/android/support/v4/media/session/PlaybackStateCompat#ACTION_SKIP_TO_QUEUE_ITEM)
- [ACTION_PLAY_FROM_URI](https://developer.android.com/reference/android/support/v4/media/session/PlaybackStateCompat#ACTION_PLAY_FROM_URI)
- [ACTION_PREPARE](https://developer.android.com/reference/android/support/v4/media/session/PlaybackStateCompat#ACTION_PREPARE)
- [ACTION_PREPARE_FROM_MEDIA_ID](https://developer.android.com/reference/android/support/v4/media/session/PlaybackStateCompat#ACTION_PREPARE_FROM_MEDIA_ID)
- [ACTION_PREPARE_FROM_SEARCH](https://developer.android.com/reference/android/support/v4/media/session/PlaybackStateCompat#ACTION_PREPARE_FROM_SEARCH)
- [ACTION_PREPARE_FROM_URI](https://developer.android.com/reference/android/support/v4/media/session/PlaybackStateCompat#ACTION_PREPARE_FROM_URI)
- [ACTION_SET_REPEAT_MODE](https://developer.android.com/reference/android/support/v4/media/session/PlaybackStateCompat#ACTION_SET_REPEAT_MODE)
- [ACTION_SET_SHUFFLE_MODE](https://developer.android.com/reference/android/support/v4/media/session/PlaybackStateCompat#ACTION_SET_SHUFFLE_MODE)
- [ACTION_SET_CAPTIONING_ENABLED](https://developer.android.com/reference/android/support/v4/media/session/PlaybackStateCompat#ACTION_SET_CAPTIONING_ENABLED)

<br />

<br />

|    Returns     ||
|--------|--------|
| `long` | <br /> |

### getActiveQueueItemId

added in[version 24.1.0](https://developer.android.com/topic/libraries/support-library/revisions)  

```
long getActiveQueueItemId ()
```

Get the id of the currently active item in the queue. If there is no queue or a queue is not supported by the session this will be[UNKNOWN_ID](https://developer.android.com/reference/android/support/v4/media/session/MediaSessionCompat.QueueItem#UNKNOWN_ID).

<br />

|                                                                                              Returns                                                                                              ||
|--------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `long` | The id of the currently active item in the queue or[UNKNOWN_ID](https://developer.android.com/reference/android/support/v4/media/session/MediaSessionCompat.QueueItem#UNKNOWN_ID). <br /> |

### getBufferedPosition

added in[version 22.1.0](https://developer.android.com/topic/libraries/support-library/revisions)  

```
long getBufferedPosition ()
```

Get the current buffered position in ms. This is the farthest playback point that can be reached from the current position using only buffered content.

<br />

|    Returns     ||
|--------|--------|
| `long` | <br /> |

### getCustomActions

added in[version 24.1.0](https://developer.android.com/topic/libraries/support-library/revisions)  

```
List<PlaybackStateCompat.CustomAction> getCustomActions ()
```

Get the list of custom actions.

<br />

|                                                                             Returns                                                                             ||
|---------------------------------------------------------------------------------------------------------------------------------------------------------|--------|
| `List<`[PlaybackStateCompat.CustomAction](https://developer.android.com/reference/android/support/v4/media/session/PlaybackStateCompat.CustomAction)`>` | <br /> |

### getErrorCode

added in[version 25.4.0](https://developer.android.com/topic/libraries/support-library/revisions)  

```
int getErrorCode ()
```

Get the error code. This should be set when the state is[STATE_ERROR](https://developer.android.com/reference/android/support/v4/media/session/PlaybackStateCompat#STATE_ERROR).

<br />

|    Returns    ||
|-------|--------|
| `int` | <br /> |

**See also:**

- [ERROR_CODE_UNKNOWN_ERROR](https://developer.android.com/reference/android/support/v4/media/session/PlaybackStateCompat#ERROR_CODE_UNKNOWN_ERROR)
- [ERROR_CODE_APP_ERROR](https://developer.android.com/reference/android/support/v4/media/session/PlaybackStateCompat#ERROR_CODE_APP_ERROR)
- [ERROR_CODE_NOT_SUPPORTED](https://developer.android.com/reference/android/support/v4/media/session/PlaybackStateCompat#ERROR_CODE_NOT_SUPPORTED)
- [ERROR_CODE_AUTHENTICATION_EXPIRED](https://developer.android.com/reference/android/support/v4/media/session/PlaybackStateCompat#ERROR_CODE_AUTHENTICATION_EXPIRED)
- [ERROR_CODE_PREMIUM_ACCOUNT_REQUIRED](https://developer.android.com/reference/android/support/v4/media/session/PlaybackStateCompat#ERROR_CODE_PREMIUM_ACCOUNT_REQUIRED)
- [ERROR_CODE_CONCURRENT_STREAM_LIMIT](https://developer.android.com/reference/android/support/v4/media/session/PlaybackStateCompat#ERROR_CODE_CONCURRENT_STREAM_LIMIT)
- [ERROR_CODE_PARENTAL_CONTROL_RESTRICTED](https://developer.android.com/reference/android/support/v4/media/session/PlaybackStateCompat#ERROR_CODE_PARENTAL_CONTROL_RESTRICTED)
- [ERROR_CODE_NOT_AVAILABLE_IN_REGION](https://developer.android.com/reference/android/support/v4/media/session/PlaybackStateCompat#ERROR_CODE_NOT_AVAILABLE_IN_REGION)
- [ERROR_CODE_CONTENT_ALREADY_PLAYING](https://developer.android.com/reference/android/support/v4/media/session/PlaybackStateCompat#ERROR_CODE_CONTENT_ALREADY_PLAYING)
- [ERROR_CODE_SKIP_LIMIT_REACHED](https://developer.android.com/reference/android/support/v4/media/session/PlaybackStateCompat#ERROR_CODE_SKIP_LIMIT_REACHED)
- [ERROR_CODE_ACTION_ABORTED](https://developer.android.com/reference/android/support/v4/media/session/PlaybackStateCompat#ERROR_CODE_ACTION_ABORTED)
- [ERROR_CODE_END_OF_QUEUE](https://developer.android.com/reference/android/support/v4/media/session/PlaybackStateCompat#ERROR_CODE_END_OF_QUEUE)
- [getErrorMessage()](https://developer.android.com/reference/android/support/v4/media/session/PlaybackStateCompat#getErrorMessage())  

### getErrorMessage

added in[version 22.1.0](https://developer.android.com/topic/libraries/support-library/revisions)  

```
CharSequence getErrorMessage ()
```

Get the user readable optional error message. This may be set when the state is[STATE_ERROR](https://developer.android.com/reference/android/support/v4/media/session/PlaybackStateCompat#STATE_ERROR).

<br />

|        Returns         ||
|----------------|--------|
| `CharSequence` | <br /> |

**See also:**

- [getErrorCode()](https://developer.android.com/reference/android/support/v4/media/session/PlaybackStateCompat#getErrorCode())  

### getExtras

added in[version 24.1.0](https://developer.android.com/topic/libraries/support-library/revisions)  

```
Bundle getExtras ()
```

Get any custom extras that were set on this playback state.

<br />

|                                                       Returns                                                       ||
|--------------------------------------------------------------------------|-------------------------------------------|
| [Bundle](https://developer.android.com/reference/android/os/Bundle.html) | The extras for this state or null. <br /> |

### getLastPositionUpdateTime

added in[version 22.1.0](https://developer.android.com/topic/libraries/support-library/revisions)  

```
long getLastPositionUpdateTime ()
```

Get the elapsed real time at which position was last updated. If the position has never been set this will return 0;

<br />

|                        Returns                         ||
|--------|------------------------------------------------|
| `long` | The last time the position was updated. <br /> |

### getPlaybackSpeed

added in[version 22.1.0](https://developer.android.com/topic/libraries/support-library/revisions)  

```
float getPlaybackSpeed ()
```

Get the current playback speed as a multiple of normal playback. This should be negative when rewinding. A value of 1 means normal playback and 0 means paused.

<br />

|                    Returns                     ||
|---------|---------------------------------------|
| `float` | The current speed of playback. <br /> |

### getPlaybackState

added in[version 22.1.0](https://developer.android.com/topic/libraries/support-library/revisions)  

```
Object getPlaybackState ()
```

Gets the underlying framework[PlaybackState](https://developer.android.com/reference/android/media/session/PlaybackState.html)object.

This method is only supported on API 21+.

<br />

<br />

|                                                                         Returns                                                                         ||
|----------|-----------------------------------------------------------------------------------------------------------------------------------------------|
| `Object` | An equivalent[PlaybackState](https://developer.android.com/reference/android/media/session/PlaybackState.html)object, or null if none. <br /> |

### getPosition

added in[version 22.1.0](https://developer.android.com/topic/libraries/support-library/revisions)  

```
long getPosition ()
```

Get the current playback position in ms.

<br />

|    Returns     ||
|--------|--------|
| `long` | <br /> |

### getState

added in[version 22.1.0](https://developer.android.com/topic/libraries/support-library/revisions)  

```
int getState ()
```

Get the current state of playback. One of the following:

- [STATE_NONE](https://developer.android.com/reference/android/support/v4/media/session/PlaybackStateCompat#STATE_NONE)
- [STATE_STOPPED](https://developer.android.com/reference/android/support/v4/media/session/PlaybackStateCompat#STATE_STOPPED)
- [STATE_PLAYING](https://developer.android.com/reference/android/support/v4/media/session/PlaybackStateCompat#STATE_PLAYING)
- [STATE_PAUSED](https://developer.android.com/reference/android/support/v4/media/session/PlaybackStateCompat#STATE_PAUSED)
- [STATE_FAST_FORWARDING](https://developer.android.com/reference/android/support/v4/media/session/PlaybackStateCompat#STATE_FAST_FORWARDING)
- [STATE_REWINDING](https://developer.android.com/reference/android/support/v4/media/session/PlaybackStateCompat#STATE_REWINDING)
- [STATE_BUFFERING](https://developer.android.com/reference/android/support/v4/media/session/PlaybackStateCompat#STATE_BUFFERING)
- [STATE_ERROR](https://developer.android.com/reference/android/support/v4/media/session/PlaybackStateCompat#STATE_ERROR)
- [STATE_CONNECTING](https://developer.android.com/reference/android/support/v4/media/session/PlaybackStateCompat#STATE_CONNECTING)
- [STATE_SKIPPING_TO_PREVIOUS](https://developer.android.com/reference/android/support/v4/media/session/PlaybackStateCompat#STATE_SKIPPING_TO_PREVIOUS)
- [STATE_SKIPPING_TO_NEXT](https://developer.android.com/reference/android/support/v4/media/session/PlaybackStateCompat#STATE_SKIPPING_TO_NEXT)
- [STATE_SKIPPING_TO_QUEUE_ITEM](https://developer.android.com/reference/android/support/v4/media/session/PlaybackStateCompat#STATE_SKIPPING_TO_QUEUE_ITEM)

|    Returns    ||
|-------|--------|
| `int` | <br /> |

### toKeyCode

added in[version 25.1.0](https://developer.android.com/topic/libraries/support-library/revisions)  

```
int toKeyCode (long action)
```

Translates a given action into a matched key code defined in[KeyEvent](https://developer.android.com/reference/android/view/KeyEvent.html). The given action should be one of the following:

- [ACTION_PLAY](https://developer.android.com/reference/android/support/v4/media/session/PlaybackStateCompat#ACTION_PLAY)
- [ACTION_PAUSE](https://developer.android.com/reference/android/support/v4/media/session/PlaybackStateCompat#ACTION_PAUSE)
- [ACTION_SKIP_TO_NEXT](https://developer.android.com/reference/android/support/v4/media/session/PlaybackStateCompat#ACTION_SKIP_TO_NEXT)
- [ACTION_SKIP_TO_PREVIOUS](https://developer.android.com/reference/android/support/v4/media/session/PlaybackStateCompat#ACTION_SKIP_TO_PREVIOUS)
- [ACTION_STOP](https://developer.android.com/reference/android/support/v4/media/session/PlaybackStateCompat#ACTION_STOP)
- [ACTION_FAST_FORWARD](https://developer.android.com/reference/android/support/v4/media/session/PlaybackStateCompat#ACTION_FAST_FORWARD)
- [ACTION_REWIND](https://developer.android.com/reference/android/support/v4/media/session/PlaybackStateCompat#ACTION_REWIND)
- [ACTION_PLAY_PAUSE](https://developer.android.com/reference/android/support/v4/media/session/PlaybackStateCompat#ACTION_PLAY_PAUSE)

<br />

<br />

|                      Parameters                       ||
|----------|---------------------------------------------|
| `action` | `long`: The action to be translated. <br /> |

|                         Returns                         ||
|-------|--------------------------------------------------|
| `int` | the key code matched to the given action. <br /> |

### toString

```
String toString ()
```

<br />

<br />

|     Returns      ||
|----------|--------|
| `String` | <br /> |

### writeToParcel

added in[version 22.1.0](https://developer.android.com/topic/libraries/support-library/revisions)  

```
void writeToParcel (Parcel dest,
                int flags)
```

<br />

<br />

|        Parameters        ||
|---------|-----------------|
| `dest`  | `Parcel` <br /> |
| `flags` | `int` <br />    |

-

  ## Interfaces

  - [MediaSessionCompat.OnActiveChangeListener](https://developer.android.com/reference/android/support/v4/media/session/MediaSessionCompat.OnActiveChangeListener)
-

  ## Classes

  - [MediaButtonReceiver](https://developer.android.com/reference/android/support/v4/media/session/MediaButtonReceiver)
  - [MediaControllerCompat](https://developer.android.com/reference/android/support/v4/media/session/MediaControllerCompat)
  - [MediaControllerCompat.Callback](https://developer.android.com/reference/android/support/v4/media/session/MediaControllerCompat.Callback)
  - [MediaControllerCompat.PlaybackInfo](https://developer.android.com/reference/android/support/v4/media/session/MediaControllerCompat.PlaybackInfo)
  - [MediaControllerCompat.TransportControls](https://developer.android.com/reference/android/support/v4/media/session/MediaControllerCompat.TransportControls)
  - [MediaSessionCompat](https://developer.android.com/reference/android/support/v4/media/session/MediaSessionCompat)
  - [MediaSessionCompat.Callback](https://developer.android.com/reference/android/support/v4/media/session/MediaSessionCompat.Callback)
  - [MediaSessionCompat.QueueItem](https://developer.android.com/reference/android/support/v4/media/session/MediaSessionCompat.QueueItem)
  - [MediaSessionCompat.Token](https://developer.android.com/reference/android/support/v4/media/session/MediaSessionCompat.Token)
  - [ParcelableVolumeInfo](https://developer.android.com/reference/android/support/v4/media/session/ParcelableVolumeInfo)
  - [PlaybackStateCompat](https://developer.android.com/reference/android/support/v4/media/session/PlaybackStateCompat)
  - [PlaybackStateCompat.Builder](https://developer.android.com/reference/android/support/v4/media/session/PlaybackStateCompat.Builder)
  - [PlaybackStateCompat.CustomAction](https://developer.android.com/reference/android/support/v4/media/session/PlaybackStateCompat.CustomAction)
  - [PlaybackStateCompat.CustomAction.Builder](https://developer.android.com/reference/android/support/v4/media/session/PlaybackStateCompat.CustomAction.Builder)