# PlayerTransferState

Artifact: [androidx.media3:media3-common](https://developer.android.com/jetpack/androidx/releases/media3) [View Source](https://cs.android.com/search?q=file:androidx/media3/common/PlayerTransferState.java+class:androidx.media3.common.PlayerTransferState)

*** ** * ** ***


```
@UnstableApi
class PlayerTransferState
```

<br />

*** ** * ** ***

Holds a snapshot of a `https://developer.android.com/reference/kotlin/androidx/media3/common/Player` transferable state.

We define transferable state to be state that should be carried over from one player to another when transferring playback. For example, the media playlist and the playback position are part of the transferable state. However, the buffering position is part of the player's state but it's not state we carry over when moving playback.

This class is useful when moving playback across devices. For example, across an Android device and a Cast receiver.

## Summary

| ### Nested types |
|---|
| `class https://developer.android.com/reference/kotlin/androidx/media3/common/PlayerTransferState.Builder` Builder for `https://developer.android.com/reference/kotlin/androidx/media3/common/PlayerTransferState`. |

| ### Public functions |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/media3/common/PlayerTransferState.Builder!` | `https://developer.android.com/reference/kotlin/androidx/media3/common/PlayerTransferState#buildUpon()()` Returns a `https://developer.android.com/reference/kotlin/androidx/media3/common/PlayerTransferState.Builder` pre-populated with the current state values. |
| `java-static https://developer.android.com/reference/kotlin/androidx/media3/common/PlayerTransferState.Builder!` | `https://developer.android.com/reference/kotlin/androidx/media3/common/PlayerTransferState#builderFromPlayer(androidx.media3.common.Player)(player: https://developer.android.com/reference/kotlin/androidx/media3/common/Player!)` Creates a new `https://developer.android.com/reference/kotlin/androidx/media3/common/PlayerTransferState.Builder` that's pre-populated with the values from the given `https://developer.android.com/reference/kotlin/androidx/media3/common/Player`. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | `https://developer.android.com/reference/kotlin/androidx/media3/common/PlayerTransferState#equals(java.lang.Object)(o: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-any/index.html?)` |
| `java-static https://developer.android.com/reference/kotlin/androidx/media3/common/PlayerTransferState!` | `https://developer.android.com/reference/kotlin/androidx/media3/common/PlayerTransferState#fromPlayer(androidx.media3.common.Player)(player: https://developer.android.com/reference/kotlin/androidx/media3/common/Player!)` Equivalent to `https://developer.android.com/reference/kotlin/androidx/media3/common/PlayerTransferState#builderFromPlayer(androidx.media3.common.Player)`. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/media3/common/PlayerTransferState#hashCode()()` |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `https://developer.android.com/reference/kotlin/androidx/media3/common/PlayerTransferState#setToPlayer(androidx.media3.common.Player)(player: https://developer.android.com/reference/kotlin/androidx/media3/common/Player!)` Applies this state to a given `https://developer.android.com/reference/kotlin/androidx/media3/common/Player` instance by calling the corresponding setters. |

| ### Public properties |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/media3/common/PlayerTransferState#currentMediaItemIndex()` |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html` | `https://developer.android.com/reference/kotlin/androidx/media3/common/PlayerTransferState#currentPosition()` |
| `https://guava.dev/releases/snapshot-android/api/docs/com/google/common/collect/ImmutableList.html<https://developer.android.com/reference/kotlin/androidx/media3/common/MediaItem!>!` | `https://developer.android.com/reference/kotlin/androidx/media3/common/PlayerTransferState#mediaItems()` |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | `https://developer.android.com/reference/kotlin/androidx/media3/common/PlayerTransferState#playWhenReady()` |
| `https://developer.android.com/reference/kotlin/androidx/media3/common/PlaybackParameters!` | `https://developer.android.com/reference/kotlin/androidx/media3/common/PlayerTransferState#playbackParameters()` |
| `https://developer.android.com/reference/kotlin/androidx/media3/common/MediaMetadata!` | `https://developer.android.com/reference/kotlin/androidx/media3/common/PlayerTransferState#playlistMetadata()` |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/media3/common/PlayerTransferState#repeatMode()` |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | `https://developer.android.com/reference/kotlin/androidx/media3/common/PlayerTransferState#shuffleModeEnabled()` |
| `https://developer.android.com/reference/kotlin/androidx/media3/common/TrackSelectionParameters!` | `https://developer.android.com/reference/kotlin/androidx/media3/common/PlayerTransferState#trackSelectionParameters()` |

## Public functions

### buildUpon

```
fun buildUpon(): PlayerTransferState.Builder!
```

Returns a `https://developer.android.com/reference/kotlin/androidx/media3/common/PlayerTransferState.Builder` pre-populated with the current state values.

### builderFromPlayer

```
java-static fun builderFromPlayer(player: Player!): PlayerTransferState.Builder!
```

Creates a new `https://developer.android.com/reference/kotlin/androidx/media3/common/PlayerTransferState.Builder` that's pre-populated with the values from the given `https://developer.android.com/reference/kotlin/androidx/media3/common/Player`.

| Parameters |
|---|---|
| `player: https://developer.android.com/reference/kotlin/androidx/media3/common/Player!` | The `https://developer.android.com/reference/kotlin/androidx/media3/common/Player` instance to populate the builder from. |

| Returns |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/media3/common/PlayerTransferState.Builder!` | A new `https://developer.android.com/reference/kotlin/androidx/media3/common/PlayerTransferState.Builder` instance populated with the given player's current state. |

### equals

```
fun equals(o: Any?): Boolean
```

### fromPlayer

```
java-static fun fromPlayer(player: Player!): PlayerTransferState!
```

Equivalent to `https://developer.android.com/reference/kotlin/androidx/media3/common/PlayerTransferState#builderFromPlayer(androidx.media3.common.Player)`.

| Returns |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/media3/common/PlayerTransferState!` | A `https://developer.android.com/reference/kotlin/androidx/media3/common/PlayerTransferState` whose contents are populated with the state from the given `https://developer.android.com/reference/kotlin/androidx/media3/common/Player`. |

### hashCode

```
fun hashCode(): Int
```

### setToPlayer

```
fun setToPlayer(player: Player!): Unit
```

Applies this state to a given `https://developer.android.com/reference/kotlin/androidx/media3/common/Player` instance by calling the corresponding setters.

| Parameters |
|---|---|
| `player: https://developer.android.com/reference/kotlin/androidx/media3/common/Player!` | The `https://developer.android.com/reference/kotlin/androidx/media3/common/Player` instance to which the state should be applied. |

## Public properties

### currentMediaItemIndex

```
val currentMediaItemIndex: Int
```

### currentPosition

```
val currentPosition: Long
```

### mediaItems

```
val mediaItems: ImmutableList<MediaItem!>!
```

### playWhenReady

```
val playWhenReady: Boolean
```

### playbackParameters

```
val playbackParameters: PlaybackParameters!
```

### playlistMetadata

```
val playlistMetadata: MediaMetadata!
```

### repeatMode

```
val repeatMode: Int
```

### shuffleModeEnabled

```
val shuffleModeEnabled: Boolean
```

### trackSelectionParameters

```
val trackSelectionParameters: TrackSelectionParameters!
```