# CastPlayer

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/CastPlayer.java+class:androidx.media3.cast.CastPlayer)

*** ** * ** ***


```
@UnstableApi
public final class CastPlayer extends ForwardingPlayer
```

<br />

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

*** ** * ** ***

`https://developer.android.com/reference/androidx/media3/common/Player` implementation that can control playback both on the local device, and on a remote Cast device.

See `https://developer.android.com/reference/androidx/media3/cast/RemoteCastPlayer` for a `https://developer.android.com/reference/androidx/media3/common/Player` that only supports playback on Cast receivers.

This class works by delegating playback to a dedicated player depending on Cast session availability. When a Cast session becomes available or unavailable, the following steps take place:

- The new active player is a `https://developer.android.com/reference/androidx/media3/cast/RemoteCastPlayer` if a Cast session is active, or the `https://developer.android.com/reference/androidx/media3/cast/CastPlayer.Builder#setLocalPlayer(androidx.media3.common.Player)` otherwise.
- A customizable `https://developer.android.com/reference/androidx/media3/cast/CastPlayer.TransferCallback` receives both players to transfer state across players.
- The inactive player is `https://developer.android.com/reference/androidx/media3/common/Player#stop()`.

## Summary

| ### Nested types |
|---|
| `public final class https://developer.android.com/reference/androidx/media3/cast/CastPlayer.Builder` Builder for `https://developer.android.com/reference/androidx/media3/cast/CastPlayer`. |
| `public interface https://developer.android.com/reference/androidx/media3/cast/CastPlayer.TransferCallback` Callback for moving state across players when transferring playback upon Cast session availability changes. |

| ### Constants |
|---|---|
| `static final https://developer.android.com/reference/androidx/media3/common/DeviceInfo` | `https://developer.android.com/reference/androidx/media3/cast/CastPlayer#DEVICE_INFO_REMOTE_EMPTY()` Same as `https://developer.android.com/reference/androidx/media3/cast/RemoteCastPlayer#DEVICE_INFO_REMOTE_EMPTY()`. |

| ### Public constructors |
|---|
| `[CastPlayer](https://developer.android.com/reference/androidx/media3/cast/CastPlayer#CastPlayer(com.google.android.gms.cast.framework.CastContext))(https://developers.google.com/android/reference/com/google/android/gms/cast/framework/CastContext.html castContext)` **This method is deprecated.** Use `https://developer.android.com/reference/androidx/media3/cast/RemoteCastPlayer.Builder` to create a `https://developer.android.com/reference/androidx/media3/common/Player` for playback exclusively on Cast receivers, or `https://developer.android.com/reference/androidx/media3/cast/CastPlayer.Builder` for a `https://developer.android.com/reference/androidx/media3/common/Player` that works both on Cast receivers and locally. <br /> |
| `[CastPlayer](https://developer.android.com/reference/androidx/media3/cast/CastPlayer#CastPlayer(com.google.android.gms.cast.framework.CastContext,androidx.media3.cast.MediaItemConverter))( https://developers.google.com/android/reference/com/google/android/gms/cast/framework/CastContext.html castContext, https://developer.android.com/reference/androidx/media3/cast/MediaItemConverter mediaItemConverter )` **This method is deprecated.** Use `https://developer.android.com/reference/androidx/media3/cast/RemoteCastPlayer.Builder` to create a `https://developer.android.com/reference/androidx/media3/common/Player` for playback exclusively on Cast receivers, or `https://developer.android.com/reference/androidx/media3/cast/CastPlayer.Builder` for a `https://developer.android.com/reference/androidx/media3/common/Player` that works both on Cast receivers and locally. <br /> |
| `[CastPlayer](https://developer.android.com/reference/androidx/media3/cast/CastPlayer#CastPlayer(com.google.android.gms.cast.framework.CastContext,androidx.media3.cast.MediaItemConverter,long,long))( https://developers.google.com/android/reference/com/google/android/gms/cast/framework/CastContext.html castContext, https://developer.android.com/reference/androidx/media3/cast/MediaItemConverter mediaItemConverter, @https://developer.android.com/reference/androidx/annotation/IntRange(from = 1) long seekBackIncrementMs, @https://developer.android.com/reference/androidx/annotation/IntRange(from = 1) long seekForwardIncrementMs )` **This method is deprecated.** Use `https://developer.android.com/reference/androidx/media3/cast/RemoteCastPlayer.Builder` to create a `https://developer.android.com/reference/androidx/media3/common/Player` for playback exclusively on Cast receivers, or `https://developer.android.com/reference/androidx/media3/cast/CastPlayer.Builder` for a `https://developer.android.com/reference/androidx/media3/common/Player` that works both on Cast receivers and locally. <br /> |
| `[CastPlayer](https://developer.android.com/reference/androidx/media3/cast/CastPlayer#CastPlayer(android.content.Context,com.google.android.gms.cast.framework.CastContext,androidx.media3.cast.MediaItemConverter,long,long,long))( @https://developer.android.com/reference/androidx/annotation/Nullable https://developer.android.com/reference/android/content/Context.html context, https://developers.google.com/android/reference/com/google/android/gms/cast/framework/CastContext.html castContext, https://developer.android.com/reference/androidx/media3/cast/MediaItemConverter mediaItemConverter, @https://developer.android.com/reference/androidx/annotation/IntRange(from = 1) long seekBackIncrementMs, @https://developer.android.com/reference/androidx/annotation/IntRange(from = 1) long seekForwardIncrementMs, @https://developer.android.com/reference/androidx/annotation/IntRange(from = 0) long maxSeekToPreviousPositionMs )` **This method is deprecated.** Use `https://developer.android.com/reference/androidx/media3/cast/RemoteCastPlayer.Builder` to create a `https://developer.android.com/reference/androidx/media3/common/Player` for playback exclusively on Cast receivers, or `https://developer.android.com/reference/androidx/media3/cast/CastPlayer.Builder` for a `https://developer.android.com/reference/androidx/media3/common/Player` that works both on Cast receivers and locally. <br /> |

| ### Public methods |
|---|---|
| `boolean` | `[isCastSessionAvailable](https://developer.android.com/reference/androidx/media3/cast/CastPlayer#isCastSessionAvailable())()` **This method is deprecated.** Use `https://developer.android.com/reference/androidx/media3/common/ForwardingPlayer#getDeviceInfo()` instead, and check for `https://developer.android.com/reference/androidx/media3/common/DeviceInfo#PLAYBACK_TYPE_REMOTE()`. <br /> |
| `void` | `[setSessionAvailabilityListener](https://developer.android.com/reference/androidx/media3/cast/CastPlayer#setSessionAvailabilityListener(androidx.media3.cast.SessionAvailabilityListener))( @https://developer.android.com/reference/androidx/annotation/Nullable https://developer.android.com/reference/androidx/media3/cast/SessionAvailabilityListener listener )` **This method is deprecated.** Use `https://developer.android.com/reference/androidx/media3/common/Player.Listener#onDeviceInfoChanged(androidx.media3.common.DeviceInfo)` instead, and check for `https://developer.android.com/reference/androidx/media3/common/DeviceInfo#PLAYBACK_TYPE_REMOTE()`. <br /> |

