Added in [API level 21](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels) Summary: [Nested Classes](https://developer.android.com/reference/android/media/session/PlaybackState#nestedclasses) \| [Constants](https://developer.android.com/reference/android/media/session/PlaybackState#constants) \| [Inherited Constants](https://developer.android.com/reference/android/media/session/PlaybackState#inhconstants) \| [Fields](https://developer.android.com/reference/android/media/session/PlaybackState#lfields) \| [Methods](https://developer.android.com/reference/android/media/session/PlaybackState#pubmethods) \| [Inherited Methods](https://developer.android.com/reference/android/media/session/PlaybackState#inhmethods)

# PlaybackState

*** ** * ** ***

` public final class PlaybackState `   
` extends https://developer.android.com/reference/java/lang/Object ` ` implements https://developer.android.com/reference/android/os/Parcelable `

|---|---|
| [java.lang.Object](https://developer.android.com/reference/java/lang/Object) ||
| ↳ | android.media.session.PlaybackState |

<br />

*** ** * ** ***

Playback state for a `https://developer.android.com/reference/android/media/session/MediaSession`. This includes a state like `https://developer.android.com/reference/android/media/session/PlaybackState#STATE_PLAYING`, the current playback position, and the current control capabilities.

## Summary

| ### Nested classes ||
|---|---|
| ` class` | `https://developer.android.com/reference/android/media/session/PlaybackState.Builder` Builder for `https://developer.android.com/reference/android/media/session/PlaybackState` objects. |
| ` class` | `https://developer.android.com/reference/android/media/session/PlaybackState.CustomAction` `https://developer.android.com/reference/android/media/session/PlaybackState.CustomAction` can be used to extend the capabilities of the standard transport controls by exposing app specific actions to `https://developer.android.com/reference/android/media/session/MediaController`. |

| ### Constants ||
|---|---|
| `long` | `https://developer.android.com/reference/android/media/session/PlaybackState#ACTION_FAST_FORWARD` Indicates this session supports the fast forward command. |
| `long` | `https://developer.android.com/reference/android/media/session/PlaybackState#ACTION_PAUSE` Indicates this session supports the pause command. |
| `long` | `https://developer.android.com/reference/android/media/session/PlaybackState#ACTION_PLAY` Indicates this session supports the play command. |
| `long` | `https://developer.android.com/reference/android/media/session/PlaybackState#ACTION_PLAY_FROM_MEDIA_ID` Indicates this session supports the play from media id command. |
| `long` | `https://developer.android.com/reference/android/media/session/PlaybackState#ACTION_PLAY_FROM_SEARCH` Indicates this session supports the play from search command. |
| `long` | `https://developer.android.com/reference/android/media/session/PlaybackState#ACTION_PLAY_FROM_URI` Indicates this session supports the play from URI command. |
| `long` | `https://developer.android.com/reference/android/media/session/PlaybackState#ACTION_PLAY_PAUSE` Indicates this session supports the play/pause toggle command. |
| `long` | `https://developer.android.com/reference/android/media/session/PlaybackState#ACTION_PREPARE` Indicates this session supports the prepare command. |
| `long` | `https://developer.android.com/reference/android/media/session/PlaybackState#ACTION_PREPARE_FROM_MEDIA_ID` Indicates this session supports the prepare from media id command. |
| `long` | `https://developer.android.com/reference/android/media/session/PlaybackState#ACTION_PREPARE_FROM_SEARCH` Indicates this session supports the prepare from search command. |
| `long` | `https://developer.android.com/reference/android/media/session/PlaybackState#ACTION_PREPARE_FROM_URI` Indicates this session supports the prepare from URI command. |
| `long` | `https://developer.android.com/reference/android/media/session/PlaybackState#ACTION_REWIND` Indicates this session supports the rewind command. |
| `long` | `https://developer.android.com/reference/android/media/session/PlaybackState#ACTION_SEEK_TO` Indicates this session supports the seek to command. |
| `long` | `https://developer.android.com/reference/android/media/session/PlaybackState#ACTION_SET_PLAYBACK_SPEED` Indicates this session supports the set playback speed command. |
| `long` | `https://developer.android.com/reference/android/media/session/PlaybackState#ACTION_SET_RATING` Indicates this session supports the set rating command. |
| `long` | `https://developer.android.com/reference/android/media/session/PlaybackState#ACTION_SKIP_TO_NEXT` Indicates this session supports the next command. |
| `long` | `https://developer.android.com/reference/android/media/session/PlaybackState#ACTION_SKIP_TO_PREVIOUS` Indicates this session supports the previous command. |
| `long` | `https://developer.android.com/reference/android/media/session/PlaybackState#ACTION_SKIP_TO_QUEUE_ITEM` Indicates this session supports the skip to queue item command. |
| `long` | `https://developer.android.com/reference/android/media/session/PlaybackState#ACTION_STOP` Indicates this session supports the stop command. |
| `long` | `https://developer.android.com/reference/android/media/session/PlaybackState#PLAYBACK_POSITION_UNKNOWN` Use this value for the position to indicate the position is not known. |
| `int` | `https://developer.android.com/reference/android/media/session/PlaybackState#STATE_BUFFERING` State indicating this item is currently buffering and will begin playing when enough data has buffered. |
| `int` | `https://developer.android.com/reference/android/media/session/PlaybackState#STATE_CONNECTING` State indicating the class doing playback is currently connecting to a new destination. |
| `int` | `https://developer.android.com/reference/android/media/session/PlaybackState#STATE_ERROR` State indicating this item is currently in an error state. |
| `int` | `https://developer.android.com/reference/android/media/session/PlaybackState#STATE_FAST_FORWARDING` State indicating this item is currently fast forwarding. |
| `int` | `https://developer.android.com/reference/android/media/session/PlaybackState#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` | `https://developer.android.com/reference/android/media/session/PlaybackState#STATE_PAUSED` State indicating this item is currently paused. |
| `int` | `https://developer.android.com/reference/android/media/session/PlaybackState#STATE_PLAYING` State indicating this item is currently playing. |
| `int` | `https://developer.android.com/reference/android/media/session/PlaybackState#STATE_REWINDING` State indicating this item is currently rewinding. |
| `int` | `https://developer.android.com/reference/android/media/session/PlaybackState#STATE_SKIPPING_TO_NEXT` State indicating the player is currently skipping to the next item. |
| `int` | `https://developer.android.com/reference/android/media/session/PlaybackState#STATE_SKIPPING_TO_PREVIOUS` State indicating the player is currently skipping to the previous item. |
| `int` | `https://developer.android.com/reference/android/media/session/PlaybackState#STATE_SKIPPING_TO_QUEUE_ITEM` State indicating the player is currently skipping to a specific item in the queue. |
| `int` | `https://developer.android.com/reference/android/media/session/PlaybackState#STATE_STOPPED` State indicating this item is currently stopped. |

### Inherited constants

From interface `https://developer.android.com/reference/android/os/Parcelable` `int` `https://developer.android.com/reference/android/os/Parcelable#CONTENTS_FILE_DESCRIPTOR`

Descriptor bit used with `https://developer.android.com/reference/android/os/Parcelable#describeContents()`: indicates that the Parcelable object's flattened representation includes a file descriptor.
`int` `https://developer.android.com/reference/android/os/Parcelable#PARCELABLE_WRITE_RETURN_VALUE`

Flag for use with `https://developer.android.com/reference/android/os/Parcelable#writeToParcel(android.os.Parcel,%20int)`: the object being written is a return value, that is the result of a function such as "`Parcelable someFunction()`", "`void someFunction(out Parcelable)`", or "`void someFunction(inout Parcelable)`".

| ### Fields ||
|---|---|
| ` public static final https://developer.android.com/reference/android/os/Parcelable.Creator<https://developer.android.com/reference/android/media/session/PlaybackState>` | `https://developer.android.com/reference/android/media/session/PlaybackState#CREATOR` <br /> |

| ### Public methods ||
|---|---|
| ` int` | ` https://developer.android.com/reference/android/media/session/PlaybackState#describeContents()() ` Describe the kinds of special objects contained in this Parcelable instance's marshaled representation. |
| ` long` | ` https://developer.android.com/reference/android/media/session/PlaybackState#getActions()() ` Get the current actions available on this session. |
| ` long` | ` https://developer.android.com/reference/android/media/session/PlaybackState#getActiveQueueItemId()() ` Get the id of the currently active item in the queue. |
| ` long` | ` https://developer.android.com/reference/android/media/session/PlaybackState#getBufferedPosition()() ` Get the current buffered position in ms. |
| ` https://developer.android.com/reference/java/util/List<https://developer.android.com/reference/android/media/session/PlaybackState.CustomAction>` | ` https://developer.android.com/reference/android/media/session/PlaybackState#getCustomActions()() ` Get the list of custom actions. |
| ` https://developer.android.com/reference/java/lang/CharSequence` | ` https://developer.android.com/reference/android/media/session/PlaybackState#getErrorMessage()() ` Get a user readable error message. |
| ` https://developer.android.com/reference/android/os/Bundle` | ` https://developer.android.com/reference/android/media/session/PlaybackState#getExtras()() ` Get any custom extras that were set on this playback state. |
| ` long` | ` https://developer.android.com/reference/android/media/session/PlaybackState#getLastPositionUpdateTime()() ` Get the elapsed real time at which position was last updated. |
| ` float` | ` https://developer.android.com/reference/android/media/session/PlaybackState#getPlaybackSpeed()() ` Get the current playback speed as a multiple of normal playback. |
| ` long` | ` https://developer.android.com/reference/android/media/session/PlaybackState#getPosition()() ` Get the current playback position in ms. |
| ` int` | ` https://developer.android.com/reference/android/media/session/PlaybackState#getState()() ` Get the current state of playback. |
| ` boolean` | ` https://developer.android.com/reference/android/media/session/PlaybackState#isActive()() ` Returns whether this is considered as an active playback state. |
| ` https://developer.android.com/reference/java/lang/String` | ` https://developer.android.com/reference/android/media/session/PlaybackState#toString()() ` Returns a string representation of the object. |
| ` void` | ` https://developer.android.com/reference/android/media/session/PlaybackState#writeToParcel(android.os.Parcel,%20int)(https://developer.android.com/reference/android/os/Parcel dest, int flags) ` Flatten this object in to a Parcel. |

### Inherited methods

From class ` https://developer.android.com/reference/java/lang/Object ` ` https://developer.android.com/reference/java/lang/Object` ` https://developer.android.com/reference/java/lang/Object#clone()() `

Creates and returns a copy of this object.
` boolean` ` https://developer.android.com/reference/java/lang/Object#equals(java.lang.Object)(https://developer.android.com/reference/java/lang/Object obj) `

Indicates whether some other object is "equal to" this one.
` void` ` https://developer.android.com/reference/java/lang/Object#finalize()() `

Called by the garbage collector on an object when garbage collection determines that there are no more references to the object.
` final https://developer.android.com/reference/java/lang/Class<?>` ` https://developer.android.com/reference/java/lang/Object#getClass()() `

Returns the runtime class of this `Object`.
` int` ` https://developer.android.com/reference/java/lang/Object#hashCode()() `

Returns a hash code value for the object.
` final void` ` https://developer.android.com/reference/java/lang/Object#notify()() `

Wakes up a single thread that is waiting on this object's monitor.
` final void` ` https://developer.android.com/reference/java/lang/Object#notifyAll()() `

Wakes up all threads that are waiting on this object's monitor.
` https://developer.android.com/reference/java/lang/String` ` https://developer.android.com/reference/java/lang/Object#toString()() `

Returns a string representation of the object.
` final void` ` https://developer.android.com/reference/java/lang/Object#wait(long,%20int)(long timeoutMillis, int nanos) `

Causes the current thread to wait until it is awakened, typically by being *notified* or *interrupted*, or until a certain amount of real time has elapsed.
` final void` ` https://developer.android.com/reference/java/lang/Object#wait(long)(long timeoutMillis) `

Causes the current thread to wait until it is awakened, typically by being *notified* or *interrupted*, or until a certain amount of real time has elapsed.
` final void` ` https://developer.android.com/reference/java/lang/Object#wait()() `

Causes the current thread to wait until it is awakened, typically by being *notified* or *interrupted*.
From interface ` https://developer.android.com/reference/android/os/Parcelable ` ` abstract int` ` https://developer.android.com/reference/android/os/Parcelable#describeContents()() `

Describe the kinds of special objects contained in this Parcelable instance's marshaled representation.
` abstract void` ` https://developer.android.com/reference/android/os/Parcelable#writeToParcel(android.os.Parcel,%20int)(https://developer.android.com/reference/android/os/Parcel dest, int flags) `

Flatten this object in to a Parcel.

## Constants

### ACTION_FAST_FORWARD

Added in [API level 21](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final long ACTION_FAST_FORWARD
```

Indicates this session supports the fast forward command.

<br />

**See also:**

- `https://developer.android.com/reference/android/media/session/PlaybackState.Builder#setActions(long)`

Constant Value: 64 (0x0000000000000040)

### ACTION_PAUSE

Added in [API level 21](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final long ACTION_PAUSE
```

Indicates this session supports the pause command.

<br />

**See also:**

- `https://developer.android.com/reference/android/media/session/PlaybackState.Builder#setActions(long)`

Constant Value: 2 (0x0000000000000002)

### ACTION_PLAY

Added in [API level 21](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final long ACTION_PLAY
```

Indicates this session supports the play command.

<br />

**See also:**

- `https://developer.android.com/reference/android/media/session/PlaybackState.Builder#setActions(long)`

Constant Value: 4 (0x0000000000000004)

### ACTION_PLAY_FROM_MEDIA_ID

Added in [API level 21](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final long ACTION_PLAY_FROM_MEDIA_ID
```

Indicates this session supports the play from media id command.

<br />

**See also:**

- `https://developer.android.com/reference/android/media/session/PlaybackState.Builder#setActions(long)`

Constant Value: 1024 (0x0000000000000400)

### ACTION_PLAY_FROM_SEARCH

Added in [API level 21](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final long ACTION_PLAY_FROM_SEARCH
```

Indicates this session supports the play from search command.

<br />

**See also:**

- `https://developer.android.com/reference/android/media/session/PlaybackState.Builder#setActions(long)`

Constant Value: 2048 (0x0000000000000800)

### ACTION_PLAY_FROM_URI

Added in [API level 23](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final long ACTION_PLAY_FROM_URI
```

Indicates this session supports the play from URI command.

<br />

**See also:**

- `https://developer.android.com/reference/android/media/session/PlaybackState.Builder#setActions(long)`

Constant Value: 8192 (0x0000000000002000)

### ACTION_PLAY_PAUSE

Added in [API level 21](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final long ACTION_PLAY_PAUSE
```

Indicates this session supports the play/pause toggle command.

<br />

**See also:**

- `https://developer.android.com/reference/android/media/session/PlaybackState.Builder#setActions(long)`

Constant Value: 512 (0x0000000000000200)

### ACTION_PREPARE

Added in [API level 24](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final long ACTION_PREPARE
```

Indicates this session supports the prepare command.

<br />

**See also:**

- `https://developer.android.com/reference/android/media/session/PlaybackState.Builder#setActions(long)`

Constant Value: 16384 (0x0000000000004000)

### ACTION_PREPARE_FROM_MEDIA_ID

Added in [API level 24](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final long ACTION_PREPARE_FROM_MEDIA_ID
```

Indicates this session supports the prepare from media id command.

<br />

**See also:**

- `https://developer.android.com/reference/android/media/session/PlaybackState.Builder#setActions(long)`

Constant Value: 32768 (0x0000000000008000)

### ACTION_PREPARE_FROM_SEARCH

Added in [API level 24](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final long ACTION_PREPARE_FROM_SEARCH
```

Indicates this session supports the prepare from search command.

<br />

**See also:**

- `https://developer.android.com/reference/android/media/session/PlaybackState.Builder#setActions(long)`

Constant Value: 65536 (0x0000000000010000)

### ACTION_PREPARE_FROM_URI

Added in [API level 24](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final long ACTION_PREPARE_FROM_URI
```

Indicates this session supports the prepare from URI command.

<br />

**See also:**

- `https://developer.android.com/reference/android/media/session/PlaybackState.Builder#setActions(long)`

Constant Value: 131072 (0x0000000000020000)

### ACTION_REWIND

Added in [API level 21](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final long ACTION_REWIND
```

Indicates this session supports the rewind command.

<br />

**See also:**

- `https://developer.android.com/reference/android/media/session/PlaybackState.Builder#setActions(long)`

Constant Value: 8 (0x0000000000000008)

### ACTION_SEEK_TO

Added in [API level 21](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final long ACTION_SEEK_TO
```

Indicates this session supports the seek to command.

<br />

**See also:**

- `https://developer.android.com/reference/android/media/session/PlaybackState.Builder#setActions(long)`

Constant Value: 256 (0x0000000000000100)

### ACTION_SET_PLAYBACK_SPEED

Added in [API level 31](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final long ACTION_SET_PLAYBACK_SPEED
```

Indicates this session supports the set playback speed command.

<br />

**See also:**

- `https://developer.android.com/reference/android/media/session/PlaybackState.Builder#setActions(long)`

Constant Value: 4194304 (0x0000000000400000)

### ACTION_SET_RATING

Added in [API level 21](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final long ACTION_SET_RATING
```

Indicates this session supports the set rating command.

<br />

**See also:**

- `https://developer.android.com/reference/android/media/session/PlaybackState.Builder#setActions(long)`

Constant Value: 128 (0x0000000000000080)

### ACTION_SKIP_TO_NEXT

Added in [API level 21](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final long ACTION_SKIP_TO_NEXT
```

Indicates this session supports the next command.

<br />

**See also:**

- `https://developer.android.com/reference/android/media/session/PlaybackState.Builder#setActions(long)`

Constant Value: 32 (0x0000000000000020)

### ACTION_SKIP_TO_PREVIOUS

Added in [API level 21](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final long ACTION_SKIP_TO_PREVIOUS
```

Indicates this session supports the previous command.

<br />

**See also:**

- `https://developer.android.com/reference/android/media/session/PlaybackState.Builder#setActions(long)`

Constant Value: 16 (0x0000000000000010)

### ACTION_SKIP_TO_QUEUE_ITEM

Added in [API level 21](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final long ACTION_SKIP_TO_QUEUE_ITEM
```

Indicates this session supports the skip to queue item command.

<br />

**See also:**

- `https://developer.android.com/reference/android/media/session/PlaybackState.Builder#setActions(long)`

Constant Value: 4096 (0x0000000000001000)

### ACTION_STOP

Added in [API level 21](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final long ACTION_STOP
```

Indicates this session supports the stop command.

<br />

**See also:**

- `https://developer.android.com/reference/android/media/session/PlaybackState.Builder#setActions(long)`

Constant Value: 1 (0x0000000000000001)

### PLAYBACK_POSITION_UNKNOWN

Added in [API level 21](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final long PLAYBACK_POSITION_UNKNOWN
```

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

<br />

Constant Value: -1 (0xffffffffffffffff)

### STATE_BUFFERING

Added in [API level 21](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final int STATE_BUFFERING
```

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

<br />

**See also:**

- `https://developer.android.com/reference/android/media/session/PlaybackState.Builder#setState(int,%20long,%20float)`

Constant Value: 6 (0x00000006)

### STATE_CONNECTING

Added in [API level 21](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final int STATE_CONNECTING
```

State indicating the class doing playback is currently connecting to a new destination. Depending on the implementation you may return to the previous state when the connection finishes or enter `https://developer.android.com/reference/android/media/session/PlaybackState#STATE_NONE`. If the connection failed `https://developer.android.com/reference/android/media/session/PlaybackState#STATE_ERROR` should be used.

<br />

**See also:**

- `https://developer.android.com/reference/android/media/session/PlaybackState.Builder#setState(int,%20long,%20float)`

Constant Value: 8 (0x00000008)

### STATE_ERROR

Added in [API level 21](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final int STATE_ERROR
```

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

<br />

**See also:**

- `https://developer.android.com/reference/android/media/session/PlaybackState.Builder#setState(int,%20long,%20float)`

Constant Value: 7 (0x00000007)

### STATE_FAST_FORWARDING

Added in [API level 21](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final int STATE_FAST_FORWARDING
```

State indicating this item is currently fast forwarding.

<br />

**See also:**

- `https://developer.android.com/reference/android/media/session/PlaybackState.Builder#setState(int,%20long,%20float)`

Constant Value: 4 (0x00000004)

### STATE_NONE

Added in [API level 21](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final 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:**

- `https://developer.android.com/reference/android/media/session/PlaybackState.Builder#setState(int,%20long,%20float)`
- `https://developer.android.com/reference/android/media/session/PlaybackState.Builder#setState(int,%20long,%20float,%20long)`

Constant Value: 0 (0x00000000)

### STATE_PAUSED

Added in [API level 21](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final int STATE_PAUSED
```

State indicating this item is currently paused.

<br />

**See also:**

- `https://developer.android.com/reference/android/media/session/PlaybackState.Builder#setState(int,%20long,%20float)`

Constant Value: 2 (0x00000002)

### STATE_PLAYING

Added in [API level 21](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final int STATE_PLAYING
```

State indicating this item is currently playing.

<br />

**See also:**

- `https://developer.android.com/reference/android/media/session/PlaybackState.Builder#setState(int,%20long,%20float)`

Constant Value: 3 (0x00000003)

### STATE_REWINDING

Added in [API level 21](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final int STATE_REWINDING
```

State indicating this item is currently rewinding.

<br />

**See also:**

- `https://developer.android.com/reference/android/media/session/PlaybackState.Builder#setState(int,%20long,%20float)`

Constant Value: 5 (0x00000005)

### STATE_SKIPPING_TO_NEXT

Added in [API level 21](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final int STATE_SKIPPING_TO_NEXT
```

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

<br />

**See also:**

- `https://developer.android.com/reference/android/media/session/PlaybackState.Builder#setState(int,%20long,%20float)`

Constant Value: 10 (0x0000000a)

### STATE_SKIPPING_TO_PREVIOUS

Added in [API level 21](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final int STATE_SKIPPING_TO_PREVIOUS
```

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

<br />

**See also:**

- `https://developer.android.com/reference/android/media/session/PlaybackState.Builder#setState(int,%20long,%20float)`

Constant Value: 9 (0x00000009)

### STATE_SKIPPING_TO_QUEUE_ITEM

Added in [API level 21](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final int STATE_SKIPPING_TO_QUEUE_ITEM
```

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

<br />

**See also:**

- `https://developer.android.com/reference/android/media/session/PlaybackState.Builder#setState(int,%20long,%20float)`

Constant Value: 11 (0x0000000b)

### STATE_STOPPED

Added in [API level 21](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final int STATE_STOPPED
```

State indicating this item is currently stopped.

<br />

**See also:**

- `https://developer.android.com/reference/android/media/session/PlaybackState.Builder#setState(int,%20long,%20float)`

Constant Value: 1 (0x00000001)

## Fields

### CREATOR

Added in [API level 21](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final Creator<PlaybackState> CREATOR
```

<br />

<br />

## Public methods

### describeContents

Added in [API level 21](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public int describeContents ()
```

Describe the kinds of special objects contained in this Parcelable instance's marshaled representation. For example, if the object will include a file descriptor in the output of `https://developer.android.com/reference/android/os/Parcelable#writeToParcel(android.os.Parcel,%20int)`, the return value of this method must include the `https://developer.android.com/reference/android/os/Parcelable#CONTENTS_FILE_DESCRIPTOR` bit.

<br />

| Returns ||
|---|---|
| `int` | a bitmask indicating the set of special object types marshaled by this Parcelable object instance. Value is either `0` or - `https://developer.android.com/reference/android/os/Parcelable#CONTENTS_FILE_DESCRIPTOR` |

### getActions

Added in [API level 21](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public long getActions ()
```

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

- `https://developer.android.com/reference/android/media/session/PlaybackState#ACTION_SKIP_TO_PREVIOUS`
- `https://developer.android.com/reference/android/media/session/PlaybackState#ACTION_REWIND`
- `https://developer.android.com/reference/android/media/session/PlaybackState#ACTION_PLAY`
- `https://developer.android.com/reference/android/media/session/PlaybackState#ACTION_PAUSE`
- `https://developer.android.com/reference/android/media/session/PlaybackState#ACTION_STOP`
- `https://developer.android.com/reference/android/media/session/PlaybackState#ACTION_FAST_FORWARD`
- `https://developer.android.com/reference/android/media/session/PlaybackState#ACTION_SKIP_TO_NEXT`
- `https://developer.android.com/reference/android/media/session/PlaybackState#ACTION_SEEK_TO`
- `https://developer.android.com/reference/android/media/session/PlaybackState#ACTION_SET_RATING`
- `https://developer.android.com/reference/android/media/session/PlaybackState#ACTION_PLAY_PAUSE`
- `https://developer.android.com/reference/android/media/session/PlaybackState#ACTION_PLAY_FROM_MEDIA_ID`
- `https://developer.android.com/reference/android/media/session/PlaybackState#ACTION_PLAY_FROM_SEARCH`
- `https://developer.android.com/reference/android/media/session/PlaybackState#ACTION_SKIP_TO_QUEUE_ITEM`
- `https://developer.android.com/reference/android/media/session/PlaybackState#ACTION_PLAY_FROM_URI`
- `https://developer.android.com/reference/android/media/session/PlaybackState#ACTION_PREPARE`
- `https://developer.android.com/reference/android/media/session/PlaybackState#ACTION_PREPARE_FROM_MEDIA_ID`
- `https://developer.android.com/reference/android/media/session/PlaybackState#ACTION_PREPARE_FROM_SEARCH`
- `https://developer.android.com/reference/android/media/session/PlaybackState#ACTION_PREPARE_FROM_URI`
- `https://developer.android.com/reference/android/media/session/PlaybackState#ACTION_SET_PLAYBACK_SPEED`

<br />

<br />

| Returns ||
|---|---|
| `long` | Value is either `0` or a combination of the following: - `https://developer.android.com/reference/android/media/session/PlaybackState#ACTION_STOP` - `https://developer.android.com/reference/android/media/session/PlaybackState#ACTION_PAUSE` - `https://developer.android.com/reference/android/media/session/PlaybackState#ACTION_PLAY` - `https://developer.android.com/reference/android/media/session/PlaybackState#ACTION_REWIND` - `https://developer.android.com/reference/android/media/session/PlaybackState#ACTION_SKIP_TO_PREVIOUS` - `https://developer.android.com/reference/android/media/session/PlaybackState#ACTION_SKIP_TO_NEXT` - `https://developer.android.com/reference/android/media/session/PlaybackState#ACTION_FAST_FORWARD` - `https://developer.android.com/reference/android/media/session/PlaybackState#ACTION_SET_RATING` - `https://developer.android.com/reference/android/media/session/PlaybackState#ACTION_SEEK_TO` - `https://developer.android.com/reference/android/media/session/PlaybackState#ACTION_PLAY_PAUSE` - `https://developer.android.com/reference/android/media/session/PlaybackState#ACTION_PLAY_FROM_MEDIA_ID` - `https://developer.android.com/reference/android/media/session/PlaybackState#ACTION_PLAY_FROM_SEARCH` - `https://developer.android.com/reference/android/media/session/PlaybackState#ACTION_SKIP_TO_QUEUE_ITEM` - `https://developer.android.com/reference/android/media/session/PlaybackState#ACTION_PLAY_FROM_URI` - `https://developer.android.com/reference/android/media/session/PlaybackState#ACTION_PREPARE` - `https://developer.android.com/reference/android/media/session/PlaybackState#ACTION_PREPARE_FROM_MEDIA_ID` - `https://developer.android.com/reference/android/media/session/PlaybackState#ACTION_PREPARE_FROM_SEARCH` - `https://developer.android.com/reference/android/media/session/PlaybackState#ACTION_PREPARE_FROM_URI` - `https://developer.android.com/reference/android/media/session/PlaybackState#ACTION_SET_PLAYBACK_SPEED` |

### getActiveQueueItemId

Added in [API level 21](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public 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 `https://developer.android.com/reference/android/media/session/MediaSession.QueueItem#UNKNOWN_ID`.

<br />

| Returns ||
|---|---|
| `long` | The id of the currently active item in the queue or `https://developer.android.com/reference/android/media/session/MediaSession.QueueItem#UNKNOWN_ID`. <br /> |

### getBufferedPosition

Added in [API level 21](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public 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 [API level 21](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public List<PlaybackState.CustomAction> getCustomActions ()
```

Get the list of custom actions.

<br />

| Returns ||
|---|---|
| `https://developer.android.com/reference/java/util/List<https://developer.android.com/reference/android/media/session/PlaybackState.CustomAction>` | <br /> |

### getErrorMessage

Added in [API level 21](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public CharSequence getErrorMessage ()
```

Get a user readable error message. This should be set when the state is `https://developer.android.com/reference/android/media/session/PlaybackState#STATE_ERROR`.

<br />

| Returns ||
|---|---|
| `https://developer.android.com/reference/java/lang/CharSequence` | <br /> |

### getExtras

Added in [API level 22](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public Bundle getExtras ()
```

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

<br />

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/os/Bundle` | The extras for this state or null. <br /> |

### getLastPositionUpdateTime

Added in [API level 21](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public 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 [API level 21](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public 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 /> |

### getPosition

Added in [API level 21](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public long getPosition ()
```

Get the current playback position in ms.

<br />

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

### getState

Added in [API level 21](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public int getState ()
```

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

- `https://developer.android.com/reference/android/media/session/PlaybackState#STATE_NONE`
- `https://developer.android.com/reference/android/media/session/PlaybackState#STATE_STOPPED`
- `https://developer.android.com/reference/android/media/session/PlaybackState#STATE_PLAYING`
- `https://developer.android.com/reference/android/media/session/PlaybackState#STATE_PAUSED`
- `https://developer.android.com/reference/android/media/session/PlaybackState#STATE_FAST_FORWARDING`
- `https://developer.android.com/reference/android/media/session/PlaybackState#STATE_REWINDING`
- `https://developer.android.com/reference/android/media/session/PlaybackState#STATE_BUFFERING`
- `https://developer.android.com/reference/android/media/session/PlaybackState#STATE_ERROR`
- `https://developer.android.com/reference/android/media/session/PlaybackState#STATE_CONNECTING`
- `https://developer.android.com/reference/android/media/session/PlaybackState#STATE_SKIPPING_TO_PREVIOUS`
- `https://developer.android.com/reference/android/media/session/PlaybackState#STATE_SKIPPING_TO_NEXT`
- `https://developer.android.com/reference/android/media/session/PlaybackState#STATE_SKIPPING_TO_QUEUE_ITEM`

<br />

<br />

| Returns ||
|---|---|
| `int` | Value is one of the following: - `https://developer.android.com/reference/android/media/session/PlaybackState#STATE_NONE` - `https://developer.android.com/reference/android/media/session/PlaybackState#STATE_STOPPED` - `https://developer.android.com/reference/android/media/session/PlaybackState#STATE_PAUSED` - `https://developer.android.com/reference/android/media/session/PlaybackState#STATE_PLAYING` - `https://developer.android.com/reference/android/media/session/PlaybackState#STATE_FAST_FORWARDING` - `https://developer.android.com/reference/android/media/session/PlaybackState#STATE_REWINDING` - `https://developer.android.com/reference/android/media/session/PlaybackState#STATE_BUFFERING` - `https://developer.android.com/reference/android/media/session/PlaybackState#STATE_ERROR` - `https://developer.android.com/reference/android/media/session/PlaybackState#STATE_CONNECTING` - `https://developer.android.com/reference/android/media/session/PlaybackState#STATE_SKIPPING_TO_PREVIOUS` - `https://developer.android.com/reference/android/media/session/PlaybackState#STATE_SKIPPING_TO_NEXT` - `https://developer.android.com/reference/android/media/session/PlaybackState#STATE_SKIPPING_TO_QUEUE_ITEM` |

### isActive

Added in [API level 31](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public boolean isActive ()
```

Returns whether this is considered as an active playback state.

The playback state is considered as an active if the state is one of the following:

- `https://developer.android.com/reference/android/media/session/PlaybackState#STATE_BUFFERING`
- `https://developer.android.com/reference/android/media/session/PlaybackState#STATE_CONNECTING`
- `https://developer.android.com/reference/android/media/session/PlaybackState#STATE_FAST_FORWARDING`
- `https://developer.android.com/reference/android/media/session/PlaybackState#STATE_PLAYING`
- `https://developer.android.com/reference/android/media/session/PlaybackState#STATE_REWINDING`
- `https://developer.android.com/reference/android/media/session/PlaybackState#STATE_SKIPPING_TO_NEXT`
- `https://developer.android.com/reference/android/media/session/PlaybackState#STATE_SKIPPING_TO_PREVIOUS`
- `https://developer.android.com/reference/android/media/session/PlaybackState#STATE_SKIPPING_TO_QUEUE_ITEM`

<br />

<br />

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

### toString

Added in [API level 21](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public String toString ()
```

Returns a string representation of the object.

<br />

| Returns ||
|---|---|
| `https://developer.android.com/reference/java/lang/String` | a string representation of the object. <br /> |

### writeToParcel

Added in [API level 21](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

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

Flatten this object in to a Parcel.

<br />

| Parameters ||
|---|---|
| `dest` | `Parcel`: The Parcel in which the object should be written. This value cannot be `null`. <br /> |
| `flags` | `int`: Additional flags about how the object should be written. May be 0 or `https://developer.android.com/reference/android/os/Parcelable#PARCELABLE_WRITE_RETURN_VALUE`. Value is either `0` or a combination of the following: - `https://developer.android.com/reference/android/os/Parcelable#PARCELABLE_WRITE_RETURN_VALUE` |