# RemoteCastPlayer

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

*** ** * ** ***


```
@UnstableApi
public final class RemoteCastPlayer extends BasePlayer
```

<br />

|---|---|---|
| [java.lang.Object](https://developer.android.com/reference/java/lang/Object.html) |||
| ↳ | [androidx.media3.common.BasePlayer](https://developer.android.com/reference/androidx/media3/common/BasePlayer) ||
|   | ↳ | [androidx.media3.cast.RemoteCastPlayer](https://developer.android.com/reference/androidx/media3/cast/RemoteCastPlayer) |

*** ** * ** ***

`https://developer.android.com/reference/androidx/media3/common/Player` implementation that communicates with a Cast receiver app.

The behavior of this class depends on the underlying Cast session, which is obtained from the injected `https://developers.google.com/android/reference/com/google/android/gms/cast/framework/CastContext.html`. To keep track of the session, `https://developer.android.com/reference/androidx/media3/cast/RemoteCastPlayer#isCastSessionAvailable()` can be queried and `https://developer.android.com/reference/androidx/media3/cast/SessionAvailabilityListener` can be implemented and attached to the player.

If no session is available, the player state will remain unchanged and calls to methods that alter it will be ignored. Querying the player state is possible even when no session is available, in which case, the last observed receiver app state is reported.

Methods should be called on the application's main thread.

## Summary

| ### Nested types |
|---|
| `@https://developer.android.com/reference/androidx/media3/common/util/UnstableApi public final class https://developer.android.com/reference/androidx/media3/cast/RemoteCastPlayer.Builder` A builder for `https://developer.android.com/reference/androidx/media3/cast/RemoteCastPlayer` instances. |

| ### Constants |
|---|---|
| `static final https://developer.android.com/reference/androidx/media3/common/DeviceInfo` | `https://developer.android.com/reference/androidx/media3/cast/RemoteCastPlayer#DEVICE_INFO_REMOTE_EMPTY()` A `https://developer.android.com/reference/androidx/media3/common/DeviceInfo#PLAYBACK_TYPE_REMOTE()``https://developer.android.com/reference/androidx/media3/common/DeviceInfo` with a null `https://developer.android.com/reference/androidx/media3/common/DeviceInfo#routingControllerId()`. |
| `static final float` | `https://developer.android.com/reference/androidx/media3/cast/RemoteCastPlayer#MAX_SPEED_SUPPORTED() = 2.0f` |
| `static final float` | `https://developer.android.com/reference/androidx/media3/cast/RemoteCastPlayer#MIN_SPEED_SUPPORTED() = 0.5f` |

| ### Public fields |
|---|---|
| `https://developer.android.com/reference/androidx/media3/common/Player.Commands` | `https://developer.android.com/reference/androidx/media3/cast/RemoteCastPlayer#availableCommands()` |
| `https://developer.android.com/reference/androidx/media3/common/DeviceInfo` | `https://developer.android.com/reference/androidx/media3/cast/RemoteCastPlayer#deviceInfo()` |
| `int` | `https://developer.android.com/reference/androidx/media3/cast/RemoteCastPlayer#deviceVolume()` **The setter for this field is deprecated.** Deprecated in Java |
| `https://developer.android.com/reference/androidx/media3/common/MediaMetadata` | `https://developer.android.com/reference/androidx/media3/cast/RemoteCastPlayer#mediaMetadata()` |
| `int` | `@https://developer.android.com/reference/androidx/media3/common/Player.State https://developer.android.com/reference/androidx/media3/cast/RemoteCastPlayer#playbackState()` |
| `https://developer.android.com/reference/androidx/media3/common/MediaMetadata` | `https://developer.android.com/reference/androidx/media3/cast/RemoteCastPlayer#playlistMetadata()` |

| ### Public methods |
|---|---|
| `void` | `https://developer.android.com/reference/androidx/media3/cast/RemoteCastPlayer#addListener(androidx.media3.common.Player.Listener)(https://developer.android.com/reference/androidx/media3/common/Player.Listener listener)` Registers a listener to receive all events from the player. |
| `void` | `https://developer.android.com/reference/androidx/media3/cast/RemoteCastPlayer#addMediaItems(int,java.util.List<androidx.media3.common.MediaItem>)(int index, https://developer.android.com/reference/java/util/List.html<https://developer.android.com/reference/androidx/media3/common/MediaItem> mediaItems)` Adds a list of media items at the given index of the playlist. |
| `void` | `https://developer.android.com/reference/androidx/media3/cast/RemoteCastPlayer#clearVideoSurface()()` This method is not supported and does nothing. |
| `void` | `https://developer.android.com/reference/androidx/media3/cast/RemoteCastPlayer#clearVideoSurface(android.view.Surface)(@https://developer.android.com/reference/androidx/annotation/Nullable https://developer.android.com/reference/android/view/Surface.html surface)` This method is not supported and does nothing. |
| `void` | `https://developer.android.com/reference/androidx/media3/cast/RemoteCastPlayer#clearVideoSurfaceHolder(android.view.SurfaceHolder)(@https://developer.android.com/reference/androidx/annotation/Nullable https://developer.android.com/reference/android/view/SurfaceHolder.html surfaceHolder)` This method is not supported and does nothing. |
| `void` | `https://developer.android.com/reference/androidx/media3/cast/RemoteCastPlayer#clearVideoSurfaceView(android.view.SurfaceView)(@https://developer.android.com/reference/androidx/annotation/Nullable https://developer.android.com/reference/android/view/SurfaceView.html surfaceView)` This method is not supported and does nothing. |
| `void` | `https://developer.android.com/reference/androidx/media3/cast/RemoteCastPlayer#clearVideoTextureView(android.view.TextureView)(@https://developer.android.com/reference/androidx/annotation/Nullable https://developer.android.com/reference/android/view/TextureView.html textureView)` This method is not supported and does nothing. |
| `void` | `@https://checkerframework.org/api/com/google/errorprone/annotations/InlineMe.html(replacement = "this.decreaseDeviceVolume(0)") [decreaseDeviceVolume](https://developer.android.com/reference/androidx/media3/cast/RemoteCastPlayer#decreaseDeviceVolume())()` **This method is deprecated.** Use `https://developer.android.com/reference/androidx/media3/cast/RemoteCastPlayer#decreaseDeviceVolume(int)` instead. <br /> |
| `void` | `https://developer.android.com/reference/androidx/media3/cast/RemoteCastPlayer#decreaseDeviceVolume(int)(@https://developer.android.com/reference/androidx/media3/common/C.VolumeFlags int flags)` Decreases the volume of the device. |
| `https://developer.android.com/reference/android/os/Looper.html` | `https://developer.android.com/reference/androidx/media3/cast/RemoteCastPlayer#getApplicationLooper()()` Returns the `https://developer.android.com/reference/android/os/Looper.html` associated with the application thread that's used to access the player and on which player events are received. |
| `https://developer.android.com/reference/androidx/media3/common/AudioAttributes` | `https://developer.android.com/reference/androidx/media3/cast/RemoteCastPlayer#getAudioAttributes()()` This method is not supported and returns `https://developer.android.com/reference/androidx/media3/common/AudioAttributes#DEFAULT()`. |
| `https://developer.android.com/reference/androidx/media3/common/Player.Commands` | `https://developer.android.com/reference/androidx/media3/cast/RemoteCastPlayer#getAvailableCommands()()` Returns the player's currently available `https://developer.android.com/reference/androidx/media3/common/Player.Commands`. |
| `long` | `https://developer.android.com/reference/androidx/media3/cast/RemoteCastPlayer#getBufferedPosition()()` Returns an estimate of the position in the current content or ad up to which data is buffered, in milliseconds. |
| `long` | `https://developer.android.com/reference/androidx/media3/cast/RemoteCastPlayer#getContentBufferedPosition()()` If `https://developer.android.com/reference/androidx/media3/common/Player#isPlayingAd()` returns `true`, returns an estimate of the content position in the current content up to which data is buffered, in milliseconds. |
| `long` | `https://developer.android.com/reference/androidx/media3/cast/RemoteCastPlayer#getContentPosition()()` If `https://developer.android.com/reference/androidx/media3/common/Player#isPlayingAd()` returns `true`, returns the content position that will be played once all ads in the ad group have finished playing, in milliseconds. |
| `int` | `https://developer.android.com/reference/androidx/media3/cast/RemoteCastPlayer#getCurrentAdGroupIndex()()` If `https://developer.android.com/reference/androidx/media3/common/Player#isPlayingAd()` returns true, returns the index of the ad group in the period currently being played. |
| `int` | `https://developer.android.com/reference/androidx/media3/cast/RemoteCastPlayer#getCurrentAdIndexInAdGroup()()` If `https://developer.android.com/reference/androidx/media3/common/Player#isPlayingAd()` returns true, returns the index of the ad in its ad group. |
| `https://developer.android.com/reference/androidx/media3/common/text/CueGroup` | `https://developer.android.com/reference/androidx/media3/cast/RemoteCastPlayer#getCurrentCues()()` This method is not supported and returns an empty `https://developer.android.com/reference/androidx/media3/common/text/CueGroup`. |
| `int` | `https://developer.android.com/reference/androidx/media3/cast/RemoteCastPlayer#getCurrentMediaItemIndex()()` Returns the index of the current `https://developer.android.com/reference/androidx/media3/common/MediaItem` in the `https://developer.android.com/reference/androidx/media3/common/Player#getCurrentTimeline()`, or the prospective index if the `https://developer.android.com/reference/androidx/media3/common/Player#getCurrentTimeline()` is empty. |
| `int` | `https://developer.android.com/reference/androidx/media3/cast/RemoteCastPlayer#getCurrentPeriodIndex()()` Returns the index of the period currently being played. |
| `long` | `https://developer.android.com/reference/androidx/media3/cast/RemoteCastPlayer#getCurrentPosition()()` Returns the playback position in the current content or ad, in milliseconds, or the prospective position in milliseconds if the `https://developer.android.com/reference/androidx/media3/common/Player#getCurrentTimeline()` is empty. |
| `https://developer.android.com/reference/androidx/media3/common/Timeline` | `https://developer.android.com/reference/androidx/media3/cast/RemoteCastPlayer#getCurrentTimeline()()` Returns the current `https://developer.android.com/reference/androidx/media3/common/Timeline`. |
| `https://developer.android.com/reference/androidx/media3/common/Tracks` | `https://developer.android.com/reference/androidx/media3/cast/RemoteCastPlayer#getCurrentTracks()()` Returns the current tracks. |
| `https://developer.android.com/reference/androidx/media3/common/DeviceInfo` | `https://developer.android.com/reference/androidx/media3/cast/RemoteCastPlayer#getDeviceInfo()()` Returns a `https://developer.android.com/reference/androidx/media3/common/DeviceInfo` describing the receiver device. |
| `int` | `https://developer.android.com/reference/androidx/media3/cast/RemoteCastPlayer#getDeviceVolume()()` Gets the current volume of the device. |
| `long` | `https://developer.android.com/reference/androidx/media3/cast/RemoteCastPlayer#getDuration()()` Returns the duration of the current content or ad in milliseconds, or `https://developer.android.com/reference/androidx/media3/common/C#TIME_UNSET()` if the duration is not known. |
| `@https://developer.android.com/reference/androidx/annotation/Nullable https://developers.google.com/android/reference/com/google/android/gms/cast/MediaQueueItem.html` | `[getItem](https://developer.android.com/reference/androidx/media3/cast/RemoteCastPlayer#getItem(int))(int periodId)` **This method is deprecated.** Use `https://developer.android.com/reference/androidx/media3/cast/RemoteCastPlayer#getCurrentTimeline()` to get `https://developer.android.com/reference/androidx/media3/common/Timeline.Window#mediaItem()` via `https://developer.android.com/reference/androidx/media3/common/Timeline#getPeriodByUid(java.lang.Object,androidx.media3.common.Timeline.Period)` and `https://developer.android.com/reference/androidx/media3/common/Timeline#getWindow(int,androidx.media3.common.Timeline.Window)`. <br /> |
| `long` | `https://developer.android.com/reference/androidx/media3/cast/RemoteCastPlayer#getMaxSeekToPreviousPosition()()` Returns the maximum position for which `https://developer.android.com/reference/androidx/media3/common/Player#seekToPrevious()` seeks to the previous `https://developer.android.com/reference/androidx/media3/common/MediaItem`, in milliseconds. |
| `https://developer.android.com/reference/androidx/media3/common/MediaMetadata` | `https://developer.android.com/reference/androidx/media3/cast/RemoteCastPlayer#getMediaMetadata()()` Returns the current combined `https://developer.android.com/reference/androidx/media3/common/MediaMetadata`, or `https://developer.android.com/reference/androidx/media3/common/MediaMetadata#EMPTY()` if not supported. |
| `boolean` | `https://developer.android.com/reference/androidx/media3/cast/RemoteCastPlayer#getPlayWhenReady()()` Whether playback will proceed when `https://developer.android.com/reference/androidx/media3/common/Player#getPlaybackState()` == `https://developer.android.com/reference/androidx/media3/common/Player#STATE_READY()`. |
| `https://developer.android.com/reference/androidx/media3/common/PlaybackParameters` | `https://developer.android.com/reference/androidx/media3/cast/RemoteCastPlayer#getPlaybackParameters()()` Returns the currently active playback parameters. |
| `int` | `@https://developer.android.com/reference/androidx/media3/common/Player.State https://developer.android.com/reference/androidx/media3/cast/RemoteCastPlayer#getPlaybackState()()` Returns the current `https://developer.android.com/reference/androidx/media3/common/Player.State` of the player. |
| `int` | `@https://developer.android.com/reference/androidx/media3/common/Player.PlaybackSuppressionReason https://developer.android.com/reference/androidx/media3/cast/RemoteCastPlayer#getPlaybackSuppressionReason()()` Returns the reason why playback is suppressed even though `https://developer.android.com/reference/androidx/media3/common/Player#getPlayWhenReady()` is ` true`, or `https://developer.android.com/reference/androidx/media3/common/Player#PLAYBACK_SUPPRESSION_REASON_NONE()` if playback is not suppressed. |
| `@https://developer.android.com/reference/androidx/annotation/Nullable https://developer.android.com/reference/androidx/media3/common/PlaybackException` | `https://developer.android.com/reference/androidx/media3/cast/RemoteCastPlayer#getPlayerError()()` Returns the error that caused playback to fail. |
| `https://developer.android.com/reference/androidx/media3/common/MediaMetadata` | `https://developer.android.com/reference/androidx/media3/cast/RemoteCastPlayer#getPlaylistMetadata()()` Returns the playlist `https://developer.android.com/reference/androidx/media3/common/MediaMetadata`, as set by `https://developer.android.com/reference/androidx/media3/common/Player#setPlaylistMetadata(androidx.media3.common.MediaMetadata)`, or `https://developer.android.com/reference/androidx/media3/common/MediaMetadata#EMPTY()` if not supported. |
| `int` | `@https://developer.android.com/reference/androidx/media3/common/Player.RepeatMode https://developer.android.com/reference/androidx/media3/cast/RemoteCastPlayer#getRepeatMode()()` Returns the current `https://developer.android.com/reference/androidx/media3/common/Player.RepeatMode` used for playback. |
| `long` | `https://developer.android.com/reference/androidx/media3/cast/RemoteCastPlayer#getSeekBackIncrement()()` Returns the `https://developer.android.com/reference/androidx/media3/common/Player#seekBack()` increment. |
| `long` | `https://developer.android.com/reference/androidx/media3/cast/RemoteCastPlayer#getSeekForwardIncrement()()` Returns the `https://developer.android.com/reference/androidx/media3/common/Player#seekForward()` increment. |
| `boolean` | `https://developer.android.com/reference/androidx/media3/cast/RemoteCastPlayer#getShuffleModeEnabled()()` Returns whether shuffling of media items is enabled. |
| `https://developer.android.com/reference/androidx/media3/common/util/Size` | `https://developer.android.com/reference/androidx/media3/cast/RemoteCastPlayer#getSurfaceSize()()` This method is not supported and returns `https://developer.android.com/reference/androidx/media3/common/util/Size#UNKNOWN()`. |
| `long` | `https://developer.android.com/reference/androidx/media3/cast/RemoteCastPlayer#getTotalBufferedDuration()()` Returns an estimate of the total buffered duration from the current position, in milliseconds. |
| `https://developer.android.com/reference/androidx/media3/common/TrackSelectionParameters` | `https://developer.android.com/reference/androidx/media3/cast/RemoteCastPlayer#getTrackSelectionParameters()()` Returns the parameters constraining the track selection. |
| `https://developer.android.com/reference/androidx/media3/common/VideoSize` | `https://developer.android.com/reference/androidx/media3/cast/RemoteCastPlayer#getVideoSize()()` This method is not supported and returns `https://developer.android.com/reference/androidx/media3/common/VideoSize#UNKNOWN()`. |
| `float` | `https://developer.android.com/reference/androidx/media3/cast/RemoteCastPlayer#getVolume()()` Returns the audio volume, with 0 being silence and 1 being unity gain (signal unchanged). |
| `void` | `@https://checkerframework.org/api/com/google/errorprone/annotations/InlineMe.html(replacement = "this.increaseDeviceVolume(0)") [increaseDeviceVolume](https://developer.android.com/reference/androidx/media3/cast/RemoteCastPlayer#increaseDeviceVolume())()` **This method is deprecated.** Use `https://developer.android.com/reference/androidx/media3/cast/RemoteCastPlayer#increaseDeviceVolume(int)` instead. <br /> |
| `void` | `https://developer.android.com/reference/androidx/media3/cast/RemoteCastPlayer#increaseDeviceVolume(int)(@https://developer.android.com/reference/androidx/media3/common/C.VolumeFlags int flags)` Increases the volume of the device. |
| `boolean` | `https://developer.android.com/reference/androidx/media3/cast/RemoteCastPlayer#isCastSessionAvailable()()` Returns whether a cast session is available. |
| `boolean` | `https://developer.android.com/reference/androidx/media3/cast/RemoteCastPlayer#isDeviceMuted()()` Gets whether the device is muted or not. |
| `boolean` | `https://developer.android.com/reference/androidx/media3/cast/RemoteCastPlayer#isLoading()()` Whether the player is currently loading the source. |
| `boolean` | `https://developer.android.com/reference/androidx/media3/cast/RemoteCastPlayer#isPlayingAd()()` Returns whether the player is currently playing an ad. |
| `void` | `https://developer.android.com/reference/androidx/media3/cast/RemoteCastPlayer#moveMediaItems(int,int,int)(int fromIndex, int toIndex, int newIndex)` Moves the media item range to the new index. |
| `void` | `https://developer.android.com/reference/androidx/media3/cast/RemoteCastPlayer#mute()()` Sets the audio volume to 0. |
| `void` | `https://developer.android.com/reference/androidx/media3/cast/RemoteCastPlayer#prepare()()` Prepares the player. |
| `void` | `https://developer.android.com/reference/androidx/media3/cast/RemoteCastPlayer#release()()` Releases the player. |
| `void` | `https://developer.android.com/reference/androidx/media3/cast/RemoteCastPlayer#removeListener(androidx.media3.common.Player.Listener)(https://developer.android.com/reference/androidx/media3/common/Player.Listener listener)` Unregister a listener registered through `https://developer.android.com/reference/androidx/media3/common/Player#addListener(androidx.media3.common.Player.Listener)`. |
| `void` | `https://developer.android.com/reference/androidx/media3/cast/RemoteCastPlayer#removeMediaItems(int,int)(int fromIndex, int toIndex)` Removes a range of media items from the playlist. |
| `void` | `https://developer.android.com/reference/androidx/media3/cast/RemoteCastPlayer#replaceMediaItems(int,int,java.util.List<androidx.media3.common.MediaItem>)( int fromIndex, int toIndex, https://developer.android.com/reference/java/util/List.html<https://developer.android.com/reference/androidx/media3/common/MediaItem> mediaItems )` Replaces the media items at the given range of the playlist. |
| `void` | `https://developer.android.com/reference/androidx/media3/cast/RemoteCastPlayer#setAudioAttributes(androidx.media3.common.AudioAttributes,boolean)( https://developer.android.com/reference/androidx/media3/common/AudioAttributes audioAttributes, boolean handleAudioFocus )` This method is not supported and does nothing. |
| `void` | `@https://checkerframework.org/api/com/google/errorprone/annotations/InlineMe.html(replacement = "this.setDeviceMuted(muted, 0)") [setDeviceMuted](https://developer.android.com/reference/androidx/media3/cast/RemoteCastPlayer#setDeviceMuted(boolean))(boolean muted)` **This method is deprecated.** Use `https://developer.android.com/reference/androidx/media3/cast/RemoteCastPlayer#setDeviceMuted(boolean,int)` instead. <br /> |
| `void` | `https://developer.android.com/reference/androidx/media3/cast/RemoteCastPlayer#setDeviceMuted(boolean,int)(boolean muted, @https://developer.android.com/reference/androidx/media3/common/C.VolumeFlags int flags)` Sets the mute state of the device. |
| `void` | `@https://checkerframework.org/api/com/google/errorprone/annotations/InlineMe.html(replacement = "this.setDeviceVolume(volume, 0)") [setDeviceVolume](https://developer.android.com/reference/androidx/media3/cast/RemoteCastPlayer#setDeviceVolume(int))(@https://developer.android.com/reference/androidx/annotation/IntRange(from = 0) int volume)` **This method is deprecated.** Use `https://developer.android.com/reference/androidx/media3/cast/RemoteCastPlayer#setDeviceVolume(int,int)` instead. <br /> |
| `void` | `https://developer.android.com/reference/androidx/media3/cast/RemoteCastPlayer#setDeviceVolume(int,int)(@https://developer.android.com/reference/androidx/annotation/IntRange(from = 0) int volume, @https://developer.android.com/reference/androidx/media3/common/C.VolumeFlags int flags)` Sets the volume of the device with volume flags. |
| `void` | `https://developer.android.com/reference/androidx/media3/cast/RemoteCastPlayer#setMediaItems(java.util.List<androidx.media3.common.MediaItem>,boolean)(https://developer.android.com/reference/java/util/List.html<https://developer.android.com/reference/androidx/media3/common/MediaItem> mediaItems, boolean resetPosition)` Clears the playlist and adds the specified `https://developer.android.com/reference/androidx/media3/common/MediaItem`. |
| `void` | `https://developer.android.com/reference/androidx/media3/cast/RemoteCastPlayer#setMediaItems(java.util.List<androidx.media3.common.MediaItem>,int,long)( https://developer.android.com/reference/java/util/List.html<https://developer.android.com/reference/androidx/media3/common/MediaItem> mediaItems, int startIndex, long startPositionMs )` Clears the playlist and adds the specified `https://developer.android.com/reference/androidx/media3/common/MediaItem`. |
| `void` | `https://developer.android.com/reference/androidx/media3/cast/RemoteCastPlayer#setPlayWhenReady(boolean)(boolean playWhenReady)` Sets whether playback should proceed when `https://developer.android.com/reference/androidx/media3/common/Player#getPlaybackState()` == `https://developer.android.com/reference/androidx/media3/common/Player#STATE_READY()`. |
| `void` | `https://developer.android.com/reference/androidx/media3/cast/RemoteCastPlayer#setPlaybackParameters(androidx.media3.common.PlaybackParameters)(https://developer.android.com/reference/androidx/media3/common/PlaybackParameters playbackParameters)` Attempts to set the playback parameters. |
| `void` | `https://developer.android.com/reference/androidx/media3/cast/RemoteCastPlayer#setPlaylistMetadata(androidx.media3.common.MediaMetadata)(https://developer.android.com/reference/androidx/media3/common/MediaMetadata playlistMetadata)` Sets the playlist `https://developer.android.com/reference/androidx/media3/common/MediaMetadata`. |
| `void` | `https://developer.android.com/reference/androidx/media3/cast/RemoteCastPlayer#setRepeatMode(int)(@https://developer.android.com/reference/androidx/media3/common/Player.RepeatMode int repeatMode)` Sets the `https://developer.android.com/reference/androidx/media3/common/Player.RepeatMode` to be used for playback. |
| `void` | `https://developer.android.com/reference/androidx/media3/cast/RemoteCastPlayer#setSessionAvailabilityListener(androidx.media3.cast.SessionAvailabilityListener)( @https://developer.android.com/reference/androidx/annotation/Nullable https://developer.android.com/reference/androidx/media3/cast/SessionAvailabilityListener listener )` Sets a listener for updates on the cast session availability. |
| `void` | `https://developer.android.com/reference/androidx/media3/cast/RemoteCastPlayer#setShuffleModeEnabled(boolean)(boolean shuffleModeEnabled)` Sets whether shuffling of media items is enabled. |
| `void` | `https://developer.android.com/reference/androidx/media3/cast/RemoteCastPlayer#setTrackSelectionParameters(androidx.media3.common.TrackSelectionParameters)(https://developer.android.com/reference/androidx/media3/common/TrackSelectionParameters parameters)` Sets the parameters constraining the track selection. |
| `void` | `https://developer.android.com/reference/androidx/media3/cast/RemoteCastPlayer#setVideoSurface(android.view.Surface)(@https://developer.android.com/reference/androidx/annotation/Nullable https://developer.android.com/reference/android/view/Surface.html surface)` This method is not supported and does nothing. |
| `void` | `https://developer.android.com/reference/androidx/media3/cast/RemoteCastPlayer#setVideoSurfaceHolder(android.view.SurfaceHolder)(@https://developer.android.com/reference/androidx/annotation/Nullable https://developer.android.com/reference/android/view/SurfaceHolder.html surfaceHolder)` This method is not supported and does nothing. |
| `void` | `https://developer.android.com/reference/androidx/media3/cast/RemoteCastPlayer#setVideoSurfaceView(android.view.SurfaceView)(@https://developer.android.com/reference/androidx/annotation/Nullable https://developer.android.com/reference/android/view/SurfaceView.html surfaceView)` This method is not supported and does nothing. |
| `void` | `https://developer.android.com/reference/androidx/media3/cast/RemoteCastPlayer#setVideoTextureView(android.view.TextureView)(@https://developer.android.com/reference/androidx/annotation/Nullable https://developer.android.com/reference/android/view/TextureView.html textureView)` This method is not supported and does nothing. |
| `void` | `https://developer.android.com/reference/androidx/media3/cast/RemoteCastPlayer#setVolume(float)(float volume)` Sets the audio volume, valid values are between 0 (silence) and 1 (unity gain, signal unchanged), inclusive. |
| `void` | `https://developer.android.com/reference/androidx/media3/cast/RemoteCastPlayer#stop()()` Stops playback without resetting the playlist. |
| `void` | `https://developer.android.com/reference/androidx/media3/cast/RemoteCastPlayer#unmute()()` If the audio volume is 0, sets the audio volume to a non-zero value decided by the Player to be the most appropriate. |

| ### Protected methods |
|---|---|
| `void` | `https://developer.android.com/reference/androidx/media3/cast/RemoteCastPlayer#seekTo(int,long,int,boolean)( int mediaItemIndex, long positionMs, @https://developer.android.com/reference/androidx/media3/common/Player.Command int seekCommand, boolean isRepeatingCurrentItem )` Seeks to a position in the specified `https://developer.android.com/reference/androidx/media3/common/MediaItem`. |

### Inherited Constants

From [androidx.media3.common.Player](https://developer.android.com/reference/androidx/media3/common/Player) `static final int` `https://developer.android.com/reference/androidx/media3/common/Player#COMMAND_ADJUST_DEVICE_VOLUME() = 26`

**This field is deprecated.**

Use `https://developer.android.com/reference/androidx/media3/common/Player#COMMAND_ADJUST_DEVICE_VOLUME_WITH_FLAGS()` instead.

<br />

`static final int` `https://developer.android.com/reference/androidx/media3/common/Player#COMMAND_ADJUST_DEVICE_VOLUME_WITH_FLAGS() = 34`

Command to increase and decrease the device volume and mute it with volume flags.
`static final int` `https://developer.android.com/reference/androidx/media3/common/Player#COMMAND_CHANGE_MEDIA_ITEMS() = 20`

Command to change the `https://developer.android.com/reference/androidx/media3/common/MediaItem` in the playlist.
`static final int` `https://developer.android.com/reference/androidx/media3/common/Player#COMMAND_GET_AUDIO_ATTRIBUTES() = 21`

Command to get the player current `https://developer.android.com/reference/androidx/media3/common/AudioAttributes`.
`static final int` `https://developer.android.com/reference/androidx/media3/common/Player#COMMAND_GET_CURRENT_MEDIA_ITEM() = 16`

Command to get information about the currently playing `https://developer.android.com/reference/androidx/media3/common/MediaItem`.
`static final int` `https://developer.android.com/reference/androidx/media3/common/Player#COMMAND_GET_DEVICE_VOLUME() = 23`

Command to get the device volume and whether it is muted.
`static final int` `https://developer.android.com/reference/androidx/media3/common/Player#COMMAND_GET_MEDIA_ITEMS_METADATA() = 18`

**This field is deprecated.**

Use `https://developer.android.com/reference/androidx/media3/common/Player#COMMAND_GET_METADATA()` instead.

<br />

`static final int` `https://developer.android.com/reference/androidx/media3/common/Player#COMMAND_GET_METADATA() = 18`

Command to get metadata related to the playlist and current `https://developer.android.com/reference/androidx/media3/common/MediaItem`.
`static final int` `https://developer.android.com/reference/androidx/media3/common/Player#COMMAND_GET_TEXT() = 28`

Command to get the text that should currently be displayed by the player.
`static final int` `https://developer.android.com/reference/androidx/media3/common/Player#COMMAND_GET_TIMELINE() = 17`

Command to get the information about the current timeline.
`static final int` `https://developer.android.com/reference/androidx/media3/common/Player#COMMAND_GET_TRACKS() = 30`

Command to get details of the current track selection.
`static final int` `https://developer.android.com/reference/androidx/media3/common/Player#COMMAND_GET_VOLUME() = 22`

Command to get the player volume.
`static final int` `https://developer.android.com/reference/androidx/media3/common/Player#COMMAND_INVALID() = -1`

Represents an invalid `https://developer.android.com/reference/androidx/media3/common/Player.Command`.
`static final int` `https://developer.android.com/reference/androidx/media3/common/Player#COMMAND_PLAY_PAUSE() = 1`

Command to start, pause or resume playback.
`static final int` `https://developer.android.com/reference/androidx/media3/common/Player#COMMAND_PREPARE() = 2`

Command to prepare the player.
`static final int` `https://developer.android.com/reference/androidx/media3/common/Player#COMMAND_RELEASE() = 32`

Command to release the player.
`static final int` `https://developer.android.com/reference/androidx/media3/common/Player#COMMAND_SEEK_BACK() = 11`

Command to seek back by a fixed increment inside the current `https://developer.android.com/reference/androidx/media3/common/MediaItem`.
`static final int` `https://developer.android.com/reference/androidx/media3/common/Player#COMMAND_SEEK_FORWARD() = 12`

Command to seek forward by a fixed increment inside the current `https://developer.android.com/reference/androidx/media3/common/MediaItem`.
`static final int` `https://developer.android.com/reference/androidx/media3/common/Player#COMMAND_SEEK_IN_CURRENT_MEDIA_ITEM() = 5`

Command to seek anywhere inside the current `https://developer.android.com/reference/androidx/media3/common/MediaItem`.
`static final int` `@https://developer.android.com/reference/androidx/media3/common/util/UnstableApi
https://developer.android.com/reference/androidx/media3/common/Player#COMMAND_SEEK_IN_CURRENT_WINDOW() = 5`

**This field is deprecated.**

Use `https://developer.android.com/reference/androidx/media3/common/Player#COMMAND_SEEK_IN_CURRENT_MEDIA_ITEM()` instead.

<br />

`static final int` `https://developer.android.com/reference/androidx/media3/common/Player#COMMAND_SEEK_TO_DEFAULT_POSITION() = 4`

Command to seek to the default position of the current `https://developer.android.com/reference/androidx/media3/common/MediaItem`.
`static final int` `https://developer.android.com/reference/androidx/media3/common/Player#COMMAND_SEEK_TO_MEDIA_ITEM() = 10`

Command to seek anywhere in any `https://developer.android.com/reference/androidx/media3/common/MediaItem`.
`static final int` `https://developer.android.com/reference/androidx/media3/common/Player#COMMAND_SEEK_TO_NEXT() = 9`

Command to seek to a later position in the current `https://developer.android.com/reference/androidx/media3/common/MediaItem` or the default position of the next `https://developer.android.com/reference/androidx/media3/common/MediaItem`.
`static final int` `https://developer.android.com/reference/androidx/media3/common/Player#COMMAND_SEEK_TO_NEXT_MEDIA_ITEM() = 8`

Command to seek to the default position of the next `https://developer.android.com/reference/androidx/media3/common/MediaItem`.
`static final int` `@https://developer.android.com/reference/androidx/media3/common/util/UnstableApi
https://developer.android.com/reference/androidx/media3/common/Player#COMMAND_SEEK_TO_NEXT_WINDOW() = 8`

**This field is deprecated.**

Use `https://developer.android.com/reference/androidx/media3/common/Player#COMMAND_SEEK_TO_NEXT_MEDIA_ITEM()` instead.

<br />

`static final int` `https://developer.android.com/reference/androidx/media3/common/Player#COMMAND_SEEK_TO_PREVIOUS() = 7`

Command to seek to an earlier position in the current `https://developer.android.com/reference/androidx/media3/common/MediaItem` or the default position of the previous `https://developer.android.com/reference/androidx/media3/common/MediaItem`.
`static final int` `https://developer.android.com/reference/androidx/media3/common/Player#COMMAND_SEEK_TO_PREVIOUS_MEDIA_ITEM() = 6`

Command to seek to the default position of the previous `https://developer.android.com/reference/androidx/media3/common/MediaItem`.
`static final int` `@https://developer.android.com/reference/androidx/media3/common/util/UnstableApi
https://developer.android.com/reference/androidx/media3/common/Player#COMMAND_SEEK_TO_PREVIOUS_WINDOW() = 6`

**This field is deprecated.**

Use `https://developer.android.com/reference/androidx/media3/common/Player#COMMAND_SEEK_TO_PREVIOUS_MEDIA_ITEM()` instead.

<br />

`static final int` `@https://developer.android.com/reference/androidx/media3/common/util/UnstableApi
https://developer.android.com/reference/androidx/media3/common/Player#COMMAND_SEEK_TO_WINDOW() = 10`

**This field is deprecated.**

Use `https://developer.android.com/reference/androidx/media3/common/Player#COMMAND_SEEK_TO_MEDIA_ITEM()` instead.

<br />

`static final int` `https://developer.android.com/reference/androidx/media3/common/Player#COMMAND_SET_AUDIO_ATTRIBUTES() = 35`

Command to set the player's audio attributes.
`static final int` `https://developer.android.com/reference/androidx/media3/common/Player#COMMAND_SET_DEVICE_VOLUME() = 25`

**This field is deprecated.**

Use `https://developer.android.com/reference/androidx/media3/common/Player#COMMAND_SET_DEVICE_VOLUME_WITH_FLAGS()` instead.

<br />

`static final int` `https://developer.android.com/reference/androidx/media3/common/Player#COMMAND_SET_DEVICE_VOLUME_WITH_FLAGS() = 33`

Command to set the device volume with volume flags.
`static final int` `https://developer.android.com/reference/androidx/media3/common/Player#COMMAND_SET_MEDIA_ITEM() = 31`

Command to set a `https://developer.android.com/reference/androidx/media3/common/MediaItem`.
`static final int` `https://developer.android.com/reference/androidx/media3/common/Player#COMMAND_SET_MEDIA_ITEMS_METADATA() = 19`

**This field is deprecated.**

Use `https://developer.android.com/reference/androidx/media3/common/Player#COMMAND_SET_PLAYLIST_METADATA()` instead.

<br />

`static final int` `https://developer.android.com/reference/androidx/media3/common/Player#COMMAND_SET_PLAYLIST_METADATA() = 19`

Command to set the playlist metadata.
`static final int` `https://developer.android.com/reference/androidx/media3/common/Player#COMMAND_SET_REPEAT_MODE() = 15`

Command to set the repeat mode.
`static final int` `https://developer.android.com/reference/androidx/media3/common/Player#COMMAND_SET_SHUFFLE_MODE() = 14`

Command to enable shuffling.
`static final int` `https://developer.android.com/reference/androidx/media3/common/Player#COMMAND_SET_SPEED_AND_PITCH() = 13`

Command to set the playback speed and pitch.
`static final int` `https://developer.android.com/reference/androidx/media3/common/Player#COMMAND_SET_TRACK_SELECTION_PARAMETERS() = 29`

Command to set the player's track selection parameters.
`static final int` `https://developer.android.com/reference/androidx/media3/common/Player#COMMAND_SET_VIDEO_SURFACE() = 27`

Command to set and clear the surface on which to render the video.
`static final int` `https://developer.android.com/reference/androidx/media3/common/Player#COMMAND_SET_VOLUME() = 24`

Command to set the player volume.
`static final int` `https://developer.android.com/reference/androidx/media3/common/Player#COMMAND_STOP() = 3`

Command to stop playback.
`static final int` `https://developer.android.com/reference/androidx/media3/common/Player#DISCONTINUITY_REASON_AUTO_TRANSITION() = 0`

Automatic playback transition from one period in the timeline to the next.
`static final int` `https://developer.android.com/reference/androidx/media3/common/Player#DISCONTINUITY_REASON_INTERNAL() = 5`

Discontinuity introduced internally (e.g. by the source).
`static final int` `https://developer.android.com/reference/androidx/media3/common/Player#DISCONTINUITY_REASON_REMOVE() = 4`

Discontinuity caused by the removal of the current period from the `https://developer.android.com/reference/androidx/media3/common/Timeline`.
`static final int` `https://developer.android.com/reference/androidx/media3/common/Player#DISCONTINUITY_REASON_SEEK() = 1`

Seek within the current period or to another period.
`static final int` `https://developer.android.com/reference/androidx/media3/common/Player#DISCONTINUITY_REASON_SEEK_ADJUSTMENT() = 2`

Seek adjustment due to being unable to seek to the requested position or because the seek was permitted to be inexact.
`static final int` `https://developer.android.com/reference/androidx/media3/common/Player#DISCONTINUITY_REASON_SILENCE_SKIP() = 6`

Discontinuity introduced by a skipped silence.
`static final int` `https://developer.android.com/reference/androidx/media3/common/Player#DISCONTINUITY_REASON_SKIP() = 3`

Discontinuity introduced by a skipped period (for instance a skipped ad).
`static final int` `https://developer.android.com/reference/androidx/media3/common/Player#EVENT_AUDIO_ATTRIBUTES_CHANGED() = 20`

`https://developer.android.com/reference/androidx/media3/common/Player#getAudioAttributes()` changed.
`static final int` `https://developer.android.com/reference/androidx/media3/common/Player#EVENT_AUDIO_SESSION_ID() = 21`

The audio session id was set.
`static final int` `https://developer.android.com/reference/androidx/media3/common/Player#EVENT_AVAILABLE_COMMANDS_CHANGED() = 13`

`https://developer.android.com/reference/androidx/media3/common/Player#isCommandAvailable(int)` changed for at least one `https://developer.android.com/reference/androidx/media3/common/Player.Command`.
`static final int` `https://developer.android.com/reference/androidx/media3/common/Player#EVENT_CUES() = 27`

`https://developer.android.com/reference/androidx/media3/common/Player#getCurrentCues()` changed.
`static final int` `https://developer.android.com/reference/androidx/media3/common/Player#EVENT_DEVICE_INFO_CHANGED() = 29`

`https://developer.android.com/reference/androidx/media3/common/Player#getDeviceInfo()` changed.
`static final int` `https://developer.android.com/reference/androidx/media3/common/Player#EVENT_DEVICE_VOLUME_CHANGED() = 30`

`https://developer.android.com/reference/androidx/media3/common/Player#getDeviceVolume()` or `https://developer.android.com/reference/androidx/media3/common/Player#isDeviceMuted()` changed.
`static final int` `https://developer.android.com/reference/androidx/media3/common/Player#EVENT_IS_LOADING_CHANGED() = 3`

`https://developer.android.com/reference/androidx/media3/common/Player#isLoading()` ()} changed.
`static final int` `https://developer.android.com/reference/androidx/media3/common/Player#EVENT_IS_PLAYING_CHANGED() = 7`

`https://developer.android.com/reference/androidx/media3/common/Player#isPlaying()` changed.
`static final int` `https://developer.android.com/reference/androidx/media3/common/Player#EVENT_MAX_SEEK_TO_PREVIOUS_POSITION_CHANGED() = 18`

`https://developer.android.com/reference/androidx/media3/common/Player#getMaxSeekToPreviousPosition()` changed.
`static final int` `https://developer.android.com/reference/androidx/media3/common/Player#EVENT_MEDIA_ITEM_TRANSITION() = 1`

`https://developer.android.com/reference/androidx/media3/common/Player#getCurrentMediaItem()` changed or the player started repeating the current item.
`static final int` `https://developer.android.com/reference/androidx/media3/common/Player#EVENT_MEDIA_METADATA_CHANGED() = 14`

`https://developer.android.com/reference/androidx/media3/common/Player#getMediaMetadata()` changed.
`static final int` `https://developer.android.com/reference/androidx/media3/common/Player#EVENT_METADATA() = 28`

Metadata associated with the current playback time changed.
`static final int` `https://developer.android.com/reference/androidx/media3/common/Player#EVENT_PLAYBACK_PARAMETERS_CHANGED() = 12`

`https://developer.android.com/reference/androidx/media3/common/Player#getPlaybackParameters()` changed.
`static final int` `https://developer.android.com/reference/androidx/media3/common/Player#EVENT_PLAYBACK_STATE_CHANGED() = 4`

`https://developer.android.com/reference/androidx/media3/common/Player#getPlaybackState()` changed.
`static final int` `https://developer.android.com/reference/androidx/media3/common/Player#EVENT_PLAYBACK_SUPPRESSION_REASON_CHANGED() = 6`

`https://developer.android.com/reference/androidx/media3/common/Player#getPlaybackSuppressionReason()` changed.
`static final int` `https://developer.android.com/reference/androidx/media3/common/Player#EVENT_PLAYER_ERROR() = 10`

`https://developer.android.com/reference/androidx/media3/common/Player#getPlayerError()` changed.
`static final int` `https://developer.android.com/reference/androidx/media3/common/Player#EVENT_PLAYLIST_METADATA_CHANGED() = 15`

`https://developer.android.com/reference/androidx/media3/common/Player#getPlaylistMetadata()` changed.
`static final int` `https://developer.android.com/reference/androidx/media3/common/Player#EVENT_PLAY_WHEN_READY_CHANGED() = 5`

`https://developer.android.com/reference/androidx/media3/common/Player#getPlayWhenReady()` changed.
`static final int` `https://developer.android.com/reference/androidx/media3/common/Player#EVENT_POSITION_DISCONTINUITY() = 11`

A position discontinuity occurred.
`static final int` `https://developer.android.com/reference/androidx/media3/common/Player#EVENT_RENDERED_FIRST_FRAME() = 26`

A frame is rendered for the first time since setting the surface, or since the renderer was reset, or since the stream being rendered was changed.
`static final int` `https://developer.android.com/reference/androidx/media3/common/Player#EVENT_REPEAT_MODE_CHANGED() = 8`

`https://developer.android.com/reference/androidx/media3/common/Player#getRepeatMode()` changed.
`static final int` `https://developer.android.com/reference/androidx/media3/common/Player#EVENT_SEEK_BACK_INCREMENT_CHANGED() = 16`

`https://developer.android.com/reference/androidx/media3/common/Player#getSeekBackIncrement()` changed.
`static final int` `https://developer.android.com/reference/androidx/media3/common/Player#EVENT_SEEK_FORWARD_INCREMENT_CHANGED() = 17`

`https://developer.android.com/reference/androidx/media3/common/Player#getSeekForwardIncrement()` changed.
`static final int` `https://developer.android.com/reference/androidx/media3/common/Player#EVENT_SHUFFLE_MODE_ENABLED_CHANGED() = 9`

`https://developer.android.com/reference/androidx/media3/common/Player#getShuffleModeEnabled()` changed.
`static final int` `https://developer.android.com/reference/androidx/media3/common/Player#EVENT_SKIP_SILENCE_ENABLED_CHANGED() = 23`

Skipping silences in the audio stream is enabled or disabled.
`static final int` `https://developer.android.com/reference/androidx/media3/common/Player#EVENT_SURFACE_SIZE_CHANGED() = 24`

The size of the surface onto which the video is being rendered changed.
`static final int` `https://developer.android.com/reference/androidx/media3/common/Player#EVENT_TIMELINE_CHANGED() = 0`

`https://developer.android.com/reference/androidx/media3/common/Player#getCurrentTimeline()` changed.
`static final int` `https://developer.android.com/reference/androidx/media3/common/Player#EVENT_TRACKS_CHANGED() = 2`

`https://developer.android.com/reference/androidx/media3/common/Player#getCurrentTracks()` changed.
`static final int` `https://developer.android.com/reference/androidx/media3/common/Player#EVENT_TRACK_SELECTION_PARAMETERS_CHANGED() = 19`

`https://developer.android.com/reference/androidx/media3/common/Player#getTrackSelectionParameters()` changed.
`static final int` `https://developer.android.com/reference/androidx/media3/common/Player#EVENT_VIDEO_SIZE_CHANGED() = 25`

`https://developer.android.com/reference/androidx/media3/common/Player#getVideoSize()` changed.
`static final int` `https://developer.android.com/reference/androidx/media3/common/Player#EVENT_VOLUME_CHANGED() = 22`

`https://developer.android.com/reference/androidx/media3/common/Player#getVolume()` changed.
`static final int` `https://developer.android.com/reference/androidx/media3/common/Player#MEDIA_ITEM_TRANSITION_REASON_AUTO() = 1`

Playback has automatically transitioned to the next media item.
`static final int` `https://developer.android.com/reference/androidx/media3/common/Player#MEDIA_ITEM_TRANSITION_REASON_PLAYLIST_CHANGED() = 3`

The current media item has changed because of a change in the playlist.
`static final int` `https://developer.android.com/reference/androidx/media3/common/Player#MEDIA_ITEM_TRANSITION_REASON_REPEAT() = 0`

The media item has been repeated.
`static final int` `https://developer.android.com/reference/androidx/media3/common/Player#MEDIA_ITEM_TRANSITION_REASON_SEEK() = 2`

A seek to another media item has occurred.
`static final int` `https://developer.android.com/reference/androidx/media3/common/Player#PLAYBACK_SUPPRESSION_REASON_NONE() = 0`

Playback is not suppressed.
`static final int` `https://developer.android.com/reference/androidx/media3/common/Player#PLAYBACK_SUPPRESSION_REASON_SCRUBBING() = 4`

Playback is suppressed because the player is currently scrubbing.
`static final int` `https://developer.android.com/reference/androidx/media3/common/Player#PLAYBACK_SUPPRESSION_REASON_TRANSIENT_AUDIO_FOCUS_LOSS() = 1`

Playback is suppressed due to transient audio focus loss.
`static final int` `https://developer.android.com/reference/androidx/media3/common/Player#PLAYBACK_SUPPRESSION_REASON_UNSUITABLE_AUDIO_OUTPUT() = 3`

Playback is suppressed due to attempt to play on an unsuitable audio output (e.g. attempt to play on built-in speaker on a Wear OS device).
`static final int` `https://developer.android.com/reference/androidx/media3/common/Player#PLAYBACK_SUPPRESSION_REASON_UNSUITABLE_AUDIO_ROUTE() = 2`

**This field is deprecated.**

Use `https://developer.android.com/reference/androidx/media3/common/Player#PLAYBACK_SUPPRESSION_REASON_UNSUITABLE_AUDIO_OUTPUT()` instead.

<br />

`static final int` `https://developer.android.com/reference/androidx/media3/common/Player#PLAY_WHEN_READY_CHANGE_REASON_AUDIO_BECOMING_NOISY() = 3`

Playback has been paused to avoid becoming noisy.
`static final int` `https://developer.android.com/reference/androidx/media3/common/Player#PLAY_WHEN_READY_CHANGE_REASON_AUDIO_FOCUS_LOSS() = 2`

Playback has been paused because of a loss of audio focus.
`static final int` `https://developer.android.com/reference/androidx/media3/common/Player#PLAY_WHEN_READY_CHANGE_REASON_END_OF_MEDIA_ITEM() = 5`

Playback has been paused at the end of a media item.
`static final int` `https://developer.android.com/reference/androidx/media3/common/Player#PLAY_WHEN_READY_CHANGE_REASON_REMOTE() = 4`

Playback has been started or paused because of a remote change.
`static final int` `https://developer.android.com/reference/androidx/media3/common/Player#PLAY_WHEN_READY_CHANGE_REASON_SUPPRESSED_TOO_LONG() = 6`

Playback has been paused because playback has been `https://developer.android.com/reference/androidx/media3/common/Player#getPlaybackSuppressionReason()` too long.
`static final int` `https://developer.android.com/reference/androidx/media3/common/Player#PLAY_WHEN_READY_CHANGE_REASON_USER_REQUEST() = 1`

Playback has been started or paused by a call to `https://developer.android.com/reference/androidx/media3/common/Player#setPlayWhenReady(boolean)`.
`static final int` `https://developer.android.com/reference/androidx/media3/common/Player#REPEAT_MODE_ALL() = 2`

Repeats the entire timeline infinitely.
`static final int` `https://developer.android.com/reference/androidx/media3/common/Player#REPEAT_MODE_OFF() = 0`

Normal playback without repetition.
`static final int` `https://developer.android.com/reference/androidx/media3/common/Player#REPEAT_MODE_ONE() = 1`

Repeats the currently playing `https://developer.android.com/reference/androidx/media3/common/MediaItem` infinitely during ongoing playback.
`static final int` `https://developer.android.com/reference/androidx/media3/common/Player#STATE_BUFFERING() = 2`

The player is not able to immediately play the media, but is doing work toward being able to do so.
`static final int` `https://developer.android.com/reference/androidx/media3/common/Player#STATE_ENDED() = 4`

The player has finished playing the media.
`static final int` `https://developer.android.com/reference/androidx/media3/common/Player#STATE_IDLE() = 1`

The player is idle, meaning it holds only limited resources.
`static final int` `https://developer.android.com/reference/androidx/media3/common/Player#STATE_READY() = 3`

The player is able to immediately play from its current position.
`static final int` `https://developer.android.com/reference/androidx/media3/common/Player#TIMELINE_CHANGE_REASON_PLAYLIST_CHANGED() = 0`

Timeline changed as a result of a change of the playlist items or the order of the items.
`static final int` `https://developer.android.com/reference/androidx/media3/common/Player#TIMELINE_CHANGE_REASON_SOURCE_UPDATE() = 1`

Timeline changed as a result of a source update (e.g. result of a dynamic update by the played media).

### Inherited fields

From [androidx.media3.common.BasePlayer](https://developer.android.com/reference/androidx/media3/common/BasePlayer) `final https://developer.android.com/reference/androidx/media3/common/Timeline.Window` `https://developer.android.com/reference/androidx/media3/common/BasePlayer#window()`

### Inherited methods

From [androidx.media3.common.BasePlayer](https://developer.android.com/reference/androidx/media3/common/BasePlayer) `final void` `https://developer.android.com/reference/androidx/media3/common/BasePlayer#addMediaItem(androidx.media3.common.MediaItem)(https://developer.android.com/reference/androidx/media3/common/MediaItem mediaItem)`

Adds a media item to the end of the playlist.
`final void` `https://developer.android.com/reference/androidx/media3/common/BasePlayer#addMediaItem(int,androidx.media3.common.MediaItem)(int index, https://developer.android.com/reference/androidx/media3/common/MediaItem mediaItem)`

Adds a media item at the given index of the playlist.
`final void` `https://developer.android.com/reference/androidx/media3/common/BasePlayer#addMediaItems(java.util.List<androidx.media3.common.MediaItem>)(https://developer.android.com/reference/java/util/List.html<https://developer.android.com/reference/androidx/media3/common/MediaItem> mediaItems)`

Adds a list of media items to the end of the playlist.
`final boolean` `https://developer.android.com/reference/androidx/media3/common/BasePlayer#canAdvertiseSession()()`

Returns whether the player can be used to advertise a media session.
`final void` `https://developer.android.com/reference/androidx/media3/common/BasePlayer#clearMediaItems()()`

Clears the playlist.
`final int` `https://developer.android.com/reference/androidx/media3/common/BasePlayer#getBufferedPercentage()()`

Returns an estimate of the percentage in the current content or ad up to which data is buffered, or 0 if no estimate is available.
`final long` `https://developer.android.com/reference/androidx/media3/common/BasePlayer#getContentDuration()()`

If `https://developer.android.com/reference/androidx/media3/common/Player#isPlayingAd()` returns `true`, returns the duration of the current content in milliseconds, or `https://developer.android.com/reference/androidx/media3/common/C#TIME_UNSET()` if the duration is not known.
`final long` `https://developer.android.com/reference/androidx/media3/common/BasePlayer#getCurrentLiveOffset()()`

Returns the offset of the current playback position from the live edge in milliseconds, or `https://developer.android.com/reference/androidx/media3/common/C#TIME_UNSET()` if the current `https://developer.android.com/reference/androidx/media3/common/MediaItem``https://developer.android.com/reference/androidx/media3/common/Player#isCurrentMediaItemLive()` or the offset is unknown.
`final @https://developer.android.com/reference/androidx/annotation/Nullable https://developer.android.com/reference/java/lang/Object.html` `https://developer.android.com/reference/androidx/media3/common/BasePlayer#getCurrentManifest()()`

Returns the current manifest.
`final @https://developer.android.com/reference/androidx/annotation/Nullable https://developer.android.com/reference/androidx/media3/common/MediaItem` `https://developer.android.com/reference/androidx/media3/common/BasePlayer#getCurrentMediaItem()()`

Returns the currently playing `https://developer.android.com/reference/androidx/media3/common/MediaItem`.
`final int` `[getCurrentWindowIndex](https://developer.android.com/reference/androidx/media3/common/BasePlayer#getCurrentWindowIndex())()`

**This method is deprecated.**

Use `https://developer.android.com/reference/androidx/media3/common/Player#getCurrentMediaItemIndex()` instead.

<br />

`final https://developer.android.com/reference/androidx/media3/common/MediaItem` `https://developer.android.com/reference/androidx/media3/common/BasePlayer#getMediaItemAt(int)(int index)`

Returns the `https://developer.android.com/reference/androidx/media3/common/MediaItem` at the given index.
`final int` `https://developer.android.com/reference/androidx/media3/common/BasePlayer#getMediaItemCount()()`

Returns the number of `https://developer.android.com/reference/androidx/media3/common/MediaItem` in the playlist.
`final int` `https://developer.android.com/reference/androidx/media3/common/BasePlayer#getNextMediaItemIndex()()`

Returns the index of the `https://developer.android.com/reference/androidx/media3/common/MediaItem` that will be played if `https://developer.android.com/reference/androidx/media3/common/Player#seekToNextMediaItem()` is called, which may depend on the current repeat mode and whether shuffle mode is enabled.
`final int` `[getNextWindowIndex](https://developer.android.com/reference/androidx/media3/common/BasePlayer#getNextWindowIndex())()`

**This method is deprecated.**

Use `https://developer.android.com/reference/androidx/media3/common/BasePlayer#getNextMediaItemIndex()` instead.

<br />

`final int` `https://developer.android.com/reference/androidx/media3/common/BasePlayer#getPreviousMediaItemIndex()()`

Returns the index of the `https://developer.android.com/reference/androidx/media3/common/MediaItem` that will be played if `https://developer.android.com/reference/androidx/media3/common/Player#seekToPreviousMediaItem()` is called, which may depend on the current repeat mode and whether shuffle mode is enabled.
`final int` `[getPreviousWindowIndex](https://developer.android.com/reference/androidx/media3/common/BasePlayer#getPreviousWindowIndex())()`

**This method is deprecated.**

Use `https://developer.android.com/reference/androidx/media3/common/BasePlayer#getPreviousMediaItemIndex()` instead.

<br />

`final boolean` `https://developer.android.com/reference/androidx/media3/common/BasePlayer#hasNextMediaItem()()`

Returns whether a next `https://developer.android.com/reference/androidx/media3/common/MediaItem` exists, which may depend on the current repeat mode and whether shuffle mode is enabled.
`final boolean` `https://developer.android.com/reference/androidx/media3/common/BasePlayer#hasPreviousMediaItem()()`

Returns whether a previous media item exists, which may depend on the current repeat mode and whether shuffle mode is enabled.
`final boolean` `https://developer.android.com/reference/androidx/media3/common/BasePlayer#isCommandAvailable(int)(@https://developer.android.com/reference/androidx/media3/common/Player.Command int command)`

Returns whether the provided `https://developer.android.com/reference/androidx/media3/common/Player.Command` is available.
`final boolean` `https://developer.android.com/reference/androidx/media3/common/BasePlayer#isCurrentMediaItemDynamic()()`

Returns whether the current `https://developer.android.com/reference/androidx/media3/common/MediaItem` is dynamic (may change when the `https://developer.android.com/reference/androidx/media3/common/Timeline` is updated), or `false` if the `https://developer.android.com/reference/androidx/media3/common/Timeline` is empty.
`final boolean` `https://developer.android.com/reference/androidx/media3/common/BasePlayer#isCurrentMediaItemLive()()`

Returns whether the current `https://developer.android.com/reference/androidx/media3/common/MediaItem` is live, or `false` if the `https://developer.android.com/reference/androidx/media3/common/Timeline` is empty.
`final boolean` `https://developer.android.com/reference/androidx/media3/common/BasePlayer#isCurrentMediaItemSeekable()()`

Returns whether the current `https://developer.android.com/reference/androidx/media3/common/MediaItem` is seekable, or `false` if the `https://developer.android.com/reference/androidx/media3/common/Timeline` is empty.
`final boolean` `[isCurrentWindowDynamic](https://developer.android.com/reference/androidx/media3/common/BasePlayer#isCurrentWindowDynamic())()`

**This method is deprecated.**

Use `https://developer.android.com/reference/androidx/media3/common/BasePlayer#isCurrentMediaItemDynamic()` instead.

<br />

`final boolean` `[isCurrentWindowLive](https://developer.android.com/reference/androidx/media3/common/BasePlayer#isCurrentWindowLive())()`

**This method is deprecated.**

Use `https://developer.android.com/reference/androidx/media3/common/BasePlayer#isCurrentMediaItemLive()` instead.

<br />

`final boolean` `[isCurrentWindowSeekable](https://developer.android.com/reference/androidx/media3/common/BasePlayer#isCurrentWindowSeekable())()`

**This method is deprecated.**

Use `https://developer.android.com/reference/androidx/media3/common/BasePlayer#isCurrentMediaItemSeekable()` instead.

<br />

`final boolean` `https://developer.android.com/reference/androidx/media3/common/BasePlayer#isPlaying()()`

Returns whether the player is playing, i.e. `https://developer.android.com/reference/androidx/media3/common/Player#getCurrentPosition()` is advancing.
`final void` `https://developer.android.com/reference/androidx/media3/common/BasePlayer#moveMediaItem(int,int)(int currentIndex, int newIndex)`

Moves the media item at the current index to the new index.
`final void` `https://developer.android.com/reference/androidx/media3/common/BasePlayer#pause()()`

Pauses playback.
`final void` `https://developer.android.com/reference/androidx/media3/common/BasePlayer#play()()`

Resumes playback as soon as `https://developer.android.com/reference/androidx/media3/common/Player#getPlaybackState()` == `https://developer.android.com/reference/androidx/media3/common/Player#STATE_READY()`.
`final void` `https://developer.android.com/reference/androidx/media3/common/BasePlayer#removeMediaItem(int)(int index)`

Removes the media item at the given index of the playlist.
`final void` `https://developer.android.com/reference/androidx/media3/common/BasePlayer#replaceMediaItem(int,androidx.media3.common.MediaItem)(int index, https://developer.android.com/reference/androidx/media3/common/MediaItem mediaItem)`

Replaces the media item at the given index of the playlist.
`final void` `https://developer.android.com/reference/androidx/media3/common/BasePlayer#seekBack()()`

Seeks back in the current `https://developer.android.com/reference/androidx/media3/common/MediaItem` by `https://developer.android.com/reference/androidx/media3/common/Player#getSeekBackIncrement()` milliseconds.
`final void` `https://developer.android.com/reference/androidx/media3/common/BasePlayer#seekForward()()`

Seeks forward in the current `https://developer.android.com/reference/androidx/media3/common/MediaItem` by `https://developer.android.com/reference/androidx/media3/common/Player#getSeekForwardIncrement()` milliseconds.
`final void` `https://developer.android.com/reference/androidx/media3/common/BasePlayer#seekTo(long)(long positionMs)`

Seeks to a position specified in milliseconds in the current `https://developer.android.com/reference/androidx/media3/common/MediaItem`.
`final void` `https://developer.android.com/reference/androidx/media3/common/BasePlayer#seekTo(int,long)(int mediaItemIndex, long positionMs)`

Seeks to a position specified in milliseconds in the specified `https://developer.android.com/reference/androidx/media3/common/MediaItem`.
`final void` `https://developer.android.com/reference/androidx/media3/common/BasePlayer#seekToDefaultPosition()()`

Seeks to the default position associated with the current `https://developer.android.com/reference/androidx/media3/common/MediaItem`.
`final void` `https://developer.android.com/reference/androidx/media3/common/BasePlayer#seekToDefaultPosition(int)(int mediaItemIndex)`

Seeks to the default position associated with the specified `https://developer.android.com/reference/androidx/media3/common/MediaItem`.
`final void` `https://developer.android.com/reference/androidx/media3/common/BasePlayer#seekToNext()()`

Seeks to a later position in the current or next `https://developer.android.com/reference/androidx/media3/common/MediaItem` (if available).
`final void` `https://developer.android.com/reference/androidx/media3/common/BasePlayer#seekToNextMediaItem()()`

Seeks to the default position of the next `https://developer.android.com/reference/androidx/media3/common/MediaItem`, which may depend on the current repeat mode and whether shuffle mode is enabled.
`final void` `https://developer.android.com/reference/androidx/media3/common/BasePlayer#seekToPrevious()()`

Seeks to an earlier position in the current or previous `https://developer.android.com/reference/androidx/media3/common/MediaItem` (if available).
`final void` `https://developer.android.com/reference/androidx/media3/common/BasePlayer#seekToPreviousMediaItem()()`

Seeks to the default position of the previous `https://developer.android.com/reference/androidx/media3/common/MediaItem`, which may depend on the current repeat mode and whether shuffle mode is enabled.
`final void` `https://developer.android.com/reference/androidx/media3/common/BasePlayer#setMediaItem(androidx.media3.common.MediaItem)(https://developer.android.com/reference/androidx/media3/common/MediaItem mediaItem)`

Clears the playlist, adds the specified `https://developer.android.com/reference/androidx/media3/common/MediaItem` and resets the position to the default position.
`final void` `https://developer.android.com/reference/androidx/media3/common/BasePlayer#setMediaItem(androidx.media3.common.MediaItem,boolean)(https://developer.android.com/reference/androidx/media3/common/MediaItem mediaItem, boolean resetPosition)`

Clears the playlist and adds the specified `https://developer.android.com/reference/androidx/media3/common/MediaItem`.
`final void` `https://developer.android.com/reference/androidx/media3/common/BasePlayer#setMediaItem(androidx.media3.common.MediaItem,long)(https://developer.android.com/reference/androidx/media3/common/MediaItem mediaItem, long startPositionMs)`

Clears the playlist and adds the specified `https://developer.android.com/reference/androidx/media3/common/MediaItem`.
`final void` `https://developer.android.com/reference/androidx/media3/common/BasePlayer#setMediaItems(java.util.List<androidx.media3.common.MediaItem>)(https://developer.android.com/reference/java/util/List.html<https://developer.android.com/reference/androidx/media3/common/MediaItem> mediaItems)`

Clears the playlist, adds the specified `https://developer.android.com/reference/androidx/media3/common/MediaItem` and resets the position to the default position.
`final void` `https://developer.android.com/reference/androidx/media3/common/BasePlayer#setPlaybackSpeed(float)(float speed)`

Changes the rate at which playback occurs.
From [androidx.media3.common.Player](https://developer.android.com/reference/androidx/media3/common/Player) `int` `@https://developer.android.com/reference/androidx/media3/common/util/UnstableApi
https://developer.android.com/reference/androidx/media3/common/Player#getAudioSessionId()()`

Returns the audio session identifier, or `https://developer.android.com/reference/androidx/media3/common/C#AUDIO_SESSION_ID_UNSET()` if not set.
`abstract void` `https://developer.android.com/reference/androidx/media3/common/Player#setPlaybackSpeed(float)(@https://developer.android.com/reference/androidx/annotation/FloatRange(from = 0, fromInclusive = false) float speed)`

Changes the rate at which playback occurs.
`abstract void` `https://developer.android.com/reference/androidx/media3/common/Player#setPlaylistMetadata(androidx.media3.common.MediaMetadata)(https://developer.android.com/reference/androidx/media3/common/MediaMetadata mediaMetadata)`

Sets the playlist `https://developer.android.com/reference/androidx/media3/common/MediaMetadata`.

## Constants

### DEVICE_INFO_REMOTE_EMPTY

```
public static final DeviceInfo DEVICE_INFO_REMOTE_EMPTY
```

A `https://developer.android.com/reference/androidx/media3/common/DeviceInfo#PLAYBACK_TYPE_REMOTE()``https://developer.android.com/reference/androidx/media3/common/DeviceInfo` with a null `https://developer.android.com/reference/androidx/media3/common/DeviceInfo#routingControllerId()`.

### MAX_SPEED_SUPPORTED

```
public static final float MAX_SPEED_SUPPORTED = 2.0f
```

### MIN_SPEED_SUPPORTED

```
public static final float MIN_SPEED_SUPPORTED = 0.5f
```

## Public fields

### availableCommands

```
public Player.Commands availableCommands
```

### deviceInfo

```
public DeviceInfo deviceInfo
```

### deviceVolume

```
public int deviceVolume
```

> [!CAUTION]
> **The setter for this field is deprecated.**   
> Deprecated in Java

### mediaMetadata

```
public MediaMetadata mediaMetadata
```

### playbackState

```
@Player.State
public int playbackState
```

### playlistMetadata

```
public MediaMetadata playlistMetadata
```

## Public methods

### addListener

```
public void addListener(Player.Listener listener)
```

Registers a listener to receive all events from the player.

The listener's methods will be called on the thread associated with `https://developer.android.com/reference/androidx/media3/common/Player#getApplicationLooper()`.

This method can be called from any thread.

| Parameters |
|---|---|
| `https://developer.android.com/reference/androidx/media3/common/Player.Listener listener` | The listener to register. |

### addMediaItems

```
public void addMediaItems(int index, List<MediaItem> mediaItems)
```

Adds a list of media items at the given index of the playlist.

This method must only be called if `https://developer.android.com/reference/androidx/media3/common/Player#COMMAND_CHANGE_MEDIA_ITEMS()` is `https://developer.android.com/reference/androidx/media3/common/Player#getAvailableCommands()`.

| Parameters |
|---|---|
| `int index` | The index at which to add the media items. If the index is larger than the size of the playlist, the media items are added to the end of the playlist. |
| `https://developer.android.com/reference/java/util/List.html<https://developer.android.com/reference/androidx/media3/common/MediaItem> mediaItems` | The `https://developer.android.com/reference/androidx/media3/common/MediaItem` to add. |

### clearVideoSurface

```
public void clearVideoSurface()
```

This method is not supported and does nothing.

### clearVideoSurface

```
public void clearVideoSurface(@Nullable Surface surface)
```

This method is not supported and does nothing.

### clearVideoSurfaceHolder

```
public void clearVideoSurfaceHolder(@Nullable SurfaceHolder surfaceHolder)
```

This method is not supported and does nothing.

### clearVideoSurfaceView

```
public void clearVideoSurfaceView(@Nullable SurfaceView surfaceView)
```

This method is not supported and does nothing.

### clearVideoTextureView

```
public void clearVideoTextureView(@Nullable TextureView textureView)
```

This method is not supported and does nothing.

### decreaseDeviceVolume

```
@InlineMe(replacement = "this.decreaseDeviceVolume(0)")
public void [decreaseDeviceVolume](https://developer.android.com/reference/androidx/media3/cast/RemoteCastPlayer#decreaseDeviceVolume())()
```

> [!CAUTION]
> **This method is deprecated.**   
>
> Use `https://developer.android.com/reference/androidx/media3/cast/RemoteCastPlayer#decreaseDeviceVolume(int)` instead.

### decreaseDeviceVolume

```
public void decreaseDeviceVolume(@C.VolumeFlags int flags)
```

Decreases the volume of the device.

The `https://developer.android.com/reference/androidx/media3/common/Player#getDeviceVolume()` device volume cannot be decreased below `https://developer.android.com/reference/androidx/media3/common/DeviceInfo#minVolume()`.

Note that this method affects the device volume. To change the volume of the current stream only, use `https://developer.android.com/reference/androidx/media3/common/Player#setVolume(float)`.

This method must only be called if `https://developer.android.com/reference/androidx/media3/common/Player#COMMAND_ADJUST_DEVICE_VOLUME_WITH_FLAGS()` is `https://developer.android.com/reference/androidx/media3/common/Player#getAvailableCommands()`.

| Parameters |
|---|---|
| `@https://developer.android.com/reference/androidx/media3/common/C.VolumeFlags int flags` | Either 0 or a bitwise combination of one or more `https://developer.android.com/reference/androidx/media3/common/C.VolumeFlags`. |

### getApplicationLooper

```
public Looper getApplicationLooper()
```

Returns the `https://developer.android.com/reference/android/os/Looper.html` associated with the application thread that's used to access the player and on which player events are received.

This method can be called from any thread.

### getAudioAttributes

```
public AudioAttributes getAudioAttributes()
```

This method is not supported and returns `https://developer.android.com/reference/androidx/media3/common/AudioAttributes#DEFAULT()`.

### getAvailableCommands

```
public Player.Commands getAvailableCommands()
```

Returns the player's currently available `https://developer.android.com/reference/androidx/media3/common/Player.Commands`.

The returned `https://developer.android.com/reference/androidx/media3/common/Player.Commands` are not updated when available commands change. Use `https://developer.android.com/reference/androidx/media3/common/Player.Listener#onAvailableCommandsChanged(androidx.media3.common.Player.Commands)` to get an update when the available commands change.

| Returns |
|---|---|
| `https://developer.android.com/reference/androidx/media3/common/Player.Commands` | The currently available `https://developer.android.com/reference/androidx/media3/common/Player.Commands`. |

| See also |
|---|---|
| `https://developer.android.com/reference/androidx/media3/common/Player.Listener#onAvailableCommandsChanged(androidx.media3.common.Player.Commands)` |   |

### getBufferedPosition

```
public long getBufferedPosition()
```

Returns an estimate of the position in the current content or ad up to which data is buffered, in milliseconds.

This method must only be called if `https://developer.android.com/reference/androidx/media3/common/Player#COMMAND_GET_CURRENT_MEDIA_ITEM()` is `https://developer.android.com/reference/androidx/media3/common/Player#getAvailableCommands()`.

### getContentBufferedPosition

```
public long getContentBufferedPosition()
```

If `https://developer.android.com/reference/androidx/media3/common/Player#isPlayingAd()` returns `true`, returns an estimate of the content position in the current content up to which data is buffered, in milliseconds. If there is no ad playing, the returned position is the same as that returned by `https://developer.android.com/reference/androidx/media3/common/Player#getBufferedPosition()`.

This method must only be called if `https://developer.android.com/reference/androidx/media3/common/Player#COMMAND_GET_CURRENT_MEDIA_ITEM()` is `https://developer.android.com/reference/androidx/media3/common/Player#getAvailableCommands()`.

### getContentPosition

```
public long getContentPosition()
```

If `https://developer.android.com/reference/androidx/media3/common/Player#isPlayingAd()` returns `true`, returns the content position that will be played once all ads in the ad group have finished playing, in milliseconds. If there is no ad playing, the returned position is the same as that returned by `https://developer.android.com/reference/androidx/media3/common/Player#getCurrentPosition()`.

This method must only be called if `https://developer.android.com/reference/androidx/media3/common/Player#COMMAND_GET_CURRENT_MEDIA_ITEM()` is `https://developer.android.com/reference/androidx/media3/common/Player#getAvailableCommands()`.

### getCurrentAdGroupIndex

```
public int getCurrentAdGroupIndex()
```

If `https://developer.android.com/reference/androidx/media3/common/Player#isPlayingAd()` returns true, returns the index of the ad group in the period currently being played. Returns `https://developer.android.com/reference/androidx/media3/common/C#INDEX_UNSET()` otherwise.

This method must only be called if `https://developer.android.com/reference/androidx/media3/common/Player#COMMAND_GET_CURRENT_MEDIA_ITEM()` is `https://developer.android.com/reference/androidx/media3/common/Player#getAvailableCommands()`.

### getCurrentAdIndexInAdGroup

```
public int getCurrentAdIndexInAdGroup()
```

If `https://developer.android.com/reference/androidx/media3/common/Player#isPlayingAd()` returns true, returns the index of the ad in its ad group. Returns `https://developer.android.com/reference/androidx/media3/common/C#INDEX_UNSET()` otherwise.

This method must only be called if `https://developer.android.com/reference/androidx/media3/common/Player#COMMAND_GET_CURRENT_MEDIA_ITEM()` is `https://developer.android.com/reference/androidx/media3/common/Player#getAvailableCommands()`.

### getCurrentCues

```
public CueGroup getCurrentCues()
```

This method is not supported and returns an empty `https://developer.android.com/reference/androidx/media3/common/text/CueGroup`.

### getCurrentMediaItemIndex

```
public int getCurrentMediaItemIndex()
```

Returns the index of the current `https://developer.android.com/reference/androidx/media3/common/MediaItem` in the `https://developer.android.com/reference/androidx/media3/common/Player#getCurrentTimeline()`, or the prospective index if the `https://developer.android.com/reference/androidx/media3/common/Player#getCurrentTimeline()` is empty.

This method must only be called if `https://developer.android.com/reference/androidx/media3/common/Player#COMMAND_GET_TIMELINE()` is `https://developer.android.com/reference/androidx/media3/common/Player#getAvailableCommands()`.

### getCurrentPeriodIndex

```
public int getCurrentPeriodIndex()
```

Returns the index of the period currently being played.

This method must only be called if `https://developer.android.com/reference/androidx/media3/common/Player#COMMAND_GET_TIMELINE()` is `https://developer.android.com/reference/androidx/media3/common/Player#getAvailableCommands()`.

### getCurrentPosition

```
public long getCurrentPosition()
```

Returns the playback position in the current content or ad, in milliseconds, or the prospective position in milliseconds if the `https://developer.android.com/reference/androidx/media3/common/Player#getCurrentTimeline()` is empty.

This method must only be called if `https://developer.android.com/reference/androidx/media3/common/Player#COMMAND_GET_CURRENT_MEDIA_ITEM()` is `https://developer.android.com/reference/androidx/media3/common/Player#getAvailableCommands()`.

### getCurrentTimeline

```
public Timeline getCurrentTimeline()
```

Returns the current `https://developer.android.com/reference/androidx/media3/common/Timeline`. Never null, but may be empty.

This method must only be called if `https://developer.android.com/reference/androidx/media3/common/Player#COMMAND_GET_TIMELINE()` is `https://developer.android.com/reference/androidx/media3/common/Player#getAvailableCommands()`.

| See also |
|---|---|
| `https://developer.android.com/reference/androidx/media3/common/Player.Listener#onTimelineChanged(androidx.media3.common.Timeline,int)` |   |

### getCurrentTracks

```
public Tracks getCurrentTracks()
```

Returns the current tracks.

This method must only be called if `https://developer.android.com/reference/androidx/media3/common/Player#COMMAND_GET_TRACKS()` is `https://developer.android.com/reference/androidx/media3/common/Player#getAvailableCommands()`.

| See also |
|---|---|
| `https://developer.android.com/reference/androidx/media3/common/Player.Listener#onTracksChanged(androidx.media3.common.Tracks)` |   |

### getDeviceInfo

```
public DeviceInfo getDeviceInfo()
```

Returns a `https://developer.android.com/reference/androidx/media3/common/DeviceInfo` describing the receiver device. Returns `https://developer.android.com/reference/androidx/media3/cast/RemoteCastPlayer#DEVICE_INFO_REMOTE_EMPTY()` if no `https://developer.android.com/reference/android/content/Context.html` was provided at construction, or if the Cast `https://developer.android.com/reference/android/media/MediaRouter2.RoutingController.html` could not be identified.

### getDeviceVolume

```
public int getDeviceVolume()
```

Gets the current volume of the device.

For devices with `https://developer.android.com/reference/androidx/media3/common/DeviceInfo#PLAYBACK_TYPE_LOCAL()`, the volume returned by this method varies according to the current `https://developer.android.com/reference/androidx/media3/common/C.StreamType`. The stream type is determined by `https://developer.android.com/reference/androidx/media3/common/AudioAttributes#getStreamType()`.

For devices with `https://developer.android.com/reference/androidx/media3/common/DeviceInfo#PLAYBACK_TYPE_REMOTE()`, the volume of the remote device is returned.

Note that this method returns the volume of the device. To check the current stream volume, use `https://developer.android.com/reference/androidx/media3/common/Player#getVolume()`.

This method must only be called if `https://developer.android.com/reference/androidx/media3/common/Player#COMMAND_GET_DEVICE_VOLUME()` is `https://developer.android.com/reference/androidx/media3/common/Player#getAvailableCommands()`.

| See also |
|---|---|
| `https://developer.android.com/reference/androidx/media3/common/Player.Listener#onDeviceVolumeChanged(int,boolean)` |   |

### getDuration

```
public long getDuration()
```

Returns the duration of the current content or ad in milliseconds, or `https://developer.android.com/reference/androidx/media3/common/C#TIME_UNSET()` if the duration is not known.

This method must only be called if `https://developer.android.com/reference/androidx/media3/common/Player#COMMAND_GET_CURRENT_MEDIA_ITEM()` is `https://developer.android.com/reference/androidx/media3/common/Player#getAvailableCommands()`.

### getItem

```
public @Nullable MediaQueueItem [getItem](https://developer.android.com/reference/androidx/media3/cast/RemoteCastPlayer#getItem(int))(int periodId)
```

> [!CAUTION]
> **This method is deprecated.**   
>
> Use `https://developer.android.com/reference/androidx/media3/cast/RemoteCastPlayer#getCurrentTimeline()` to get `https://developer.android.com/reference/androidx/media3/common/Timeline.Window#mediaItem()` via `https://developer.android.com/reference/androidx/media3/common/Timeline#getPeriodByUid(java.lang.Object,androidx.media3.common.Timeline.Period)` and `https://developer.android.com/reference/androidx/media3/common/Timeline#getWindow(int,androidx.media3.common.Timeline.Window)`.

Returns the item that corresponds to the period with the given id, or null if no media queue or period with id `periodId` exist.

| Parameters |
|---|---|
| `int periodId` | The id of the period (`https://developer.android.com/reference/androidx/media3/cast/RemoteCastPlayer#getCurrentTimeline()`) that corresponds to the item to get. |

| Returns |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/Nullable https://developers.google.com/android/reference/com/google/android/gms/cast/MediaQueueItem.html` | The item that corresponds to the period with the given id, or null if no media queue or period with id `periodId` exist. |

### getMaxSeekToPreviousPosition

```
public long getMaxSeekToPreviousPosition()
```

Returns the maximum position for which `https://developer.android.com/reference/androidx/media3/common/Player#seekToPrevious()` seeks to the previous `https://developer.android.com/reference/androidx/media3/common/MediaItem`, in milliseconds.

| Returns |
|---|---|
| `long` | The maximum seek to previous position, in milliseconds. |

| See also |
|---|---|
| `https://developer.android.com/reference/androidx/media3/common/Player.Listener#onMaxSeekToPreviousPositionChanged(long)` |   |

### getMediaMetadata

```
public MediaMetadata getMediaMetadata()
```

Returns the current combined `https://developer.android.com/reference/androidx/media3/common/MediaMetadata`, or `https://developer.android.com/reference/androidx/media3/common/MediaMetadata#EMPTY()` if not supported.

This `https://developer.android.com/reference/androidx/media3/common/MediaMetadata` is a combination of the `https://developer.android.com/reference/androidx/media3/common/MediaItem#mediaMetadata()`, the static metadata in the media's `https://developer.android.com/reference/androidx/media3/common/Format#metadata()`, and any timed metadata that has been parsed from the media and output via `https://developer.android.com/reference/androidx/media3/common/Player.Listener#onMetadata(androidx.media3.common.Metadata)`. If a field is populated in the `https://developer.android.com/reference/androidx/media3/common/MediaItem#mediaMetadata()`, it will be prioritised above the same field coming from static or timed metadata.

This method must only be called if `https://developer.android.com/reference/androidx/media3/common/Player#COMMAND_GET_METADATA()` is `https://developer.android.com/reference/androidx/media3/common/Player#getAvailableCommands()`.

| See also |
|---|---|
| `https://developer.android.com/reference/androidx/media3/common/Player.Listener#onMediaMetadataChanged(androidx.media3.common.MediaMetadata)` |   |

### getPlayWhenReady

```
public boolean getPlayWhenReady()
```

Whether playback will proceed when `https://developer.android.com/reference/androidx/media3/common/Player#getPlaybackState()` == `https://developer.android.com/reference/androidx/media3/common/Player#STATE_READY()`.

| Returns |
|---|---|
| `boolean` | Whether playback will proceed when ready. |

| See also |
|---|---|
| `https://developer.android.com/reference/androidx/media3/common/Player.Listener#onPlayWhenReadyChanged(boolean,int)` |   |

### getPlaybackParameters

```
public PlaybackParameters getPlaybackParameters()
```

Returns the currently active playback parameters.

| See also |
|---|---|
| `https://developer.android.com/reference/androidx/media3/common/Player.Listener#onPlaybackParametersChanged(androidx.media3.common.PlaybackParameters)` |   |

### getPlaybackState

```
@Player.State
public int getPlaybackState()
```

Returns the current `https://developer.android.com/reference/androidx/media3/common/Player.State` of the player.

| Returns |
|---|---|
| `int` | The current `https://developer.android.com/reference/androidx/media3/common/Player.State`. |

| See also |
|---|---|
| `https://developer.android.com/reference/androidx/media3/common/Player.Listener#onPlaybackStateChanged(int)` |   |

### getPlaybackSuppressionReason

```
@Player.PlaybackSuppressionReason
public int getPlaybackSuppressionReason()
```

Returns the reason why playback is suppressed even though `https://developer.android.com/reference/androidx/media3/common/Player#getPlayWhenReady()` is `
true`, or `https://developer.android.com/reference/androidx/media3/common/Player#PLAYBACK_SUPPRESSION_REASON_NONE()` if playback is not suppressed.

| Returns |
|---|---|
| `int` | The current `https://developer.android.com/reference/androidx/media3/common/Player.PlaybackSuppressionReason`. |

| See also |
|---|---|
| `https://developer.android.com/reference/androidx/media3/common/Player.Listener#onPlaybackSuppressionReasonChanged(int)` |   |

### getPlayerError

```
public @Nullable PlaybackException getPlayerError()
```

Returns the error that caused playback to fail. This is the same error that will have been reported via `https://developer.android.com/reference/androidx/media3/common/Player.Listener#onPlayerError(androidx.media3.common.PlaybackException)` at the time of failure. It can be queried using this method until the player is re-prepared.

Note that this method will always return `null` if `https://developer.android.com/reference/androidx/media3/common/Player#getPlaybackState()` is not `https://developer.android.com/reference/androidx/media3/common/Player#STATE_IDLE()`.

| Returns |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/Nullable https://developer.android.com/reference/androidx/media3/common/PlaybackException` | The error, or `null`. |

| See also |
|---|---|
| `https://developer.android.com/reference/androidx/media3/common/Player.Listener#onPlayerError(androidx.media3.common.PlaybackException)` |   |

### getPlaylistMetadata

```
public MediaMetadata getPlaylistMetadata()
```

Returns the playlist `https://developer.android.com/reference/androidx/media3/common/MediaMetadata`, as set by `https://developer.android.com/reference/androidx/media3/common/Player#setPlaylistMetadata(androidx.media3.common.MediaMetadata)`, or `https://developer.android.com/reference/androidx/media3/common/MediaMetadata#EMPTY()` if not supported.

This method must only be called if `https://developer.android.com/reference/androidx/media3/common/Player#COMMAND_GET_METADATA()` is `https://developer.android.com/reference/androidx/media3/common/Player#getAvailableCommands()`.

| See also |
|---|---|
| `https://developer.android.com/reference/androidx/media3/common/Player.Listener#onPlaylistMetadataChanged(androidx.media3.common.MediaMetadata)` |   |

### getRepeatMode

```
@Player.RepeatMode
public int getRepeatMode()
```

Returns the current `https://developer.android.com/reference/androidx/media3/common/Player.RepeatMode` used for playback.

| Returns |
|---|---|
| `int` | The current repeat mode. |

| See also |
|---|---|
| `https://developer.android.com/reference/androidx/media3/common/Player.Listener#onRepeatModeChanged(int)` |   |

### getSeekBackIncrement

```
public long getSeekBackIncrement()
```

Returns the `https://developer.android.com/reference/androidx/media3/common/Player#seekBack()` increment.

| Returns |
|---|---|
| `long` | The seek back increment, in milliseconds. |

| See also |
|---|---|
| `https://developer.android.com/reference/androidx/media3/common/Player.Listener#onSeekBackIncrementChanged(long)` |   |

### getSeekForwardIncrement

```
public long getSeekForwardIncrement()
```

Returns the `https://developer.android.com/reference/androidx/media3/common/Player#seekForward()` increment.

| Returns |
|---|---|
| `long` | The seek forward increment, in milliseconds. |

| See also |
|---|---|
| `https://developer.android.com/reference/androidx/media3/common/Player.Listener#onSeekForwardIncrementChanged(long)` |   |

### getShuffleModeEnabled

```
public boolean getShuffleModeEnabled()
```

Returns whether shuffling of media items is enabled.

| See also |
|---|---|
| `https://developer.android.com/reference/androidx/media3/common/Player.Listener#onShuffleModeEnabledChanged(boolean)` |   |

### getSurfaceSize

```
public Size getSurfaceSize()
```

This method is not supported and returns `https://developer.android.com/reference/androidx/media3/common/util/Size#UNKNOWN()`.

### getTotalBufferedDuration

```
public long getTotalBufferedDuration()
```

Returns an estimate of the total buffered duration from the current position, in milliseconds. This includes pre-buffered data for subsequent ads and `https://developer.android.com/reference/androidx/media3/common/MediaItem`.

This method must only be called if `https://developer.android.com/reference/androidx/media3/common/Player#COMMAND_GET_CURRENT_MEDIA_ITEM()` is `https://developer.android.com/reference/androidx/media3/common/Player#getAvailableCommands()`.

### getTrackSelectionParameters

```
public TrackSelectionParameters getTrackSelectionParameters()
```

Returns the parameters constraining the track selection.

| See also |
|---|---|
| `https://developer.android.com/reference/androidx/media3/common/Player.Listener#onTrackSelectionParametersChanged(androidx.media3.common.TrackSelectionParameters)` | } |

### getVideoSize

```
public VideoSize getVideoSize()
```

This method is not supported and returns `https://developer.android.com/reference/androidx/media3/common/VideoSize#UNKNOWN()`.

### getVolume

```
public float getVolume()
```

Returns the audio volume, with 0 being silence and 1 being unity gain (signal unchanged).

This method must only be called if `https://developer.android.com/reference/androidx/media3/common/Player#COMMAND_GET_VOLUME()` is `https://developer.android.com/reference/androidx/media3/common/Player#getAvailableCommands()`.

| Returns |
|---|---|
| `float` | The linear gain applied to all audio channels. |

| See also |
|---|---|
| `https://developer.android.com/reference/androidx/media3/common/Player.Listener#onVolumeChanged(float)` |   |

### increaseDeviceVolume

```
@InlineMe(replacement = "this.increaseDeviceVolume(0)")
public void [increaseDeviceVolume](https://developer.android.com/reference/androidx/media3/cast/RemoteCastPlayer#increaseDeviceVolume())()
```

> [!CAUTION]
> **This method is deprecated.**   
>
> Use `https://developer.android.com/reference/androidx/media3/cast/RemoteCastPlayer#increaseDeviceVolume(int)` instead.

### increaseDeviceVolume

```
public void increaseDeviceVolume(@C.VolumeFlags int flags)
```

Increases the volume of the device.

The `https://developer.android.com/reference/androidx/media3/common/Player#getDeviceVolume()` device volume cannot be increased above `https://developer.android.com/reference/androidx/media3/common/DeviceInfo#maxVolume()`, if defined.

Note that this method affects the device volume. To change the volume of the current stream only, use `https://developer.android.com/reference/androidx/media3/common/Player#setVolume(float)`.

This method must only be called if `https://developer.android.com/reference/androidx/media3/common/Player#COMMAND_ADJUST_DEVICE_VOLUME_WITH_FLAGS()` is `https://developer.android.com/reference/androidx/media3/common/Player#getAvailableCommands()`.

| Parameters |
|---|---|
| `@https://developer.android.com/reference/androidx/media3/common/C.VolumeFlags int flags` | Either 0 or a bitwise combination of one or more `https://developer.android.com/reference/androidx/media3/common/C.VolumeFlags`. |

### isCastSessionAvailable

```
public boolean isCastSessionAvailable()
```

Returns whether a cast session is available.

### isDeviceMuted

```
public boolean isDeviceMuted()
```

Gets whether the device is muted or not.

Note that this method returns the mute state of the device. To check if the current stream is muted, use `getVolume() == 0`.

This method must only be called if `https://developer.android.com/reference/androidx/media3/common/Player#COMMAND_GET_DEVICE_VOLUME()` is `https://developer.android.com/reference/androidx/media3/common/Player#getAvailableCommands()`.

| See also |
|---|---|
| `https://developer.android.com/reference/androidx/media3/common/Player.Listener#onDeviceVolumeChanged(int,boolean)` |   |

### isLoading

```
public boolean isLoading()
```

Whether the player is currently loading the source.

| Returns |
|---|---|
| `boolean` | Whether the player is currently loading the source. |

| See also |
|---|---|
| `https://developer.android.com/reference/androidx/media3/common/Player.Listener#onIsLoadingChanged(boolean)` |   |

### isPlayingAd

```
public boolean isPlayingAd()
```

Returns whether the player is currently playing an ad.

This method must only be called if `https://developer.android.com/reference/androidx/media3/common/Player#COMMAND_GET_CURRENT_MEDIA_ITEM()` is `https://developer.android.com/reference/androidx/media3/common/Player#getAvailableCommands()`.

### moveMediaItems

```
public void moveMediaItems(int fromIndex, int toIndex, int newIndex)
```

Moves the media item range to the new index.

This method must only be called if `https://developer.android.com/reference/androidx/media3/common/Player#COMMAND_CHANGE_MEDIA_ITEMS()` is `https://developer.android.com/reference/androidx/media3/common/Player#getAvailableCommands()`.

| Parameters |
|---|---|
| `int fromIndex` | The start of the range to move. If the index is larger than the size of the playlist, the request is ignored. |
| `int toIndex` | The first item not to be included in the range (exclusive). If the index is larger than the size of the playlist, items up to the end of the playlist are moved. |
| `int newIndex` | The new index of the first media item of the range. If the new index is larger than the size of the remaining playlist after removing the range, the range is moved to the end of the playlist. |

### mute

```
public void mute()
```

Sets the audio volume to 0.

This method must only be called if `https://developer.android.com/reference/androidx/media3/common/Player#COMMAND_SET_VOLUME()` is `https://developer.android.com/reference/androidx/media3/common/Player#getAvailableCommands()`.

### prepare

```
public void prepare()
```

Prepares the player.

This method must only be called if `https://developer.android.com/reference/androidx/media3/common/Player#COMMAND_PREPARE()` is `https://developer.android.com/reference/androidx/media3/common/Player#getAvailableCommands()`.

This will move the player out of `https://developer.android.com/reference/androidx/media3/common/Player#STATE_IDLE()` and the player will start loading media and acquire resources needed for playback.

### release

```
public void release()
```

Releases the player. This method must be called when the player is no longer required. The player must not be used after calling this method.

This method must only be called if `https://developer.android.com/reference/androidx/media3/common/Player#COMMAND_RELEASE()` is `https://developer.android.com/reference/androidx/media3/common/Player#getAvailableCommands()`.

### removeListener

```
public void removeListener(Player.Listener listener)
```

Unregister a listener registered through `https://developer.android.com/reference/androidx/media3/common/Player#addListener(androidx.media3.common.Player.Listener)`. The listener will no longer receive events.

| Parameters |
|---|---|
| `https://developer.android.com/reference/androidx/media3/common/Player.Listener listener` | The listener to unregister. |

### removeMediaItems

```
public void removeMediaItems(int fromIndex, int toIndex)
```

Removes a range of media items from the playlist.

This method must only be called if `https://developer.android.com/reference/androidx/media3/common/Player#COMMAND_CHANGE_MEDIA_ITEMS()` is `https://developer.android.com/reference/androidx/media3/common/Player#getAvailableCommands()`.

| Parameters |
|---|---|
| `int fromIndex` | The index at which to start removing media items. If the index is larger than the size of the playlist, the request is ignored. |
| `int toIndex` | The index of the first item to be kept (exclusive). If the index is larger than the size of the playlist, media items up to the end of the playlist are removed. |

### replaceMediaItems

```
public void replaceMediaItems(
    int fromIndex,
    int toIndex,
    List<MediaItem> mediaItems
)
```

Replaces the media items at the given range of the playlist.

Implementations of this method may attempt to seamlessly continue playback if the currently playing media item is replaced with a compatible one (e.g. same URL, only metadata has changed).

This method must only be called if `https://developer.android.com/reference/androidx/media3/common/Player#COMMAND_CHANGE_MEDIA_ITEMS()` is `https://developer.android.com/reference/androidx/media3/common/Player#getAvailableCommands()`.

Note that it is possible to replace a range with an arbitrary number of new items, so that the number of removed items defined by `fromIndex` and `toIndex` does not have to match the number of added items defined by `mediaItems`. As result, it may also change the index of subsequent items not touched by this operation.

| Parameters |
|---|---|
| `int fromIndex` | The start of the range. If the index is larger than the size of the playlist, the request is ignored. |
| `int toIndex` | The first item not to be included in the range (exclusive). If the index is larger than the size of the playlist, items up to the end of the playlist are replaced. |
| `https://developer.android.com/reference/java/util/List.html<https://developer.android.com/reference/androidx/media3/common/MediaItem> mediaItems` | The `https://developer.android.com/reference/androidx/media3/common/MediaItem` to replace the range with. |

### setAudioAttributes

```
public void setAudioAttributes(
    AudioAttributes audioAttributes,
    boolean handleAudioFocus
)
```

This method is not supported and does nothing.

### setDeviceMuted

```
@InlineMe(replacement = "this.setDeviceMuted(muted, 0)")
public void [setDeviceMuted](https://developer.android.com/reference/androidx/media3/cast/RemoteCastPlayer#setDeviceMuted(boolean))(boolean muted)
```

> [!CAUTION]
> **This method is deprecated.**   
>
> Use `https://developer.android.com/reference/androidx/media3/cast/RemoteCastPlayer#setDeviceMuted(boolean,int)` instead.

### setDeviceMuted

```
public void setDeviceMuted(boolean muted, @C.VolumeFlags int flags)
```

Sets the mute state of the device.

Note that this method affects the device volume. To mute just the current stream, use `
setVolume(0)` instead.

This method must only be called if `https://developer.android.com/reference/androidx/media3/common/Player#COMMAND_ADJUST_DEVICE_VOLUME_WITH_FLAGS()` is `https://developer.android.com/reference/androidx/media3/common/Player#getAvailableCommands()`.

| Parameters |
|---|---|
| `boolean muted` | Whether to set the device to be muted or not |
| `@https://developer.android.com/reference/androidx/media3/common/C.VolumeFlags int flags` | Either 0 or a bitwise combination of one or more `https://developer.android.com/reference/androidx/media3/common/C.VolumeFlags`. |

### setDeviceVolume

```
@InlineMe(replacement = "this.setDeviceVolume(volume, 0)")
public void [setDeviceVolume](https://developer.android.com/reference/androidx/media3/cast/RemoteCastPlayer#setDeviceVolume(int))(@IntRange(from = 0) int volume)
```

> [!CAUTION]
> **This method is deprecated.**   
>
> Use `https://developer.android.com/reference/androidx/media3/cast/RemoteCastPlayer#setDeviceVolume(int,int)` instead.

### setDeviceVolume

```
public void setDeviceVolume(@IntRange(from = 0) int volume, @C.VolumeFlags int flags)
```

Sets the volume of the device with volume flags.

Note that this method affects the device volume. To change the volume of the current stream only, use `https://developer.android.com/reference/androidx/media3/common/Player#setVolume(float)`.

This method must only be called if `https://developer.android.com/reference/androidx/media3/common/Player#COMMAND_SET_DEVICE_VOLUME_WITH_FLAGS()` is `https://developer.android.com/reference/androidx/media3/common/Player#getAvailableCommands()`.

| Parameters |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/IntRange(from = 0) int volume` | The volume to set. |
| `@https://developer.android.com/reference/androidx/media3/common/C.VolumeFlags int flags` | Either 0 or a bitwise combination of one or more `https://developer.android.com/reference/androidx/media3/common/C.VolumeFlags`. |

### setMediaItems

```
public void setMediaItems(List<MediaItem> mediaItems, boolean resetPosition)
```

Clears the playlist and adds the specified `https://developer.android.com/reference/androidx/media3/common/MediaItem`.

To replace a span of media items (possibly seamlessly) without clearing the playlist, use `https://developer.android.com/reference/androidx/media3/common/Player#replaceMediaItems(int,int,java.util.List<androidx.media3.common.MediaItem>)`.

This method must only be called if `https://developer.android.com/reference/androidx/media3/common/Player#COMMAND_CHANGE_MEDIA_ITEMS()` is `https://developer.android.com/reference/androidx/media3/common/Player#getAvailableCommands()`.

| Parameters |
|---|---|
| `https://developer.android.com/reference/java/util/List.html<https://developer.android.com/reference/androidx/media3/common/MediaItem> mediaItems` | The new `https://developer.android.com/reference/androidx/media3/common/MediaItem`. |
| `boolean resetPosition` | Whether the playback position should be reset to the default position in the first `https://developer.android.com/reference/androidx/media3/common/Timeline.Window`. If false, playback will start from the position defined by `https://developer.android.com/reference/androidx/media3/common/Player#getCurrentMediaItemIndex()` and `https://developer.android.com/reference/androidx/media3/common/Player#getCurrentPosition()`. |

### setMediaItems

```
public void setMediaItems(
    List<MediaItem> mediaItems,
    int startIndex,
    long startPositionMs
)
```

Clears the playlist and adds the specified `https://developer.android.com/reference/androidx/media3/common/MediaItem`.

To replace a span of media items (possibly seamlessly) without clearing the playlist, use `https://developer.android.com/reference/androidx/media3/common/Player#replaceMediaItems(int,int,java.util.List<androidx.media3.common.MediaItem>)`.

This method must only be called if `https://developer.android.com/reference/androidx/media3/common/Player#COMMAND_CHANGE_MEDIA_ITEMS()` is `https://developer.android.com/reference/androidx/media3/common/Player#getAvailableCommands()`.

| Parameters |
|---|---|
| `https://developer.android.com/reference/java/util/List.html<https://developer.android.com/reference/androidx/media3/common/MediaItem> mediaItems` | The new `https://developer.android.com/reference/androidx/media3/common/MediaItem`. |
| `int startIndex` | The `https://developer.android.com/reference/androidx/media3/common/MediaItem` index to start playback from. If `https://developer.android.com/reference/androidx/media3/common/C#INDEX_UNSET()` is passed, the current position is not reset. |
| `long startPositionMs` | The position in milliseconds to start playback from. If `https://developer.android.com/reference/androidx/media3/common/C#TIME_UNSET()` is passed, the default position of the given `https://developer.android.com/reference/androidx/media3/common/MediaItem` is used. In any case, if `startIndex` is set to `https://developer.android.com/reference/androidx/media3/common/C#INDEX_UNSET()`, this parameter is ignored and the position is not reset at all. |

| Throws |
|---|---|
| `https://developer.android.com/reference/androidx/media3/common/IllegalSeekPositionException` | If the provided `startIndex` is not within the bounds of the list of media items. |

### setPlayWhenReady

```
public void setPlayWhenReady(boolean playWhenReady)
```

Sets whether playback should proceed when `https://developer.android.com/reference/androidx/media3/common/Player#getPlaybackState()` == `https://developer.android.com/reference/androidx/media3/common/Player#STATE_READY()`.

If the player is already in the ready state then this method pauses and resumes playback.

This method must only be called if `https://developer.android.com/reference/androidx/media3/common/Player#COMMAND_PLAY_PAUSE()` is `https://developer.android.com/reference/androidx/media3/common/Player#getAvailableCommands()`.

| Parameters |
|---|---|
| `boolean playWhenReady` | Whether playback should proceed when ready. |

### setPlaybackParameters

```
public void setPlaybackParameters(PlaybackParameters playbackParameters)
```

Attempts to set the playback parameters. Passing `https://developer.android.com/reference/androidx/media3/common/PlaybackParameters#DEFAULT()` resets the player to the default, which means there is no speed or pitch adjustment.

Playback parameters changes may cause the player to buffer. `https://developer.android.com/reference/androidx/media3/common/Player.Listener#onPlaybackParametersChanged(androidx.media3.common.PlaybackParameters)` will be called whenever the currently active playback parameters change.

This method must only be called if `https://developer.android.com/reference/androidx/media3/common/Player#COMMAND_SET_SPEED_AND_PITCH()` is `https://developer.android.com/reference/androidx/media3/common/Player#getAvailableCommands()`.

| Parameters |
|---|---|
| `https://developer.android.com/reference/androidx/media3/common/PlaybackParameters playbackParameters` | The playback parameters. |

### setPlaylistMetadata

```
public void setPlaylistMetadata(MediaMetadata playlistMetadata)
```

Sets the playlist `https://developer.android.com/reference/androidx/media3/common/MediaMetadata`.

This method must only be called if `https://developer.android.com/reference/androidx/media3/common/Player#COMMAND_SET_PLAYLIST_METADATA()` is `https://developer.android.com/reference/androidx/media3/common/Player#getAvailableCommands()`.

### setRepeatMode

```
public void setRepeatMode(@Player.RepeatMode int repeatMode)
```

Sets the `https://developer.android.com/reference/androidx/media3/common/Player.RepeatMode` to be used for playback.

This method must only be called if `https://developer.android.com/reference/androidx/media3/common/Player#COMMAND_SET_REPEAT_MODE()` is `https://developer.android.com/reference/androidx/media3/common/Player#getAvailableCommands()`.

| Parameters |
|---|---|
| `@https://developer.android.com/reference/androidx/media3/common/Player.RepeatMode int repeatMode` | The repeat mode. |

### setSessionAvailabilityListener

```
public void setSessionAvailabilityListener(
    @Nullable SessionAvailabilityListener listener
)
```

Sets a listener for updates on the cast session availability.

| Parameters |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/Nullable https://developer.android.com/reference/androidx/media3/cast/SessionAvailabilityListener listener` | The `https://developer.android.com/reference/androidx/media3/cast/SessionAvailabilityListener`, or null to clear the listener. |

### setShuffleModeEnabled

```
public void setShuffleModeEnabled(boolean shuffleModeEnabled)
```

Sets whether shuffling of media items is enabled.

This method must only be called if `https://developer.android.com/reference/androidx/media3/common/Player#COMMAND_SET_SHUFFLE_MODE()` is `https://developer.android.com/reference/androidx/media3/common/Player#getAvailableCommands()`.

| Parameters |
|---|---|
| `boolean shuffleModeEnabled` | Whether shuffling is enabled. |

### setTrackSelectionParameters

```
public void setTrackSelectionParameters(TrackSelectionParameters parameters)
```

Sets the parameters constraining the track selection.

Unsupported parameters will be silently ignored.

Use `https://developer.android.com/reference/androidx/media3/common/Player#getTrackSelectionParameters()` to retrieve the current parameters. For example, the following snippet restricts video to SD whilst keep other track selection parameters unchanged:

```
player.setTrackSelectionParameters(
  player.getTrackSelectionParameters()
        .buildUpon()
        .setMaxVideoSizeSd()
        .build())
```

This method must only be called if `https://developer.android.com/reference/androidx/media3/common/Player#COMMAND_SET_TRACK_SELECTION_PARAMETERS()` is `https://developer.android.com/reference/androidx/media3/common/Player#getAvailableCommands()`.

### setVideoSurface

```
public void setVideoSurface(@Nullable Surface surface)
```

This method is not supported and does nothing.

### setVideoSurfaceHolder

```
public void setVideoSurfaceHolder(@Nullable SurfaceHolder surfaceHolder)
```

This method is not supported and does nothing.

### setVideoSurfaceView

```
public void setVideoSurfaceView(@Nullable SurfaceView surfaceView)
```

This method is not supported and does nothing.

### setVideoTextureView

```
public void setVideoTextureView(@Nullable TextureView textureView)
```

This method is not supported and does nothing.

### setVolume

```
public void setVolume(float volume)
```

Sets the audio volume, valid values are between 0 (silence) and 1 (unity gain, signal unchanged), inclusive.

This method must only be called if `https://developer.android.com/reference/androidx/media3/common/Player#COMMAND_SET_VOLUME()` is `https://developer.android.com/reference/androidx/media3/common/Player#getAvailableCommands()`.

| Parameters |
|---|---|
| `float volume` | Linear output gain to apply to all audio channels. |

### stop

```
public void stop()
```

Stops playback without resetting the playlist. Use `https://developer.android.com/reference/androidx/media3/common/Player#pause()` rather than this method if the intention is to pause playback.

Calling this method will cause the playback state to transition to `https://developer.android.com/reference/androidx/media3/common/Player#STATE_IDLE()` and the player will release the loaded media and resources required for playback. The player instance can still be used by calling `https://developer.android.com/reference/androidx/media3/common/Player#prepare()` again, and `https://developer.android.com/reference/androidx/media3/common/Player#release()` must still be called on the player if it's no longer required.

Calling this method does not clear the playlist, reset the playback position or the playback error.

This method must only be called if `https://developer.android.com/reference/androidx/media3/common/Player#COMMAND_STOP()` is `https://developer.android.com/reference/androidx/media3/common/Player#getAvailableCommands()`.

### unmute

```
public void unmute()
```

If the audio volume is 0, sets the audio volume to a non-zero value decided by the Player to be the most appropriate.

This method must only be called if `https://developer.android.com/reference/androidx/media3/common/Player#COMMAND_SET_VOLUME()` is `https://developer.android.com/reference/androidx/media3/common/Player#getAvailableCommands()`.

## Protected methods

### seekTo

```
protected void seekTo(
    int mediaItemIndex,
    long positionMs,
    @Player.Command int seekCommand,
    boolean isRepeatingCurrentItem
)
```

Seeks to a position in the specified `https://developer.android.com/reference/androidx/media3/common/MediaItem`.

| Parameters |
|---|---|
| `int mediaItemIndex` | The index of the `https://developer.android.com/reference/androidx/media3/common/MediaItem`. If the original seek operation did not directly specify an index, this is the most likely implied index based on the available player state. If the implied action is to do nothing, this will be `https://developer.android.com/reference/androidx/media3/common/C#INDEX_UNSET()`. |
| `long positionMs` | The seek position in the specified `https://developer.android.com/reference/androidx/media3/common/MediaItem` in milliseconds, or `https://developer.android.com/reference/androidx/media3/common/C#TIME_UNSET()` to seek to the media item's default position. If the original seek operation did not directly specify a position, this is the most likely implied position based on the available player state. |
| `@https://developer.android.com/reference/androidx/media3/common/Player.Command int seekCommand` | The `https://developer.android.com/reference/androidx/media3/common/Player.Command` used to trigger the seek. |
| `boolean isRepeatingCurrentItem` | Whether this seeks repeats the current item. |