| ### 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 methods |
|---|
| From [androidx.media3.common.ForwardingPlayer](https://developer.android.com/reference/androidx/media3/common/ForwardingPlayer) |---|---| | `void` | `https://developer.android.com/reference/androidx/media3/common/ForwardingPlayer#addListener(androidx.media3.common.Player.Listener)(https://developer.android.com/reference/androidx/media3/common/Player.Listener listener)` Calls `https://developer.android.com/reference/androidx/media3/common/Player#addListener(androidx.media3.common.Player.Listener)` on the delegate. | | `void` | `https://developer.android.com/reference/androidx/media3/common/ForwardingPlayer#addMediaItem(androidx.media3.common.MediaItem)(https://developer.android.com/reference/androidx/media3/common/MediaItem mediaItem)` Calls `https://developer.android.com/reference/androidx/media3/common/Player#addMediaItem(androidx.media3.common.MediaItem)` on the delegate. | | `void` | `https://developer.android.com/reference/androidx/media3/common/ForwardingPlayer#addMediaItem(int,androidx.media3.common.MediaItem)(int index, https://developer.android.com/reference/androidx/media3/common/MediaItem mediaItem)` Calls `https://developer.android.com/reference/androidx/media3/common/Player#addMediaItem(int,androidx.media3.common.MediaItem)` on the delegate. | | `void` | `https://developer.android.com/reference/androidx/media3/common/ForwardingPlayer#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)` Calls `https://developer.android.com/reference/androidx/media3/common/Player#addMediaItems(java.util.List<androidx.media3.common.MediaItem>)` on the delegate. | | `void` | `https://developer.android.com/reference/androidx/media3/common/ForwardingPlayer#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)` Calls `https://developer.android.com/reference/androidx/media3/common/Player#addMediaItems(int,java.util.List<androidx.media3.common.MediaItem>)` on the delegate. | | `boolean` | `https://developer.android.com/reference/androidx/media3/common/ForwardingPlayer#canAdvertiseSession()()` Calls `https://developer.android.com/reference/androidx/media3/common/Player#canAdvertiseSession()` on the delegate and returns the result. | | `void` | `https://developer.android.com/reference/androidx/media3/common/ForwardingPlayer#clearMediaItems()()` Calls `https://developer.android.com/reference/androidx/media3/common/Player#clearMediaItems()` on the delegate. | | `void` | `https://developer.android.com/reference/androidx/media3/common/ForwardingPlayer#clearVideoSurface()()` Calls `https://developer.android.com/reference/androidx/media3/common/Player#clearVideoSurface()` on the delegate. | | `void` | `https://developer.android.com/reference/androidx/media3/common/ForwardingPlayer#clearVideoSurface(android.view.Surface)(@https://developer.android.com/reference/androidx/annotation/Nullable https://developer.android.com/reference/android/view/Surface.html surface)` Calls `https://developer.android.com/reference/androidx/media3/common/Player#clearVideoSurface(android.view.Surface)` on the delegate. | | `void` | `https://developer.android.com/reference/androidx/media3/common/ForwardingPlayer#clearVideoSurfaceHolder(android.view.SurfaceHolder)(@https://developer.android.com/reference/androidx/annotation/Nullable https://developer.android.com/reference/android/view/SurfaceHolder.html surfaceHolder)` Calls `https://developer.android.com/reference/androidx/media3/common/Player#clearVideoSurfaceHolder(android.view.SurfaceHolder)` on the delegate. | | `void` | `https://developer.android.com/reference/androidx/media3/common/ForwardingPlayer#clearVideoSurfaceView(android.view.SurfaceView)(@https://developer.android.com/reference/androidx/annotation/Nullable https://developer.android.com/reference/android/view/SurfaceView.html surfaceView)` Calls `https://developer.android.com/reference/androidx/media3/common/Player#clearVideoSurfaceView(android.view.SurfaceView)` on the delegate. | | `void` | `https://developer.android.com/reference/androidx/media3/common/ForwardingPlayer#clearVideoTextureView(android.view.TextureView)(@https://developer.android.com/reference/androidx/annotation/Nullable https://developer.android.com/reference/android/view/TextureView.html textureView)` Calls `https://developer.android.com/reference/androidx/media3/common/Player#clearVideoTextureView(android.view.TextureView)` on the delegate. | | `void` | `[decreaseDeviceVolume](https://developer.android.com/reference/androidx/media3/common/ForwardingPlayer#decreaseDeviceVolume())()` **This method is deprecated.** Use `https://developer.android.com/reference/androidx/media3/common/ForwardingPlayer#decreaseDeviceVolume(int)` instead. <br /> | | `void` | `https://developer.android.com/reference/androidx/media3/common/ForwardingPlayer#decreaseDeviceVolume(int)(@https://developer.android.com/reference/androidx/media3/common/C.VolumeFlags int flags)` Calls `https://developer.android.com/reference/androidx/media3/common/Player#decreaseDeviceVolume(int)` on the delegate. | | `https://developer.android.com/reference/android/os/Looper.html` | `https://developer.android.com/reference/androidx/media3/common/ForwardingPlayer#getApplicationLooper()()` Calls `https://developer.android.com/reference/androidx/media3/common/Player#getApplicationLooper()` on the delegate and returns the result. | | `https://developer.android.com/reference/androidx/media3/common/AudioAttributes` | `https://developer.android.com/reference/androidx/media3/common/ForwardingPlayer#getAudioAttributes()()` Calls `https://developer.android.com/reference/androidx/media3/common/Player#getAudioAttributes()` on the delegate and returns the result. | | `int` | `https://developer.android.com/reference/androidx/media3/common/ForwardingPlayer#getAudioSessionId()()` Calls `https://developer.android.com/reference/androidx/media3/common/Player#getAudioSessionId()` on the delegate and returns the result. | | `https://developer.android.com/reference/androidx/media3/common/Player.Commands` | `https://developer.android.com/reference/androidx/media3/common/ForwardingPlayer#getAvailableCommands()()` Calls `https://developer.android.com/reference/androidx/media3/common/Player#getAvailableCommands()` on the delegate and returns the result. | | `int` | `https://developer.android.com/reference/androidx/media3/common/ForwardingPlayer#getBufferedPercentage()()` Calls `https://developer.android.com/reference/androidx/media3/common/Player#getBufferedPercentage()` on the delegate and returns the result. | | `long` | `https://developer.android.com/reference/androidx/media3/common/ForwardingPlayer#getBufferedPosition()()` Calls `https://developer.android.com/reference/androidx/media3/common/Player#getBufferedPosition()` on the delegate and returns the result. | | `long` | `https://developer.android.com/reference/androidx/media3/common/ForwardingPlayer#getContentBufferedPosition()()` Calls `https://developer.android.com/reference/androidx/media3/common/Player#getContentBufferedPosition()` on the delegate and returns the result. | | `long` | `https://developer.android.com/reference/androidx/media3/common/ForwardingPlayer#getContentDuration()()` Calls `https://developer.android.com/reference/androidx/media3/common/Player#getContentDuration()` on the delegate and returns the result. | | `long` | `https://developer.android.com/reference/androidx/media3/common/ForwardingPlayer#getContentPosition()()` Calls `https://developer.android.com/reference/androidx/media3/common/Player#getContentPosition()` on the delegate and returns the result. | | `int` | `https://developer.android.com/reference/androidx/media3/common/ForwardingPlayer#getCurrentAdGroupIndex()()` Calls `https://developer.android.com/reference/androidx/media3/common/Player#getCurrentAdGroupIndex()` on the delegate and returns the result. | | `int` | `https://developer.android.com/reference/androidx/media3/common/ForwardingPlayer#getCurrentAdIndexInAdGroup()()` Calls `https://developer.android.com/reference/androidx/media3/common/Player#getCurrentAdIndexInAdGroup()` on the delegate and returns the result. | | `https://developer.android.com/reference/androidx/media3/common/text/CueGroup` | `https://developer.android.com/reference/androidx/media3/common/ForwardingPlayer#getCurrentCues()()` Calls `https://developer.android.com/reference/androidx/media3/common/Player#getCurrentCues()` on the delegate and returns the result. | | `long` | `https://developer.android.com/reference/androidx/media3/common/ForwardingPlayer#getCurrentLiveOffset()()` Calls `https://developer.android.com/reference/androidx/media3/common/Player#getCurrentLiveOffset()` on the delegate and returns the result. | | `@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/ForwardingPlayer#getCurrentManifest()()` Calls `https://developer.android.com/reference/androidx/media3/common/Player#getCurrentManifest()` on the delegate and returns the result. | | `@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/ForwardingPlayer#getCurrentMediaItem()()` Calls `https://developer.android.com/reference/androidx/media3/common/Player#getCurrentMediaItem()` on the delegate and returns the result. | | `int` | `https://developer.android.com/reference/androidx/media3/common/ForwardingPlayer#getCurrentMediaItemIndex()()` Calls `https://developer.android.com/reference/androidx/media3/common/Player#getCurrentMediaItemIndex()` on the delegate and returns the result. | | `int` | `https://developer.android.com/reference/androidx/media3/common/ForwardingPlayer#getCurrentPeriodIndex()()` Calls `https://developer.android.com/reference/androidx/media3/common/Player#getCurrentPeriodIndex()` on the delegate and returns the result. | | `long` | `https://developer.android.com/reference/androidx/media3/common/ForwardingPlayer#getCurrentPosition()()` Calls `https://developer.android.com/reference/androidx/media3/common/Player#getCurrentPosition()` on the delegate and returns the result. | | `https://developer.android.com/reference/androidx/media3/common/Timeline` | `https://developer.android.com/reference/androidx/media3/common/ForwardingPlayer#getCurrentTimeline()()` Calls `https://developer.android.com/reference/androidx/media3/common/Player#getCurrentTimeline()` on the delegate and returns the result. | | `https://developer.android.com/reference/androidx/media3/common/Tracks` | `https://developer.android.com/reference/androidx/media3/common/ForwardingPlayer#getCurrentTracks()()` Calls `https://developer.android.com/reference/androidx/media3/common/Player#getCurrentTracks()` on the delegate and returns the result. | | `int` | `[getCurrentWindowIndex](https://developer.android.com/reference/androidx/media3/common/ForwardingPlayer#getCurrentWindowIndex())()` **This method is deprecated.** Use `https://developer.android.com/reference/androidx/media3/common/ForwardingPlayer#getCurrentMediaItemIndex()` instead. <br /> | | `https://developer.android.com/reference/androidx/media3/common/DeviceInfo` | `https://developer.android.com/reference/androidx/media3/common/ForwardingPlayer#getDeviceInfo()()` Calls `https://developer.android.com/reference/androidx/media3/common/Player#getDeviceInfo()` on the delegate and returns the result. | | `int` | `https://developer.android.com/reference/androidx/media3/common/ForwardingPlayer#getDeviceVolume()()` Calls `https://developer.android.com/reference/androidx/media3/common/Player#getDeviceVolume()` on the delegate and returns the result. | | `long` | `https://developer.android.com/reference/androidx/media3/common/ForwardingPlayer#getDuration()()` Calls `https://developer.android.com/reference/androidx/media3/common/Player#getDuration()` on the delegate and returns the result. | | `long` | `https://developer.android.com/reference/androidx/media3/common/ForwardingPlayer#getMaxSeekToPreviousPosition()()` Calls `https://developer.android.com/reference/androidx/media3/common/Player#getMaxSeekToPreviousPosition()` on the delegate and returns the result. | | `https://developer.android.com/reference/androidx/media3/common/MediaItem` | `https://developer.android.com/reference/androidx/media3/common/ForwardingPlayer#getMediaItemAt(int)(int index)` Calls `https://developer.android.com/reference/androidx/media3/common/Player#getMediaItemAt(int)` on the delegate and returns the result. | | `int` | `https://developer.android.com/reference/androidx/media3/common/ForwardingPlayer#getMediaItemCount()()` Calls `https://developer.android.com/reference/androidx/media3/common/Player#getMediaItemCount()` on the delegate and returns the result. | | `https://developer.android.com/reference/androidx/media3/common/MediaMetadata` | `https://developer.android.com/reference/androidx/media3/common/ForwardingPlayer#getMediaMetadata()()` Calls `https://developer.android.com/reference/androidx/media3/common/Player#getMediaMetadata()` on the delegate and returns the result. | | `int` | `https://developer.android.com/reference/androidx/media3/common/ForwardingPlayer#getNextMediaItemIndex()()` Calls `https://developer.android.com/reference/androidx/media3/common/Player#getNextMediaItemIndex()` on the delegate and returns the result. | | `int` | `[getNextWindowIndex](https://developer.android.com/reference/androidx/media3/common/ForwardingPlayer#getNextWindowIndex())()` **This method is deprecated.** Use `https://developer.android.com/reference/androidx/media3/common/ForwardingPlayer#getNextMediaItemIndex()` instead. <br /> | | `boolean` | `https://developer.android.com/reference/androidx/media3/common/ForwardingPlayer#getPlayWhenReady()()` Calls `https://developer.android.com/reference/androidx/media3/common/Player#getPlayWhenReady()` on the delegate and returns the result. | | `https://developer.android.com/reference/androidx/media3/common/PlaybackParameters` | `https://developer.android.com/reference/androidx/media3/common/ForwardingPlayer#getPlaybackParameters()()` Calls `https://developer.android.com/reference/androidx/media3/common/Player#getPlaybackParameters()` on the delegate and returns the result. | | `int` | `https://developer.android.com/reference/androidx/media3/common/ForwardingPlayer#getPlaybackState()()` Calls `https://developer.android.com/reference/androidx/media3/common/Player#getPlaybackState()` on the delegate and returns the result. | | `int` | `https://developer.android.com/reference/androidx/media3/common/ForwardingPlayer#getPlaybackSuppressionReason()()` Calls `https://developer.android.com/reference/androidx/media3/common/Player#getPlaybackSuppressionReason()` on the delegate and returns the result. | | `@https://developer.android.com/reference/androidx/annotation/Nullable https://developer.android.com/reference/androidx/media3/common/PlaybackException` | `https://developer.android.com/reference/androidx/media3/common/ForwardingPlayer#getPlayerError()()` Calls `https://developer.android.com/reference/androidx/media3/common/Player#getPlayerError()` on the delegate and returns the result. | | `https://developer.android.com/reference/androidx/media3/common/MediaMetadata` | `https://developer.android.com/reference/androidx/media3/common/ForwardingPlayer#getPlaylistMetadata()()` Calls `https://developer.android.com/reference/androidx/media3/common/Player#getPlaylistMetadata()` on the delegate and returns the result. | | `int` | `https://developer.android.com/reference/androidx/media3/common/ForwardingPlayer#getPreviousMediaItemIndex()()` Calls `https://developer.android.com/reference/androidx/media3/common/Player#getPreviousMediaItemIndex()` on the delegate and returns the result. | | `int` | `[getPreviousWindowIndex](https://developer.android.com/reference/androidx/media3/common/ForwardingPlayer#getPreviousWindowIndex())()` **This method is deprecated.** Use `https://developer.android.com/reference/androidx/media3/common/ForwardingPlayer#getPreviousMediaItemIndex()` instead. <br /> | | `int` | `https://developer.android.com/reference/androidx/media3/common/ForwardingPlayer#getRepeatMode()()` Calls `https://developer.android.com/reference/androidx/media3/common/Player#getRepeatMode()` on the delegate and returns the result. | | `long` | `https://developer.android.com/reference/androidx/media3/common/ForwardingPlayer#getSeekBackIncrement()()` Calls `https://developer.android.com/reference/androidx/media3/common/Player#getSeekBackIncrement()` on the delegate and returns the result. | | `long` | `https://developer.android.com/reference/androidx/media3/common/ForwardingPlayer#getSeekForwardIncrement()()` Calls `https://developer.android.com/reference/androidx/media3/common/Player#getSeekForwardIncrement()` on the delegate and returns the result. | | `boolean` | `https://developer.android.com/reference/androidx/media3/common/ForwardingPlayer#getShuffleModeEnabled()()` Calls `https://developer.android.com/reference/androidx/media3/common/Player#getShuffleModeEnabled()` on the delegate and returns the result. | | `https://developer.android.com/reference/androidx/media3/common/util/Size` | `https://developer.android.com/reference/androidx/media3/common/ForwardingPlayer#getSurfaceSize()()` Calls `https://developer.android.com/reference/androidx/media3/common/Player#getSurfaceSize()` on the delegate and returns the result. | | `long` | `https://developer.android.com/reference/androidx/media3/common/ForwardingPlayer#getTotalBufferedDuration()()` Calls `https://developer.android.com/reference/androidx/media3/common/Player#getTotalBufferedDuration()` on the delegate and returns the result. | | `https://developer.android.com/reference/androidx/media3/common/TrackSelectionParameters` | `https://developer.android.com/reference/androidx/media3/common/ForwardingPlayer#getTrackSelectionParameters()()` Calls `https://developer.android.com/reference/androidx/media3/common/Player#getTrackSelectionParameters()` on the delegate and returns the result. | | `https://developer.android.com/reference/androidx/media3/common/VideoSize` | `https://developer.android.com/reference/androidx/media3/common/ForwardingPlayer#getVideoSize()()` Calls `https://developer.android.com/reference/androidx/media3/common/Player#getVideoSize()` on the delegate and returns the result. | | `float` | `https://developer.android.com/reference/androidx/media3/common/ForwardingPlayer#getVolume()()` Calls `https://developer.android.com/reference/androidx/media3/common/Player#getVolume()` on the delegate and returns the result. | | `https://developer.android.com/reference/androidx/media3/common/Player` | `https://developer.android.com/reference/androidx/media3/common/ForwardingPlayer#getWrappedPlayer()()` Returns the `https://developer.android.com/reference/androidx/media3/common/Player` to which operations are forwarded. | | `boolean` | `https://developer.android.com/reference/androidx/media3/common/ForwardingPlayer#hasNextMediaItem()()` Calls `https://developer.android.com/reference/androidx/media3/common/Player#hasNextMediaItem()` on the delegate and returns the result. | | `boolean` | `https://developer.android.com/reference/androidx/media3/common/ForwardingPlayer#hasPreviousMediaItem()()` Calls `https://developer.android.com/reference/androidx/media3/common/Player#hasPreviousMediaItem()` on the delegate and returns the result. | | `void` | `[increaseDeviceVolume](https://developer.android.com/reference/androidx/media3/common/ForwardingPlayer#increaseDeviceVolume())()` **This method is deprecated.** Use `https://developer.android.com/reference/androidx/media3/common/ForwardingPlayer#increaseDeviceVolume(int)` instead. <br /> | | `void` | `https://developer.android.com/reference/androidx/media3/common/ForwardingPlayer#increaseDeviceVolume(int)(@https://developer.android.com/reference/androidx/media3/common/C.VolumeFlags int flags)` Calls `https://developer.android.com/reference/androidx/media3/common/Player#increaseDeviceVolume(int)` on the delegate. | | `boolean` | `https://developer.android.com/reference/androidx/media3/common/ForwardingPlayer#isCommandAvailable(int)(@https://developer.android.com/reference/androidx/media3/common/Player.Command int command)` Calls `https://developer.android.com/reference/androidx/media3/common/Player#isCommandAvailable(int)` on the delegate and returns the result. | | `boolean` | `https://developer.android.com/reference/androidx/media3/common/ForwardingPlayer#isCurrentMediaItemDynamic()()` Calls `https://developer.android.com/reference/androidx/media3/common/Player#isCurrentMediaItemDynamic()` on the delegate and returns the result. | | `boolean` | `https://developer.android.com/reference/androidx/media3/common/ForwardingPlayer#isCurrentMediaItemLive()()` Calls `https://developer.android.com/reference/androidx/media3/common/Player#isCurrentMediaItemLive()` on the delegate and returns the result. | | `boolean` | `https://developer.android.com/reference/androidx/media3/common/ForwardingPlayer#isCurrentMediaItemSeekable()()` Calls `https://developer.android.com/reference/androidx/media3/common/Player#isCurrentMediaItemSeekable()` on the delegate and returns the result. | | `boolean` | `[isCurrentWindowDynamic](https://developer.android.com/reference/androidx/media3/common/ForwardingPlayer#isCurrentWindowDynamic())()` **This method is deprecated.** Use `https://developer.android.com/reference/androidx/media3/common/ForwardingPlayer#isCurrentMediaItemDynamic()` instead. <br /> | | `boolean` | `[isCurrentWindowLive](https://developer.android.com/reference/androidx/media3/common/ForwardingPlayer#isCurrentWindowLive())()` **This method is deprecated.** Use `https://developer.android.com/reference/androidx/media3/common/ForwardingPlayer#isCurrentMediaItemLive()` instead. <br /> | | `boolean` | `[isCurrentWindowSeekable](https://developer.android.com/reference/androidx/media3/common/ForwardingPlayer#isCurrentWindowSeekable())()` **This method is deprecated.** Use `https://developer.android.com/reference/androidx/media3/common/ForwardingPlayer#isCurrentMediaItemSeekable()` instead. <br /> | | `boolean` | `https://developer.android.com/reference/androidx/media3/common/ForwardingPlayer#isDeviceMuted()()` Calls `https://developer.android.com/reference/androidx/media3/common/Player#isDeviceMuted()` on the delegate and returns the result. | | `boolean` | `https://developer.android.com/reference/androidx/media3/common/ForwardingPlayer#isLoading()()` Calls `https://developer.android.com/reference/androidx/media3/common/Player#isLoading()` on the delegate and returns the result. | | `boolean` | `https://developer.android.com/reference/androidx/media3/common/ForwardingPlayer#isPlaying()()` Calls `https://developer.android.com/reference/androidx/media3/common/Player#isPlaying()` on the delegate and returns the result. | | `boolean` | `https://developer.android.com/reference/androidx/media3/common/ForwardingPlayer#isPlayingAd()()` Calls `https://developer.android.com/reference/androidx/media3/common/Player#isPlayingAd()` on the delegate and returns the result. | | `void` | `https://developer.android.com/reference/androidx/media3/common/ForwardingPlayer#moveMediaItem(int,int)(int currentIndex, int newIndex)` Calls `https://developer.android.com/reference/androidx/media3/common/Player#moveMediaItem(int,int)` on the delegate. | | `void` | `https://developer.android.com/reference/androidx/media3/common/ForwardingPlayer#moveMediaItems(int,int,int)(int fromIndex, int toIndex, int newIndex)` Calls `https://developer.android.com/reference/androidx/media3/common/Player#moveMediaItems(int,int,int)` on the delegate. | | `void` | `https://developer.android.com/reference/androidx/media3/common/ForwardingPlayer#mute()()` Calls `https://developer.android.com/reference/androidx/media3/common/Player#mute()` on the delegate. | | `void` | `https://developer.android.com/reference/androidx/media3/common/ForwardingPlayer#pause()()` Calls `https://developer.android.com/reference/androidx/media3/common/Player#pause()` on the delegate. | | `void` | `https://developer.android.com/reference/androidx/media3/common/ForwardingPlayer#play()()` Calls `https://developer.android.com/reference/androidx/media3/common/Player#play()` on the delegate. | | `void` | `https://developer.android.com/reference/androidx/media3/common/ForwardingPlayer#prepare()()` Calls `https://developer.android.com/reference/androidx/media3/common/Player#prepare()` on the delegate. | | `void` | `https://developer.android.com/reference/androidx/media3/common/ForwardingPlayer#release()()` Calls `https://developer.android.com/reference/androidx/media3/common/Player#release()` on the delegate. | | `void` | `https://developer.android.com/reference/androidx/media3/common/ForwardingPlayer#removeListener(androidx.media3.common.Player.Listener)(https://developer.android.com/reference/androidx/media3/common/Player.Listener listener)` Calls `https://developer.android.com/reference/androidx/media3/common/Player#removeListener(androidx.media3.common.Player.Listener)` on the delegate. | | `void` | `https://developer.android.com/reference/androidx/media3/common/ForwardingPlayer#removeMediaItem(int)(int index)` Calls `https://developer.android.com/reference/androidx/media3/common/Player#removeMediaItem(int)` on the delegate. | | `void` | `https://developer.android.com/reference/androidx/media3/common/ForwardingPlayer#removeMediaItems(int,int)(int fromIndex, int toIndex)` Calls `https://developer.android.com/reference/androidx/media3/common/Player#removeMediaItems(int,int)` on the delegate. | | `void` | `https://developer.android.com/reference/androidx/media3/common/ForwardingPlayer#replaceMediaItem(int,androidx.media3.common.MediaItem)(int index, https://developer.android.com/reference/androidx/media3/common/MediaItem mediaItem)` Calls `https://developer.android.com/reference/androidx/media3/common/Player#replaceMediaItem(int,androidx.media3.common.MediaItem)` on the delegate. | | `void` | `https://developer.android.com/reference/androidx/media3/common/ForwardingPlayer#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 )` Calls `https://developer.android.com/reference/androidx/media3/common/Player#replaceMediaItems(int,int,java.util.List<androidx.media3.common.MediaItem>)` on the delegate. | | `void` | `https://developer.android.com/reference/androidx/media3/common/ForwardingPlayer#seekBack()()` Calls `https://developer.android.com/reference/androidx/media3/common/Player#seekBack()` on the delegate. | | `void` | `https://developer.android.com/reference/androidx/media3/common/ForwardingPlayer#seekForward()()` Calls `https://developer.android.com/reference/androidx/media3/common/Player#seekForward()` on the delegate. | | `void` | `https://developer.android.com/reference/androidx/media3/common/ForwardingPlayer#seekTo(long)(long positionMs)` Calls `https://developer.android.com/reference/androidx/media3/common/Player#seekTo(long)` on the delegate. | | `void` | `https://developer.android.com/reference/androidx/media3/common/ForwardingPlayer#seekTo(int,long)(int mediaItemIndex, long positionMs)` Calls `https://developer.android.com/reference/androidx/media3/common/Player#seekTo(int,long)` on the delegate. | | `void` | `https://developer.android.com/reference/androidx/media3/common/ForwardingPlayer#seekToDefaultPosition()()` Calls `https://developer.android.com/reference/androidx/media3/common/Player#seekToDefaultPosition()` on the delegate. | | `void` | `https://developer.android.com/reference/androidx/media3/common/ForwardingPlayer#seekToDefaultPosition(int)(int mediaItemIndex)` Calls `https://developer.android.com/reference/androidx/media3/common/Player#seekToDefaultPosition(int)` on the delegate. | | `void` | `https://developer.android.com/reference/androidx/media3/common/ForwardingPlayer#seekToNext()()` Calls `https://developer.android.com/reference/androidx/media3/common/Player#seekToNext()` on the delegate. | | `void` | `https://developer.android.com/reference/androidx/media3/common/ForwardingPlayer#seekToNextMediaItem()()` Calls `https://developer.android.com/reference/androidx/media3/common/Player#seekToNextMediaItem()` on the delegate. | | `void` | `https://developer.android.com/reference/androidx/media3/common/ForwardingPlayer#seekToPrevious()()` Calls `https://developer.android.com/reference/androidx/media3/common/Player#seekToPrevious()` on the delegate. | | `void` | `https://developer.android.com/reference/androidx/media3/common/ForwardingPlayer#seekToPreviousMediaItem()()` Calls `https://developer.android.com/reference/androidx/media3/common/Player#seekToPreviousMediaItem()` on the delegate. | | `void` | `https://developer.android.com/reference/androidx/media3/common/ForwardingPlayer#setAudioAttributes(androidx.media3.common.AudioAttributes,boolean)( https://developer.android.com/reference/androidx/media3/common/AudioAttributes audioAttributes, boolean handleAudioFocus )` Calls `https://developer.android.com/reference/androidx/media3/common/Player#setAudioAttributes(androidx.media3.common.AudioAttributes,boolean)` on the delegate. | | `void` | `[setDeviceMuted](https://developer.android.com/reference/androidx/media3/common/ForwardingPlayer#setDeviceMuted(boolean))(boolean muted)` **This method is deprecated.** Use `https://developer.android.com/reference/androidx/media3/common/ForwardingPlayer#setDeviceMuted(boolean,int)` instead. <br /> | | `void` | `https://developer.android.com/reference/androidx/media3/common/ForwardingPlayer#setDeviceMuted(boolean,int)(boolean muted, @https://developer.android.com/reference/androidx/media3/common/C.VolumeFlags int flags)` Calls `https://developer.android.com/reference/androidx/media3/common/Player#setDeviceMuted(boolean,int)` on the delegate. | | `void` | `[setDeviceVolume](https://developer.android.com/reference/androidx/media3/common/ForwardingPlayer#setDeviceVolume(int))(int volume)` **This method is deprecated.** Use `https://developer.android.com/reference/androidx/media3/common/ForwardingPlayer#setDeviceVolume(int,int)` instead. <br /> | | `void` | `https://developer.android.com/reference/androidx/media3/common/ForwardingPlayer#setDeviceVolume(int,int)(int volume, @https://developer.android.com/reference/androidx/media3/common/C.VolumeFlags int flags)` Calls `https://developer.android.com/reference/androidx/media3/common/Player#setDeviceVolume(int,int)` on the delegate. | | `void` | `https://developer.android.com/reference/androidx/media3/common/ForwardingPlayer#setMediaItem(androidx.media3.common.MediaItem)(https://developer.android.com/reference/androidx/media3/common/MediaItem mediaItem)` Calls `https://developer.android.com/reference/androidx/media3/common/Player#setMediaItem(androidx.media3.common.MediaItem)` on the delegate. | | `void` | `https://developer.android.com/reference/androidx/media3/common/ForwardingPlayer#setMediaItem(androidx.media3.common.MediaItem,boolean)(https://developer.android.com/reference/androidx/media3/common/MediaItem mediaItem, boolean resetPosition)` Calls `https://developer.android.com/reference/androidx/media3/common/Player#setMediaItem(androidx.media3.common.MediaItem,boolean)` on the delegate. | | `void` | `https://developer.android.com/reference/androidx/media3/common/ForwardingPlayer#setMediaItem(androidx.media3.common.MediaItem,long)(https://developer.android.com/reference/androidx/media3/common/MediaItem mediaItem, long startPositionMs)` Calls `https://developer.android.com/reference/androidx/media3/common/Player#setMediaItem(androidx.media3.common.MediaItem,long)` on the delegate. | | `void` | `https://developer.android.com/reference/androidx/media3/common/ForwardingPlayer#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)` Calls `https://developer.android.com/reference/androidx/media3/common/Player#setMediaItems(java.util.List<androidx.media3.common.MediaItem>)` on the delegate. | | `void` | `https://developer.android.com/reference/androidx/media3/common/ForwardingPlayer#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)` Calls `https://developer.android.com/reference/androidx/media3/common/Player#setMediaItems(java.util.List<androidx.media3.common.MediaItem>,boolean)` ()} on the delegate. | | `void` | `https://developer.android.com/reference/androidx/media3/common/ForwardingPlayer#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 )` Calls `https://developer.android.com/reference/androidx/media3/common/Player#setMediaItems(java.util.List<androidx.media3.common.MediaItem>,int,long)` on the delegate. | | `void` | `https://developer.android.com/reference/androidx/media3/common/ForwardingPlayer#setPlayWhenReady(boolean)(boolean playWhenReady)` Calls `https://developer.android.com/reference/androidx/media3/common/Player#setPlayWhenReady(boolean)` on the delegate. | | `void` | `https://developer.android.com/reference/androidx/media3/common/ForwardingPlayer#setPlaybackParameters(androidx.media3.common.PlaybackParameters)(https://developer.android.com/reference/androidx/media3/common/PlaybackParameters playbackParameters)` Calls `https://developer.android.com/reference/androidx/media3/common/Player#setPlaybackParameters(androidx.media3.common.PlaybackParameters)` on the delegate. | | `void` | `https://developer.android.com/reference/androidx/media3/common/ForwardingPlayer#setPlaybackSpeed(float)(float speed)` Calls `https://developer.android.com/reference/androidx/media3/common/Player#setPlaybackSpeed(float)` on the delegate. | | `void` | `https://developer.android.com/reference/androidx/media3/common/ForwardingPlayer#setPlaylistMetadata(androidx.media3.common.MediaMetadata)(https://developer.android.com/reference/androidx/media3/common/MediaMetadata mediaMetadata)` Calls `https://developer.android.com/reference/androidx/media3/common/Player#setPlaylistMetadata(androidx.media3.common.MediaMetadata)` on the delegate. | | `void` | `https://developer.android.com/reference/androidx/media3/common/ForwardingPlayer#setRepeatMode(int)(@https://developer.android.com/reference/androidx/media3/common/Player.RepeatMode int repeatMode)` Calls `https://developer.android.com/reference/androidx/media3/common/Player#setRepeatMode(int)` on the delegate. | | `void` | `https://developer.android.com/reference/androidx/media3/common/ForwardingPlayer#setShuffleModeEnabled(boolean)(boolean shuffleModeEnabled)` Calls `https://developer.android.com/reference/androidx/media3/common/Player#setShuffleModeEnabled(boolean)` on the delegate. | | `void` | `https://developer.android.com/reference/androidx/media3/common/ForwardingPlayer#setTrackSelectionParameters(androidx.media3.common.TrackSelectionParameters)(https://developer.android.com/reference/androidx/media3/common/TrackSelectionParameters parameters)` Calls `https://developer.android.com/reference/androidx/media3/common/Player#setTrackSelectionParameters(androidx.media3.common.TrackSelectionParameters)` on the delegate. | | `void` | `https://developer.android.com/reference/androidx/media3/common/ForwardingPlayer#setVideoSurface(android.view.Surface)(@https://developer.android.com/reference/androidx/annotation/Nullable https://developer.android.com/reference/android/view/Surface.html surface)` Calls `https://developer.android.com/reference/androidx/media3/common/Player#setVideoSurface(android.view.Surface)` on the delegate. | | `void` | `https://developer.android.com/reference/androidx/media3/common/ForwardingPlayer#setVideoSurfaceHolder(android.view.SurfaceHolder)(@https://developer.android.com/reference/androidx/annotation/Nullable https://developer.android.com/reference/android/view/SurfaceHolder.html surfaceHolder)` Calls `https://developer.android.com/reference/androidx/media3/common/Player#setVideoSurfaceHolder(android.view.SurfaceHolder)` on the delegate. | | `void` | `https://developer.android.com/reference/androidx/media3/common/ForwardingPlayer#setVideoSurfaceView(android.view.SurfaceView)(@https://developer.android.com/reference/androidx/annotation/Nullable https://developer.android.com/reference/android/view/SurfaceView.html surfaceView)` Calls `https://developer.android.com/reference/androidx/media3/common/Player#setVideoSurfaceView(android.view.SurfaceView)` on the delegate. | | `void` | `https://developer.android.com/reference/androidx/media3/common/ForwardingPlayer#setVideoTextureView(android.view.TextureView)(@https://developer.android.com/reference/androidx/annotation/Nullable https://developer.android.com/reference/android/view/TextureView.html textureView)` Calls `https://developer.android.com/reference/androidx/media3/common/Player#setVideoTextureView(android.view.TextureView)` on the delegate. | | `void` | `https://developer.android.com/reference/androidx/media3/common/ForwardingPlayer#setVolume(float)(float volume)` Calls `https://developer.android.com/reference/androidx/media3/common/Player#setVolume(float)` on the delegate. | | `void` | `https://developer.android.com/reference/androidx/media3/common/ForwardingPlayer#stop()()` Calls `https://developer.android.com/reference/androidx/media3/common/Player#stop()` on the delegate. | | `void` | `https://developer.android.com/reference/androidx/media3/common/ForwardingPlayer#unmute()()` Calls `https://developer.android.com/reference/androidx/media3/common/Player#unmute()` on the delegate. | |
| From [androidx.media3.common.Player](https://developer.android.com/reference/androidx/media3/common/Player) |---|---| | `abstract void` | `[setDeviceVolume](https://developer.android.com/reference/androidx/media3/common/Player#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/common/Player#setDeviceVolume(int,int)` instead. <br /> | | `abstract void` | `https://developer.android.com/reference/androidx/media3/common/Player#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. | | `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#setVolume(float)(@https://developer.android.com/reference/androidx/annotation/FloatRange(from = 0, to = 1.0) float volume)` Sets the audio volume, valid values are between 0 (silence) and 1 (unity gain, signal unchanged), inclusive. | |

## Constants

### DEVICE_INFO_REMOTE_EMPTY

```
public static final DeviceInfo DEVICE_INFO_REMOTE_EMPTY
```

Same as `https://developer.android.com/reference/androidx/media3/cast/RemoteCastPlayer#DEVICE_INFO_REMOTE_EMPTY()`.

## Public constructors

### CastPlayer

```
public [CastPlayer](https://developer.android.com/reference/androidx/media3/cast/CastPlayer#CastPlayer(com.google.android.gms.cast.framework.CastContext))(CastContext castContext)
```

> [!CAUTION]
> **This method is deprecated.**   
>
> Use `https://developer.android.com/reference/androidx/media3/cast/RemoteCastPlayer.Builder` to create a `https://developer.android.com/reference/androidx/media3/common/Player` for playback exclusively on Cast receivers, or `https://developer.android.com/reference/androidx/media3/cast/CastPlayer.Builder` for a `https://developer.android.com/reference/androidx/media3/common/Player` that works both on Cast receivers and locally.

Creates a new cast player.

The returned player uses a `https://developer.android.com/reference/androidx/media3/cast/DefaultMediaItemConverter` and

`mediaItemConverter` is set to a `https://developer.android.com/reference/androidx/media3/cast/DefaultMediaItemConverter`, `
seekBackIncrementMs` is set to `https://developer.android.com/reference/androidx/media3/common/C#DEFAULT_SEEK_BACK_INCREMENT_MS()` and `
seekForwardIncrementMs` is set to `https://developer.android.com/reference/androidx/media3/common/C#DEFAULT_SEEK_FORWARD_INCREMENT_MS()`.

| Parameters |
|---|---|
| `https://developers.google.com/android/reference/com/google/android/gms/cast/framework/CastContext.html castContext` | The context from which the cast session is obtained. |

### CastPlayer

```
public [CastPlayer](https://developer.android.com/reference/androidx/media3/cast/CastPlayer#CastPlayer(com.google.android.gms.cast.framework.CastContext,androidx.media3.cast.MediaItemConverter))(
    CastContext castContext,
    MediaItemConverter mediaItemConverter
)
```

> [!CAUTION]
> **This method is deprecated.**   
>
> Use `https://developer.android.com/reference/androidx/media3/cast/RemoteCastPlayer.Builder` to create a `https://developer.android.com/reference/androidx/media3/common/Player` for playback exclusively on Cast receivers, or `https://developer.android.com/reference/androidx/media3/cast/CastPlayer.Builder` for a `https://developer.android.com/reference/androidx/media3/common/Player` that works both on Cast receivers and locally.

Creates a new cast player.

`seekBackIncrementMs` is set to `https://developer.android.com/reference/androidx/media3/common/C#DEFAULT_SEEK_BACK_INCREMENT_MS()` and `
seekForwardIncrementMs` is set to `https://developer.android.com/reference/androidx/media3/common/C#DEFAULT_SEEK_FORWARD_INCREMENT_MS()`.

| Parameters |
|---|---|
| `https://developers.google.com/android/reference/com/google/android/gms/cast/framework/CastContext.html castContext` | The context from which the cast session is obtained. |
| `https://developer.android.com/reference/androidx/media3/cast/MediaItemConverter mediaItemConverter` | The `https://developer.android.com/reference/androidx/media3/cast/MediaItemConverter` to use. |

### CastPlayer

```
public [CastPlayer](https://developer.android.com/reference/androidx/media3/cast/CastPlayer#CastPlayer(com.google.android.gms.cast.framework.CastContext,androidx.media3.cast.MediaItemConverter,long,long))(
    CastContext castContext,
    MediaItemConverter mediaItemConverter,
    @IntRange(from = 1) long seekBackIncrementMs,
    @IntRange(from = 1) long seekForwardIncrementMs
)
```

> [!CAUTION]
> **This method is deprecated.**   
>
> Use `https://developer.android.com/reference/androidx/media3/cast/RemoteCastPlayer.Builder` to create a `https://developer.android.com/reference/androidx/media3/common/Player` for playback exclusively on Cast receivers, or `https://developer.android.com/reference/androidx/media3/cast/CastPlayer.Builder` for a `https://developer.android.com/reference/androidx/media3/common/Player` that works both on Cast receivers and locally.

Creates a new cast player.

| Parameters |
|---|---|
| `https://developers.google.com/android/reference/com/google/android/gms/cast/framework/CastContext.html castContext` | The context from which the cast session is obtained. |
| `https://developer.android.com/reference/androidx/media3/cast/MediaItemConverter mediaItemConverter` | The `https://developer.android.com/reference/androidx/media3/cast/MediaItemConverter` to use. |
| `@https://developer.android.com/reference/androidx/annotation/IntRange(from = 1) long seekBackIncrementMs` | The `https://developer.android.com/reference/androidx/media3/common/ForwardingPlayer#seekBack()` increment, in milliseconds. |
| `@https://developer.android.com/reference/androidx/annotation/IntRange(from = 1) long seekForwardIncrementMs` | The `https://developer.android.com/reference/androidx/media3/common/ForwardingPlayer#seekForward()` increment, in milliseconds. |

| Throws |
|---|---|
| `https://developer.android.com/reference/java/lang/IllegalArgumentException.html` | If `seekBackIncrementMs` or ` seekForwardIncrementMs` is non-positive. |

### CastPlayer

```
public [CastPlayer](https://developer.android.com/reference/androidx/media3/cast/CastPlayer#CastPlayer(android.content.Context,com.google.android.gms.cast.framework.CastContext,androidx.media3.cast.MediaItemConverter,long,long,long))(
    @Nullable Context context,
    CastContext castContext,
    MediaItemConverter mediaItemConverter,
    @IntRange(from = 1) long seekBackIncrementMs,
    @IntRange(from = 1) long seekForwardIncrementMs,
    @IntRange(from = 0) long maxSeekToPreviousPositionMs
)
```

> [!CAUTION]
> **This method is deprecated.**   
>
> Use `https://developer.android.com/reference/androidx/media3/cast/RemoteCastPlayer.Builder` to create a `https://developer.android.com/reference/androidx/media3/common/Player` for playback exclusively on Cast receivers, or `https://developer.android.com/reference/androidx/media3/cast/CastPlayer.Builder` for a `https://developer.android.com/reference/androidx/media3/common/Player` that works both on Cast receivers and locally.

Creates a new cast player.

| Parameters |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/Nullable https://developer.android.com/reference/android/content/Context.html context` | A `https://developer.android.com/reference/android/content/Context.html` used to populate `https://developer.android.com/reference/androidx/media3/common/ForwardingPlayer#getDeviceInfo()`. If null, `https://developer.android.com/reference/androidx/media3/common/ForwardingPlayer#getDeviceInfo()` will always return `https://developer.android.com/reference/androidx/media3/cast/CastPlayer#DEVICE_INFO_REMOTE_EMPTY()`. |
| `https://developers.google.com/android/reference/com/google/android/gms/cast/framework/CastContext.html castContext` | The context from which the cast session is obtained. |
| `https://developer.android.com/reference/androidx/media3/cast/MediaItemConverter mediaItemConverter` | The `https://developer.android.com/reference/androidx/media3/cast/MediaItemConverter` to use. |
| `@https://developer.android.com/reference/androidx/annotation/IntRange(from = 1) long seekBackIncrementMs` | The `https://developer.android.com/reference/androidx/media3/common/ForwardingPlayer#seekBack()` increment, in milliseconds. |
| `@https://developer.android.com/reference/androidx/annotation/IntRange(from = 1) long seekForwardIncrementMs` | The `https://developer.android.com/reference/androidx/media3/common/ForwardingPlayer#seekForward()` increment, in milliseconds. |
| `@https://developer.android.com/reference/androidx/annotation/IntRange(from = 0) long maxSeekToPreviousPositionMs` | The maximum position for which `https://developer.android.com/reference/androidx/media3/common/ForwardingPlayer#seekToPrevious()` seeks to the previous `https://developer.android.com/reference/androidx/media3/common/MediaItem`, in milliseconds. |

| Throws |
|---|---|
| `https://developer.android.com/reference/java/lang/IllegalArgumentException.html` | If `seekBackIncrementMs` or ` seekForwardIncrementMs` is non-positive, or if `maxSeekToPreviousPositionMs` is negative. |

## Public methods

### isCastSessionAvailable

```
public boolean [isCastSessionAvailable](https://developer.android.com/reference/androidx/media3/cast/CastPlayer#isCastSessionAvailable())()
```

> [!CAUTION]
> **This method is deprecated.**   
>
> Use `https://developer.android.com/reference/androidx/media3/common/ForwardingPlayer#getDeviceInfo()` instead, and check for `https://developer.android.com/reference/androidx/media3/common/DeviceInfo#PLAYBACK_TYPE_REMOTE()`.

Returns whether a cast session is available.

### setSessionAvailabilityListener

```
public void [setSessionAvailabilityListener](https://developer.android.com/reference/androidx/media3/cast/CastPlayer#setSessionAvailabilityListener(androidx.media3.cast.SessionAvailabilityListener))(
    @Nullable SessionAvailabilityListener listener
)
```

> [!CAUTION]
> **This method is deprecated.**   
>
> Use `https://developer.android.com/reference/androidx/media3/common/Player.Listener#onDeviceInfoChanged(androidx.media3.common.DeviceInfo)` instead, and check for `https://developer.android.com/reference/androidx/media3/common/DeviceInfo#PLAYBACK_TYPE_REMOTE()`.

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. |