# Player

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

*** ** * ** ***

<br />

```
public interface Player
```

<br />

Known direct subclasses [BasePlayer](https://developer.android.com/reference/androidx/media3/common/BasePlayer), [ExoPlayer](https://developer.android.com/reference/androidx/media3/exoplayer/ExoPlayer), [ForwardingPlayer](https://developer.android.com/reference/androidx/media3/common/ForwardingPlayer), [MediaController](https://developer.android.com/reference/androidx/media3/session/MediaController)

|---|---|
| `https://developer.android.com/reference/androidx/media3/common/BasePlayer` | Abstract base `https://developer.android.com/reference/androidx/media3/common/Player` which implements common implementation independent methods. |
| `https://developer.android.com/reference/androidx/media3/exoplayer/ExoPlayer` | An extensible media player that plays `https://developer.android.com/reference/androidx/media3/exoplayer/source/MediaSource`s. |
| `https://developer.android.com/reference/androidx/media3/common/ForwardingPlayer` | A `https://developer.android.com/reference/androidx/media3/common/Player` that forwards method calls to another `https://developer.android.com/reference/androidx/media3/common/Player`. |
| `https://developer.android.com/reference/androidx/media3/session/MediaController` | A controller that interacts with a `https://developer.android.com/reference/androidx/media3/session/MediaSession`, a `https://developer.android.com/reference/androidx/media3/session/MediaSessionService` hosting a `https://developer.android.com/reference/androidx/media3/session/MediaSession`, or a `https://developer.android.com/reference/androidx/media3/session/MediaLibraryService` hosting a `https://developer.android.com/reference/androidx/media3/session/MediaLibraryService.MediaLibrarySession`. |

Known indirect subclasses [CastPlayer](https://developer.android.com/reference/androidx/media3/cast/CastPlayer), [CompositionPlayer](https://developer.android.com/reference/androidx/media3/transformer/CompositionPlayer), [FakePlayer](https://developer.android.com/reference/androidx/media3/test/utils/FakePlayer), [ForwardingSimpleBasePlayer](https://developer.android.com/reference/androidx/media3/common/ForwardingSimpleBasePlayer), [MediaBrowser](https://developer.android.com/reference/androidx/media3/session/MediaBrowser), [RemoteCastPlayer](https://developer.android.com/reference/androidx/media3/cast/RemoteCastPlayer), [SimpleBasePlayer](https://developer.android.com/reference/androidx/media3/common/SimpleBasePlayer), [SimpleExoPlayer](https://developer.android.com/reference/androidx/media3/exoplayer/SimpleExoPlayer), [StubExoPlayer](https://developer.android.com/reference/androidx/media3/test/utils/StubExoPlayer), [StubPlayer](https://developer.android.com/reference/androidx/media3/test/utils/StubPlayer)

|---|---|
| `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. |
| `https://developer.android.com/reference/androidx/media3/transformer/CompositionPlayer` | A `https://developer.android.com/reference/androidx/media3/common/Player` implementation that plays `https://developer.android.com/reference/androidx/media3/transformer/Composition` of media assets. |
| `https://developer.android.com/reference/androidx/media3/test/utils/FakePlayer` | A fake `https://developer.android.com/reference/androidx/media3/common/Player` that uses `https://developer.android.com/reference/androidx/media3/common/SimpleBasePlayer`'s minimal number of default methods implementations to build upon to simulate realistic playback scenarios for testing. |
| `https://developer.android.com/reference/androidx/media3/common/ForwardingSimpleBasePlayer` | A `https://developer.android.com/reference/androidx/media3/common/SimpleBasePlayer` that forwards all calls to another `https://developer.android.com/reference/androidx/media3/common/Player` instance. |
| `https://developer.android.com/reference/androidx/media3/session/MediaBrowser` | Browses media content offered by a `https://developer.android.com/reference/androidx/media3/session/MediaLibraryService` in addition to the `https://developer.android.com/reference/androidx/media3/session/MediaController` functions. |
| `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. |
| `https://developer.android.com/reference/androidx/media3/common/SimpleBasePlayer` | A base implementation for `https://developer.android.com/reference/androidx/media3/common/Player` that reduces the number of methods to implement to a minimum. |
| `https://developer.android.com/reference/androidx/media3/exoplayer/SimpleExoPlayer` | **This class is deprecated.** Use `https://developer.android.com/reference/androidx/media3/exoplayer/ExoPlayer` instead. <br /> |
| `https://developer.android.com/reference/androidx/media3/test/utils/StubExoPlayer` | An abstract `https://developer.android.com/reference/androidx/media3/exoplayer/ExoPlayer` implementation that throws `https://developer.android.com/reference/java/lang/UnsupportedOperationException.html` from every method. |
| `https://developer.android.com/reference/androidx/media3/test/utils/StubPlayer` | An abstract `https://developer.android.com/reference/androidx/media3/common/Player` implementation that throws `https://developer.android.com/reference/java/lang/UnsupportedOperationException.html` from every method. |

*** ** * ** ***

A media player interface defining high-level functionality, such as the ability to play, pause, seek and query properties of the currently playing media.

## Player features and usage

Some important properties of media players that implement this interface are:

- All methods must be called from a single `https://developer.android.com/reference/androidx/media3/common/Player#getApplicationLooper()` unless indicated otherwise. Callbacks in registered listeners are called on the same thread.
- The available functionality can be limited. Player instances provide a set of `https://developer.android.com/reference/androidx/media3/common/Player#getAvailableCommands()` to signal feature support and users of the interface must only call methods if the corresponding `https://developer.android.com/reference/androidx/media3/common/Player.Command` is available. An implementation has some flexibility in how to handle a call to a method when the corresponding command is not available. Options include (non-exhaustive):
  - Do nothing (for a void method), or return an 'unset' or 'default' value.
  - Throw an exception.
  - Perform the requested operation anyway.
  - Perform some 'default' version of the requested operation (e.g. `https://developer.android.com/reference/androidx/media3/common/Player#seekTo(long)` may trigger `https://developer.android.com/reference/androidx/media3/common/Player#seekToDefaultPosition()` if called when `https://developer.android.com/reference/androidx/media3/common/Player#COMMAND_SEEK_IN_CURRENT_MEDIA_ITEM()` is not available).
- Users can register `https://developer.android.com/reference/androidx/media3/common/Player.Listener` callbacks that get informed about state changes.
- Player instances need to update the visible state immediately after each method call, even if the actual changes are handled on background threads or even other devices. This simplifies the usage for callers of methods as no asynchronous handling needs to be considered.
- Player instances can provide playlist operations, like 'set', 'add', 'remove', 'move' or 'replace' of `https://developer.android.com/reference/androidx/media3/common/MediaItem` instances. The player can also support `https://developer.android.com/reference/androidx/media3/common/Player.RepeatMode` and shuffling within this playlist. The player provides a `https://developer.android.com/reference/androidx/media3/common/Timeline` representing the structure of the playlist and all its items, which can be obtained by calling `https://developer.android.com/reference/androidx/media3/common/Player#getCurrentTimeline()`
- Player instances can provide seeking within the currently playing item and to other items, using the various `seek...` methods.
- Player instances can provide `https://developer.android.com/reference/androidx/media3/common/Tracks` defining the currently available and selected tracks, which can be obtained by calling `https://developer.android.com/reference/androidx/media3/common/Player#getCurrentTracks()`. Users can also modify track selection behavior by setting `https://developer.android.com/reference/androidx/media3/common/TrackSelectionParameters` with `https://developer.android.com/reference/androidx/media3/common/Player#setTrackSelectionParameters(androidx.media3.common.TrackSelectionParameters)`.
- Player instances can provide `https://developer.android.com/reference/androidx/media3/common/MediaMetadata` about the currently playing item, which can be obtained by calling `https://developer.android.com/reference/androidx/media3/common/Player#getMediaMetadata()`.
- Player instances can provide information about ads in its media structure, for example via `https://developer.android.com/reference/androidx/media3/common/Player#isPlayingAd()`.
- Player instances can accept different types of video outputs, like `https://developer.android.com/reference/androidx/media3/common/Player#setVideoSurfaceView(android.view.SurfaceView)` or `https://developer.android.com/reference/androidx/media3/common/Player#setVideoTextureView(android.view.TextureView)` for video rendering.
- Player instances can handle `https://developer.android.com/reference/androidx/media3/common/Player#setPlaybackSpeed(float)`, `https://developer.android.com/reference/androidx/media3/common/Player#getAudioAttributes()`, and `https://developer.android.com/reference/androidx/media3/common/Player#setVolume(float)`.
- Player instances can provide information about the `https://developer.android.com/reference/androidx/media3/common/Player#getDeviceInfo()`, which may be remote, and allow to change the device's volume.

## API stability guarantees

The majority of the Player interface and its related classes are part of the stable API that guarantees backwards-compatibility for users of the API. Only more advances use cases may need to rely on `https://developer.android.com/reference/androidx/media3/common/util/UnstableApi` classes and methods that are subject to incompatible changes or even removal in a future release. Implementors of the Player interface are not covered by these API stability guarantees.

## Player state

Users can listen to state changes by adding a `https://developer.android.com/reference/androidx/media3/common/Player.Listener` with `https://developer.android.com/reference/androidx/media3/common/Player#addListener(androidx.media3.common.Player.Listener)`.

The main elements of the overall player state are:

- Playlist
  - `https://developer.android.com/reference/androidx/media3/common/MediaItem` instances can be added with methods like `https://developer.android.com/reference/androidx/media3/common/Player#setMediaItem(androidx.media3.common.MediaItem)` to define what the player will be playing.
  - The current playlist can be obtained via `https://developer.android.com/reference/androidx/media3/common/Player#getCurrentTimeline()` and convenience methods like `https://developer.android.com/reference/androidx/media3/common/Player#getMediaItemCount()` or `https://developer.android.com/reference/androidx/media3/common/Player#getCurrentMediaItem()`.
  - With an empty playlist, the player can only be in `https://developer.android.com/reference/androidx/media3/common/Player#STATE_IDLE()` or `https://developer.android.com/reference/androidx/media3/common/Player#STATE_ENDED()`.
- Playback state
  - `https://developer.android.com/reference/androidx/media3/common/Player#STATE_IDLE()`: This is the initial state, the state when the player is `https://developer.android.com/reference/androidx/media3/common/Player#stop()`, and when playback `https://developer.android.com/reference/androidx/media3/common/Player#getPlayerError()`. The player will hold only limited resources in this state. `https://developer.android.com/reference/androidx/media3/common/Player#prepare()` must be called to transition away from this state.
  - `https://developer.android.com/reference/androidx/media3/common/Player#STATE_BUFFERING()`: The player is not able to immediately play from its current position. This mostly happens because more data needs to be loaded.
  - `https://developer.android.com/reference/androidx/media3/common/Player#STATE_READY()`: The player is able to immediately play from its current position.
  - `https://developer.android.com/reference/androidx/media3/common/Player#STATE_ENDED()`: The player finished playing all media, or there is no media to play.
- Play/Pause, playback suppression and isPlaying
  - `https://developer.android.com/reference/androidx/media3/common/Player#getPlayWhenReady()`: Indicates the user intention to play. It can be set with `https://developer.android.com/reference/androidx/media3/common/Player#play()` or `https://developer.android.com/reference/androidx/media3/common/Player#pause()`.
  - `https://developer.android.com/reference/androidx/media3/common/Player#getPlaybackSuppressionReason()`: Defines a reason for which playback will be suppressed even if `https://developer.android.com/reference/androidx/media3/common/Player#getPlayWhenReady()` is `true`.
  - `https://developer.android.com/reference/androidx/media3/common/Player#isPlaying()`: Whether the player is playing (that is, its position is advancing and media is being presented). This will only be `true` if playback state is `https://developer.android.com/reference/androidx/media3/common/Player#STATE_READY()`, `https://developer.android.com/reference/androidx/media3/common/Player#getPlayWhenReady()` is `true`, and playback is not suppressed.
- Playback position
  - `https://developer.android.com/reference/androidx/media3/common/Player#getCurrentMediaItemIndex()`: The index in the playlist.
  - `https://developer.android.com/reference/androidx/media3/common/Player#isPlayingAd()`: Whether an inserted ad is playing and which `https://developer.android.com/reference/androidx/media3/common/Player#getCurrentAdGroupIndex()` and `https://developer.android.com/reference/androidx/media3/common/Player#getCurrentAdIndexInAdGroup()` it belongs to
  - `https://developer.android.com/reference/androidx/media3/common/Player#getCurrentPosition()`: The current position of the playback. This is the same as the `https://developer.android.com/reference/androidx/media3/common/Player#getContentPosition()` unless an ad is playing, where this indicates the position in the inserted ad.

Note that there are no callbacks for normal playback progression, only for `https://developer.android.com/reference/androidx/media3/common/Player.Listener#onMediaItemTransition(androidx.media3.common.MediaItem,int)` and other `https://developer.android.com/reference/androidx/media3/common/Player.Listener#onPositionDiscontinuity(int)`. Code that needs to monitor playback progress (for example, an UI progress bar) should query the current position in appropriate intervals.

## Implementing the Player interface

Implementing the Player interface is complex, as the interface includes many convenience methods that need to provide a consistent state and behavior, requires correct handling of listeners and available commands, and expects immediate state changes even if methods are internally handled asynchronously. For this reason, implementations are advised to inherit `https://developer.android.com/reference/androidx/media3/common/SimpleBasePlayer` that handles all of these complexities and provides a simpler integration point for implementors of the interface.

## Summary

| ### Nested types |
|---|
| `@https://developer.android.com/reference/java/lang/annotation/Documented.html @https://developer.android.com/reference/java/lang/annotation/Retention.html(value = https://developer.android.com/reference/java/lang/annotation/RetentionPolicy.html#SOURCE) @https://developer.android.com/reference/java/lang/annotation/Target.html(value = ) @https://developer.android.com/reference/androidx/annotation/IntDef(value = ) public annotation https://developer.android.com/reference/androidx/media3/common/Player.Command` Commands that indicate which method calls are currently permitted on a particular ` Player` instance. |
| `public final class https://developer.android.com/reference/androidx/media3/common/Player.Commands` A set of `https://developer.android.com/reference/androidx/media3/common/Player.Command`. |
| `@https://developer.android.com/reference/androidx/media3/common/util/UnstableApi public final class https://developer.android.com/reference/androidx/media3/common/Player.Commands.Builder` A builder for `https://developer.android.com/reference/androidx/media3/common/Player.Commands` instances. |
| `@https://developer.android.com/reference/java/lang/annotation/Documented.html @https://developer.android.com/reference/java/lang/annotation/Retention.html(value = https://developer.android.com/reference/java/lang/annotation/RetentionPolicy.html#SOURCE) @https://developer.android.com/reference/java/lang/annotation/Target.html(value = ) @https://developer.android.com/reference/androidx/annotation/IntDef(value = ) public annotation https://developer.android.com/reference/androidx/media3/common/Player.DiscontinuityReason` Reasons for position discontinuities. |
| `@https://developer.android.com/reference/java/lang/annotation/Documented.html @https://developer.android.com/reference/java/lang/annotation/Retention.html(value = https://developer.android.com/reference/java/lang/annotation/RetentionPolicy.html#SOURCE) @https://developer.android.com/reference/java/lang/annotation/Target.html(value = ) @https://developer.android.com/reference/androidx/annotation/IntDef(value = ) public annotation https://developer.android.com/reference/androidx/media3/common/Player.Event` Events that can be reported via `https://developer.android.com/reference/androidx/media3/common/Player.Listener#onEvents(androidx.media3.common.Player,androidx.media3.common.Player.Events)`. |
| `public final class https://developer.android.com/reference/androidx/media3/common/Player.Events` A set of `https://developer.android.com/reference/androidx/media3/common/Player.Event`. |
| `public interface https://developer.android.com/reference/androidx/media3/common/Player.Listener` Listener for changes in a `https://developer.android.com/reference/androidx/media3/common/Player`. |
| `@https://developer.android.com/reference/java/lang/annotation/Documented.html @https://developer.android.com/reference/java/lang/annotation/Retention.html(value = https://developer.android.com/reference/java/lang/annotation/RetentionPolicy.html#SOURCE) @https://developer.android.com/reference/java/lang/annotation/Target.html(value = ) @https://developer.android.com/reference/androidx/annotation/IntDef(value = ) public annotation https://developer.android.com/reference/androidx/media3/common/Player.MediaItemTransitionReason` Reasons for media item transitions. |
| `@https://developer.android.com/reference/java/lang/annotation/Documented.html @https://developer.android.com/reference/java/lang/annotation/Retention.html(value = https://developer.android.com/reference/java/lang/annotation/RetentionPolicy.html#SOURCE) @https://developer.android.com/reference/java/lang/annotation/Target.html(value = ) @https://developer.android.com/reference/androidx/annotation/IntDef(value = ) public annotation https://developer.android.com/reference/androidx/media3/common/Player.PlayWhenReadyChangeReason` Reasons for `https://developer.android.com/reference/androidx/media3/common/Player#getPlayWhenReady()` changes. |
| `@https://developer.android.com/reference/java/lang/annotation/Documented.html @https://developer.android.com/reference/java/lang/annotation/Retention.html(value = https://developer.android.com/reference/java/lang/annotation/RetentionPolicy.html#SOURCE) @https://developer.android.com/reference/java/lang/annotation/Target.html(value = ) @https://developer.android.com/reference/androidx/annotation/IntDef(value = ) public annotation https://developer.android.com/reference/androidx/media3/common/Player.PlaybackSuppressionReason` Reason why playback is suppressed even though `https://developer.android.com/reference/androidx/media3/common/Player#getPlayWhenReady()` is `true`. |
| `public final class https://developer.android.com/reference/androidx/media3/common/Player.PositionInfo` Position info describing a playback position involved in a discontinuity. |
| `@https://developer.android.com/reference/java/lang/annotation/Documented.html @https://developer.android.com/reference/java/lang/annotation/Retention.html(value = https://developer.android.com/reference/java/lang/annotation/RetentionPolicy.html#SOURCE) @https://developer.android.com/reference/java/lang/annotation/Target.html(value = ) @https://developer.android.com/reference/androidx/annotation/IntDef(value = ) public annotation https://developer.android.com/reference/androidx/media3/common/Player.RepeatMode` Repeat modes for playback. |
| `@https://developer.android.com/reference/java/lang/annotation/Documented.html @https://developer.android.com/reference/java/lang/annotation/Retention.html(value = https://developer.android.com/reference/java/lang/annotation/RetentionPolicy.html#SOURCE) @https://developer.android.com/reference/java/lang/annotation/Target.html(value = ) @https://developer.android.com/reference/androidx/annotation/IntDef(value = ) public annotation https://developer.android.com/reference/androidx/media3/common/Player.State` Playback state. |
| `@https://developer.android.com/reference/java/lang/annotation/Documented.html @https://developer.android.com/reference/java/lang/annotation/Retention.html(value = https://developer.android.com/reference/java/lang/annotation/RetentionPolicy.html#SOURCE) @https://developer.android.com/reference/java/lang/annotation/Target.html(value = ) @https://developer.android.com/reference/androidx/annotation/IntDef(value = ) public annotation https://developer.android.com/reference/androidx/media3/common/Player.TimelineChangeReason` Reasons for timeline changes. |

| ### Constants |
|---|---|
| `default 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 /> |
| `default 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. |
| `default 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. |
| `default 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`. |
| `default 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`. |
| `default 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. |
| `default 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 /> |
| `default 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`. |
| `default 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. |
| `default 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. |
| `default 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. |
| `default static final int` | `https://developer.android.com/reference/androidx/media3/common/Player#COMMAND_GET_VOLUME() = 22` Command to get the player volume. |
| `default 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`. |
| `default static final int` | `https://developer.android.com/reference/androidx/media3/common/Player#COMMAND_PLAY_PAUSE() = 1` Command to start, pause or resume playback. |
| `default static final int` | `https://developer.android.com/reference/androidx/media3/common/Player#COMMAND_PREPARE() = 2` Command to prepare the player. |
| `default static final int` | `https://developer.android.com/reference/androidx/media3/common/Player#COMMAND_RELEASE() = 32` Command to release the player. |
| `default 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`. |
| `default 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`. |
| `default 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`. |
| `default 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 /> |
| `default 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`. |
| `default 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`. |
| `default 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`. |
| `default 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`. |
| `default 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 /> |
| `default 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`. |
| `default 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`. |
| `default 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 /> |
| `default 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 /> |
| `default 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. |
| `default 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 /> |
| `default 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. |
| `default 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`. |
| `default 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 /> |
| `default static final int` | `https://developer.android.com/reference/androidx/media3/common/Player#COMMAND_SET_PLAYLIST_METADATA() = 19` Command to set the playlist metadata. |
| `default static final int` | `https://developer.android.com/reference/androidx/media3/common/Player#COMMAND_SET_REPEAT_MODE() = 15` Command to set the repeat mode. |
| `default static final int` | `https://developer.android.com/reference/androidx/media3/common/Player#COMMAND_SET_SHUFFLE_MODE() = 14` Command to enable shuffling. |
| `default 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. |
| `default 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. |
| `default 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. |
| `default static final int` | `https://developer.android.com/reference/androidx/media3/common/Player#COMMAND_SET_VOLUME() = 24` Command to set the player volume. |
| `default static final int` | `https://developer.android.com/reference/androidx/media3/common/Player#COMMAND_STOP() = 3` Command to stop playback. |
| `default 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. |
| `default static final int` | `https://developer.android.com/reference/androidx/media3/common/Player#DISCONTINUITY_REASON_INTERNAL() = 5` Discontinuity introduced internally (e.g. by the source). |
| `default 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`. |
| `default 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. |
| `default 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. |
| `default static final int` | `https://developer.android.com/reference/androidx/media3/common/Player#DISCONTINUITY_REASON_SILENCE_SKIP() = 6` Discontinuity introduced by a skipped silence. |
| `default 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). |
| `default 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. |
| `default static final int` | `https://developer.android.com/reference/androidx/media3/common/Player#EVENT_AUDIO_SESSION_ID() = 21` The audio session id was set. |
| `default 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`. |
| `default 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. |
| `default 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. |
| `default 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. |
| `default 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. |
| `default 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. |
| `default 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. |
| `default 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. |
| `default 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. |
| `default static final int` | `https://developer.android.com/reference/androidx/media3/common/Player#EVENT_METADATA() = 28` Metadata associated with the current playback time changed. |
| `default 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. |
| `default 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. |
| `default 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. |
| `default 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. |
| `default 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. |
| `default 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. |
| `default static final int` | `https://developer.android.com/reference/androidx/media3/common/Player#EVENT_POSITION_DISCONTINUITY() = 11` A position discontinuity occurred. |
| `default 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. |
| `default 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. |
| `default 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. |
| `default 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. |
| `default 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. |
| `default 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. |
| `default 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. |
| `default 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. |
| `default 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. |
| `default 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. |
| `default 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. |
| `default 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. |
| `default 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. |
| `default 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. |
| `default static final int` | `https://developer.android.com/reference/androidx/media3/common/Player#MEDIA_ITEM_TRANSITION_REASON_REPEAT() = 0` The media item has been repeated. |
| `default 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. |
| `default static final int` | `https://developer.android.com/reference/androidx/media3/common/Player#PLAYBACK_SUPPRESSION_REASON_NONE() = 0` Playback is not suppressed. |
| `default 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. |
| `default 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. |
| `default 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). |
| `default 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 /> |
| `default 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. |
| `default 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. |
| `default 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. |
| `default 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. |
| `default 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. |
| `default 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)`. |
| `default static final int` | `https://developer.android.com/reference/androidx/media3/common/Player#REPEAT_MODE_ALL() = 2` Repeats the entire timeline infinitely. |
| `default static final int` | `https://developer.android.com/reference/androidx/media3/common/Player#REPEAT_MODE_OFF() = 0` Normal playback without repetition. |
| `default 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. |
| `default 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. |
| `default static final int` | `https://developer.android.com/reference/androidx/media3/common/Player#STATE_ENDED() = 4` The player has finished playing the media. |
| `default 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. |
| `default 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. |
| `default 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. |
| `default 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). |

| ### Public methods |
|---|---|
| `abstract void` | `https://developer.android.com/reference/androidx/media3/common/Player#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. |
| `abstract void` | `https://developer.android.com/reference/androidx/media3/common/Player#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. |
| `abstract void` | `https://developer.android.com/reference/androidx/media3/common/Player#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. |
| `abstract void` | `https://developer.android.com/reference/androidx/media3/common/Player#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. |
| `abstract void` | `https://developer.android.com/reference/androidx/media3/common/Player#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. |
| `abstract boolean` | `https://developer.android.com/reference/androidx/media3/common/Player#canAdvertiseSession()()` Returns whether the player can be used to advertise a media session. |
| `abstract void` | `https://developer.android.com/reference/androidx/media3/common/Player#clearMediaItems()()` Clears the playlist. |
| `abstract void` | `https://developer.android.com/reference/androidx/media3/common/Player#clearVideoSurface()()` Clears any `https://developer.android.com/reference/android/view/Surface.html`, `https://developer.android.com/reference/android/view/SurfaceHolder.html`, `https://developer.android.com/reference/android/view/SurfaceView.html` or `https://developer.android.com/reference/android/view/TextureView.html` currently set on the player. |
| `abstract void` | `https://developer.android.com/reference/androidx/media3/common/Player#clearVideoSurface(android.view.Surface)(@https://developer.android.com/reference/androidx/annotation/Nullable https://developer.android.com/reference/android/view/Surface.html surface)` Clears the `https://developer.android.com/reference/android/view/Surface.html` onto which video is being rendered if it matches the one passed. |
| `abstract void` | `https://developer.android.com/reference/androidx/media3/common/Player#clearVideoSurfaceHolder(android.view.SurfaceHolder)(@https://developer.android.com/reference/androidx/annotation/Nullable https://developer.android.com/reference/android/view/SurfaceHolder.html surfaceHolder)` Clears the `https://developer.android.com/reference/android/view/SurfaceHolder.html` that holds the `https://developer.android.com/reference/android/view/Surface.html` onto which video is being rendered if it matches the one passed. |
| `abstract void` | `https://developer.android.com/reference/androidx/media3/common/Player#clearVideoSurfaceView(android.view.SurfaceView)(@https://developer.android.com/reference/androidx/annotation/Nullable https://developer.android.com/reference/android/view/SurfaceView.html surfaceView)` Clears the `https://developer.android.com/reference/android/view/SurfaceView.html` onto which video is being rendered if it matches the one passed. |
| `abstract void` | `https://developer.android.com/reference/androidx/media3/common/Player#clearVideoTextureView(android.view.TextureView)(@https://developer.android.com/reference/androidx/annotation/Nullable https://developer.android.com/reference/android/view/TextureView.html textureView)` Clears the `https://developer.android.com/reference/android/view/TextureView.html` onto which video is being rendered if it matches the one passed. |
| `abstract void` | `[decreaseDeviceVolume](https://developer.android.com/reference/androidx/media3/common/Player#decreaseDeviceVolume())()` **This method is deprecated.** Use `https://developer.android.com/reference/androidx/media3/common/Player#decreaseDeviceVolume(int)` instead. <br /> |
| `abstract void` | `https://developer.android.com/reference/androidx/media3/common/Player#decreaseDeviceVolume(int)(@https://developer.android.com/reference/androidx/media3/common/C.VolumeFlags int flags)` Decreases the volume of the device. |
| `abstract https://developer.android.com/reference/android/os/Looper.html` | `https://developer.android.com/reference/androidx/media3/common/Player#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. |
| `abstract https://developer.android.com/reference/androidx/media3/common/AudioAttributes` | `https://developer.android.com/reference/androidx/media3/common/Player#getAudioAttributes()()` Returns the attributes for audio playback. |
| `default 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 https://developer.android.com/reference/androidx/media3/common/Player.Commands` | `https://developer.android.com/reference/androidx/media3/common/Player#getAvailableCommands()()` Returns the player's currently available `https://developer.android.com/reference/androidx/media3/common/Player.Commands`. |
| `abstract @https://developer.android.com/reference/androidx/annotation/IntRange(from = 0, to = 100) int` | `https://developer.android.com/reference/androidx/media3/common/Player#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. |
| `abstract long` | `https://developer.android.com/reference/androidx/media3/common/Player#getBufferedPosition()()` Returns an estimate of the position in the current content or ad up to which data is buffered, in milliseconds. |
| `abstract long` | `https://developer.android.com/reference/androidx/media3/common/Player#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. |
| `abstract long` | `https://developer.android.com/reference/androidx/media3/common/Player#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. |
| `abstract long` | `https://developer.android.com/reference/androidx/media3/common/Player#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. |
| `abstract int` | `https://developer.android.com/reference/androidx/media3/common/Player#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. |
| `abstract int` | `https://developer.android.com/reference/androidx/media3/common/Player#getCurrentAdIndexInAdGroup()()` If `https://developer.android.com/reference/androidx/media3/common/Player#isPlayingAd()` returns true, returns the index of the ad in its ad group. |
| `abstract https://developer.android.com/reference/androidx/media3/common/text/CueGroup` | `https://developer.android.com/reference/androidx/media3/common/Player#getCurrentCues()()` Returns the current `https://developer.android.com/reference/androidx/media3/common/text/CueGroup`. |
| `abstract long` | `https://developer.android.com/reference/androidx/media3/common/Player#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. |
| `abstract @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/util/UnstableApi https://developer.android.com/reference/androidx/media3/common/Player#getCurrentManifest()()` Returns the current manifest. |
| `abstract @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/Player#getCurrentMediaItem()()` Returns the currently playing `https://developer.android.com/reference/androidx/media3/common/MediaItem`. |
| `abstract int` | `https://developer.android.com/reference/androidx/media3/common/Player#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. |
| `abstract int` | `https://developer.android.com/reference/androidx/media3/common/Player#getCurrentPeriodIndex()()` Returns the index of the period currently being played. |
| `abstract long` | `https://developer.android.com/reference/androidx/media3/common/Player#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. |
| `abstract https://developer.android.com/reference/androidx/media3/common/Timeline` | `https://developer.android.com/reference/androidx/media3/common/Player#getCurrentTimeline()()` Returns the current `https://developer.android.com/reference/androidx/media3/common/Timeline`. |
| `abstract https://developer.android.com/reference/androidx/media3/common/Tracks` | `https://developer.android.com/reference/androidx/media3/common/Player#getCurrentTracks()()` Returns the current tracks. |
| `abstract int` | `@https://developer.android.com/reference/androidx/media3/common/util/UnstableApi [getCurrentWindowIndex](https://developer.android.com/reference/androidx/media3/common/Player#getCurrentWindowIndex())()` **This method is deprecated.** Use `https://developer.android.com/reference/androidx/media3/common/Player#getCurrentMediaItemIndex()` instead. <br /> |
| `abstract https://developer.android.com/reference/androidx/media3/common/DeviceInfo` | `https://developer.android.com/reference/androidx/media3/common/Player#getDeviceInfo()()` Gets the device information. |
| `abstract @https://developer.android.com/reference/androidx/annotation/IntRange(from = 0) int` | `https://developer.android.com/reference/androidx/media3/common/Player#getDeviceVolume()()` Gets the current volume of the device. |
| `abstract long` | `https://developer.android.com/reference/androidx/media3/common/Player#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. |
| `abstract long` | `https://developer.android.com/reference/androidx/media3/common/Player#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. |
| `abstract https://developer.android.com/reference/androidx/media3/common/MediaItem` | `https://developer.android.com/reference/androidx/media3/common/Player#getMediaItemAt(int)(int index)` Returns the `https://developer.android.com/reference/androidx/media3/common/MediaItem` at the given index. |
| `abstract int` | `https://developer.android.com/reference/androidx/media3/common/Player#getMediaItemCount()()` Returns the number of `https://developer.android.com/reference/androidx/media3/common/MediaItem` in the playlist. |
| `abstract https://developer.android.com/reference/androidx/media3/common/MediaMetadata` | `https://developer.android.com/reference/androidx/media3/common/Player#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. |
| `abstract int` | `https://developer.android.com/reference/androidx/media3/common/Player#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. |
| `abstract int` | `@https://developer.android.com/reference/androidx/media3/common/util/UnstableApi [getNextWindowIndex](https://developer.android.com/reference/androidx/media3/common/Player#getNextWindowIndex())()` **This method is deprecated.** Use `https://developer.android.com/reference/androidx/media3/common/Player#getNextMediaItemIndex()` instead. <br /> |
| `abstract boolean` | `https://developer.android.com/reference/androidx/media3/common/Player#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()`. |
| `abstract https://developer.android.com/reference/androidx/media3/common/PlaybackParameters` | `https://developer.android.com/reference/androidx/media3/common/Player#getPlaybackParameters()()` Returns the currently active playback parameters. |
| `abstract int` | `@https://developer.android.com/reference/androidx/media3/common/Player.State https://developer.android.com/reference/androidx/media3/common/Player#getPlaybackState()()` Returns the current `https://developer.android.com/reference/androidx/media3/common/Player.State` of the player. |
| `abstract int` | `@https://developer.android.com/reference/androidx/media3/common/Player.PlaybackSuppressionReason https://developer.android.com/reference/androidx/media3/common/Player#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. |
| `abstract @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/Player#getPlayerError()()` Returns the error that caused playback to fail. |
| `abstract https://developer.android.com/reference/androidx/media3/common/MediaMetadata` | `https://developer.android.com/reference/androidx/media3/common/Player#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. |
| `abstract int` | `https://developer.android.com/reference/androidx/media3/common/Player#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. |
| `abstract int` | `@https://developer.android.com/reference/androidx/media3/common/util/UnstableApi [getPreviousWindowIndex](https://developer.android.com/reference/androidx/media3/common/Player#getPreviousWindowIndex())()` **This method is deprecated.** Use `https://developer.android.com/reference/androidx/media3/common/Player#getPreviousMediaItemIndex()` instead. <br /> |
| `abstract int` | `@https://developer.android.com/reference/androidx/media3/common/Player.RepeatMode https://developer.android.com/reference/androidx/media3/common/Player#getRepeatMode()()` Returns the current `https://developer.android.com/reference/androidx/media3/common/Player.RepeatMode` used for playback. |
| `abstract long` | `https://developer.android.com/reference/androidx/media3/common/Player#getSeekBackIncrement()()` Returns the `https://developer.android.com/reference/androidx/media3/common/Player#seekBack()` increment. |
| `abstract long` | `https://developer.android.com/reference/androidx/media3/common/Player#getSeekForwardIncrement()()` Returns the `https://developer.android.com/reference/androidx/media3/common/Player#seekForward()` increment. |
| `abstract boolean` | `https://developer.android.com/reference/androidx/media3/common/Player#getShuffleModeEnabled()()` Returns whether shuffling of media items is enabled. |
| `abstract https://developer.android.com/reference/androidx/media3/common/util/Size` | `@https://developer.android.com/reference/androidx/media3/common/util/UnstableApi https://developer.android.com/reference/androidx/media3/common/Player#getSurfaceSize()()` Gets the size of the surface on which the video is rendered. |
| `abstract long` | `https://developer.android.com/reference/androidx/media3/common/Player#getTotalBufferedDuration()()` Returns an estimate of the total buffered duration from the current position, in milliseconds. |
| `abstract https://developer.android.com/reference/androidx/media3/common/TrackSelectionParameters` | `https://developer.android.com/reference/androidx/media3/common/Player#getTrackSelectionParameters()()` Returns the parameters constraining the track selection. |
| `abstract https://developer.android.com/reference/androidx/media3/common/VideoSize` | `https://developer.android.com/reference/androidx/media3/common/Player#getVideoSize()()` Gets the size of the video. |
| `abstract @https://developer.android.com/reference/androidx/annotation/FloatRange(from = 0, to = 1.0) float` | `https://developer.android.com/reference/androidx/media3/common/Player#getVolume()()` Returns the audio volume, with 0 being silence and 1 being unity gain (signal unchanged). |
| `abstract boolean` | `https://developer.android.com/reference/androidx/media3/common/Player#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. |
| `abstract boolean` | `https://developer.android.com/reference/androidx/media3/common/Player#hasPreviousMediaItem()()` Returns whether a previous media item exists, which may depend on the current repeat mode and whether shuffle mode is enabled. |
| `abstract void` | `[increaseDeviceVolume](https://developer.android.com/reference/androidx/media3/common/Player#increaseDeviceVolume())()` **This method is deprecated.** Use `https://developer.android.com/reference/androidx/media3/common/Player#increaseDeviceVolume(int)` instead. <br /> |
| `abstract void` | `https://developer.android.com/reference/androidx/media3/common/Player#increaseDeviceVolume(int)(@https://developer.android.com/reference/androidx/media3/common/C.VolumeFlags int flags)` Increases the volume of the device. |
| `abstract boolean` | `https://developer.android.com/reference/androidx/media3/common/Player#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. |
| `abstract boolean` | `https://developer.android.com/reference/androidx/media3/common/Player#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. |
| `abstract boolean` | `https://developer.android.com/reference/androidx/media3/common/Player#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. |
| `abstract boolean` | `https://developer.android.com/reference/androidx/media3/common/Player#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. |
| `abstract boolean` | `@https://developer.android.com/reference/androidx/media3/common/util/UnstableApi [isCurrentWindowDynamic](https://developer.android.com/reference/androidx/media3/common/Player#isCurrentWindowDynamic())()` **This method is deprecated.** Use `https://developer.android.com/reference/androidx/media3/common/Player#isCurrentMediaItemDynamic()` instead. <br /> |
| `abstract boolean` | `@https://developer.android.com/reference/androidx/media3/common/util/UnstableApi [isCurrentWindowLive](https://developer.android.com/reference/androidx/media3/common/Player#isCurrentWindowLive())()` **This method is deprecated.** Use `https://developer.android.com/reference/androidx/media3/common/Player#isCurrentMediaItemLive()` instead. <br /> |
| `abstract boolean` | `@https://developer.android.com/reference/androidx/media3/common/util/UnstableApi [isCurrentWindowSeekable](https://developer.android.com/reference/androidx/media3/common/Player#isCurrentWindowSeekable())()` **This method is deprecated.** Use `https://developer.android.com/reference/androidx/media3/common/Player#isCurrentMediaItemSeekable()` instead. <br /> |
| `abstract boolean` | `https://developer.android.com/reference/androidx/media3/common/Player#isDeviceMuted()()` Gets whether the device is muted or not. |
| `abstract boolean` | `https://developer.android.com/reference/androidx/media3/common/Player#isLoading()()` Whether the player is currently loading the source. |
| `abstract boolean` | `https://developer.android.com/reference/androidx/media3/common/Player#isPlaying()()` Returns whether the player is playing, i.e. `https://developer.android.com/reference/androidx/media3/common/Player#getCurrentPosition()` is advancing. |
| `abstract boolean` | `https://developer.android.com/reference/androidx/media3/common/Player#isPlayingAd()()` Returns whether the player is currently playing an ad. |
| `abstract void` | `https://developer.android.com/reference/androidx/media3/common/Player#moveMediaItem(int,int)(int currentIndex, int newIndex)` Moves the media item at the current index to the new index. |
| `abstract void` | `https://developer.android.com/reference/androidx/media3/common/Player#moveMediaItems(int,int,int)(int fromIndex, int toIndex, int newIndex)` Moves the media item range to the new index. |
| `abstract void` | `https://developer.android.com/reference/androidx/media3/common/Player#mute()()` Sets the audio volume to 0. |
| `abstract void` | `https://developer.android.com/reference/androidx/media3/common/Player#pause()()` Pauses playback. |
| `abstract void` | `https://developer.android.com/reference/androidx/media3/common/Player#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()`. |
| `abstract void` | `https://developer.android.com/reference/androidx/media3/common/Player#prepare()()` Prepares the player. |
| `abstract void` | `https://developer.android.com/reference/androidx/media3/common/Player#release()()` Releases the player. |
| `abstract void` | `https://developer.android.com/reference/androidx/media3/common/Player#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)`. |
| `abstract void` | `https://developer.android.com/reference/androidx/media3/common/Player#removeMediaItem(int)(int index)` Removes the media item at the given index of the playlist. |
| `abstract void` | `https://developer.android.com/reference/androidx/media3/common/Player#removeMediaItems(int,int)(int fromIndex, int toIndex)` Removes a range of media items from the playlist. |
| `abstract void` | `https://developer.android.com/reference/androidx/media3/common/Player#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. |
| `abstract void` | `https://developer.android.com/reference/androidx/media3/common/Player#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. |
| `abstract void` | `https://developer.android.com/reference/androidx/media3/common/Player#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. |
| `abstract void` | `https://developer.android.com/reference/androidx/media3/common/Player#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. |
| `abstract void` | `https://developer.android.com/reference/androidx/media3/common/Player#seekTo(long)(long positionMs)` Seeks to a position specified in milliseconds in the current `https://developer.android.com/reference/androidx/media3/common/MediaItem`. |
| `abstract void` | `https://developer.android.com/reference/androidx/media3/common/Player#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`. |
| `abstract void` | `https://developer.android.com/reference/androidx/media3/common/Player#seekToDefaultPosition()()` Seeks to the default position associated with the current `https://developer.android.com/reference/androidx/media3/common/MediaItem`. |
| `abstract void` | `https://developer.android.com/reference/androidx/media3/common/Player#seekToDefaultPosition(int)(int mediaItemIndex)` Seeks to the default position associated with the specified `https://developer.android.com/reference/androidx/media3/common/MediaItem`. |
| `abstract void` | `https://developer.android.com/reference/androidx/media3/common/Player#seekToNext()()` Seeks to a later position in the current or next `https://developer.android.com/reference/androidx/media3/common/MediaItem` (if available). |
| `abstract void` | `https://developer.android.com/reference/androidx/media3/common/Player#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. |
| `abstract void` | `https://developer.android.com/reference/androidx/media3/common/Player#seekToPrevious()()` Seeks to an earlier position in the current or previous `https://developer.android.com/reference/androidx/media3/common/MediaItem` (if available). |
| `abstract void` | `https://developer.android.com/reference/androidx/media3/common/Player#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. |
| `abstract void` | `https://developer.android.com/reference/androidx/media3/common/Player#setAudioAttributes(androidx.media3.common.AudioAttributes,boolean)( https://developer.android.com/reference/androidx/media3/common/AudioAttributes audioAttributes, boolean handleAudioFocus )` Sets the attributes for audio playback, used by the underlying audio track. |
| `abstract void` | `[setDeviceMuted](https://developer.android.com/reference/androidx/media3/common/Player#setDeviceMuted(boolean))(boolean muted)` **This method is deprecated.** Use `https://developer.android.com/reference/androidx/media3/common/Player#setDeviceMuted(boolean,int)` instead. <br /> |
| `abstract void` | `https://developer.android.com/reference/androidx/media3/common/Player#setDeviceMuted(boolean,int)(boolean muted, @https://developer.android.com/reference/androidx/media3/common/C.VolumeFlags int flags)` Sets the mute state of the device. |
| `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#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. |
| `abstract void` | `https://developer.android.com/reference/androidx/media3/common/Player#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`. |
| `abstract void` | `https://developer.android.com/reference/androidx/media3/common/Player#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`. |
| `abstract void` | `https://developer.android.com/reference/androidx/media3/common/Player#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. |
| `abstract void` | `https://developer.android.com/reference/androidx/media3/common/Player#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`. |
| `abstract void` | `https://developer.android.com/reference/androidx/media3/common/Player#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`. |
| `abstract void` | `https://developer.android.com/reference/androidx/media3/common/Player#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()`. |
| `abstract void` | `https://developer.android.com/reference/androidx/media3/common/Player#setPlaybackParameters(androidx.media3.common.PlaybackParameters)(https://developer.android.com/reference/androidx/media3/common/PlaybackParameters playbackParameters)` Attempts to set the playback parameters. |
| `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`. |
| `abstract void` | `https://developer.android.com/reference/androidx/media3/common/Player#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. |
| `abstract void` | `https://developer.android.com/reference/androidx/media3/common/Player#setShuffleModeEnabled(boolean)(boolean shuffleModeEnabled)` Sets whether shuffling of media items is enabled. |
| `abstract void` | `https://developer.android.com/reference/androidx/media3/common/Player#setTrackSelectionParameters(androidx.media3.common.TrackSelectionParameters)(https://developer.android.com/reference/androidx/media3/common/TrackSelectionParameters parameters)` Sets the parameters constraining the track selection. |
| `abstract void` | `https://developer.android.com/reference/androidx/media3/common/Player#setVideoSurface(android.view.Surface)(@https://developer.android.com/reference/androidx/annotation/Nullable https://developer.android.com/reference/android/view/Surface.html surface)` Sets the `https://developer.android.com/reference/android/view/Surface.html` onto which video will be rendered. |
| `abstract void` | `https://developer.android.com/reference/androidx/media3/common/Player#setVideoSurfaceHolder(android.view.SurfaceHolder)(@https://developer.android.com/reference/androidx/annotation/Nullable https://developer.android.com/reference/android/view/SurfaceHolder.html surfaceHolder)` Sets the `https://developer.android.com/reference/android/view/SurfaceHolder.html` that holds the `https://developer.android.com/reference/android/view/Surface.html` onto which video will be rendered. |
| `abstract void` | `https://developer.android.com/reference/androidx/media3/common/Player#setVideoSurfaceView(android.view.SurfaceView)(@https://developer.android.com/reference/androidx/annotation/Nullable https://developer.android.com/reference/android/view/SurfaceView.html surfaceView)` Sets the `https://developer.android.com/reference/android/view/SurfaceView.html` onto which video will be rendered. |
| `abstract void` | `https://developer.android.com/reference/androidx/media3/common/Player#setVideoTextureView(android.view.TextureView)(@https://developer.android.com/reference/androidx/annotation/Nullable https://developer.android.com/reference/android/view/TextureView.html textureView)` Sets the `https://developer.android.com/reference/android/view/TextureView.html` onto which video will be rendered. |
| `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. |
| `abstract void` | `https://developer.android.com/reference/androidx/media3/common/Player#stop()()` Stops playback without resetting the playlist. |
| `abstract void` | `https://developer.android.com/reference/androidx/media3/common/Player#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. |

| ### Extension functions |
|---|---|
| `default final @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/lang/Void.html` | `@https://developer.android.com/reference/androidx/media3/common/util/UnstableApi https://developer.android.com/reference/androidx/media3/common/PlayerExtensionsKt.https://developer.android.com/reference/androidx/media3/common/Player#(androidx.media3.common.Player).listen(kotlin.Function2)( @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/media3/common/Player receiver, @https://developer.android.com/reference/androidx/annotation/NonNull Function2<@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/media3/common/Player, @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/media3/common/Player.Events, https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html> onEvents )` Continuously listens to the `https://developer.android.com/reference/androidx/media3/common/Player.Listener#onEvents(androidx.media3.common.Player,androidx.media3.common.Player.Events)` callback, passing the received `https://developer.android.com/reference/androidx/media3/common/Player.Events` to the provided `https://developer.android.com/reference/androidx/media3/common/package-summary#(androidx.media3.common.Player).listen(kotlin.Function2)` function. |
| `default final @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/lang/Void.html` | `@https://developer.android.com/reference/androidx/media3/common/util/UnstableApi https://developer.android.com/reference/androidx/media3/common/PlayerExtensionsKt.https://developer.android.com/reference/androidx/media3/common/Player#(androidx.media3.common.Player).listenTo(kotlin.Int,kotlin.IntArray,kotlin.Function2)( @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/media3/common/Player receiver, @https://developer.android.com/reference/androidx/media3/common/Player.Event int firstEvent, int... otherEvents, @https://developer.android.com/reference/androidx/annotation/NonNull Function2<@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/media3/common/Player, @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/media3/common/Player.Events, https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html> onEvents )` Continuously listens to the `https://developer.android.com/reference/androidx/media3/common/Player.Listener#onEvents(androidx.media3.common.Player,androidx.media3.common.Player.Events)` callback, passing the received `https://developer.android.com/reference/androidx/media3/common/Player.Events` to the provided `https://developer.android.com/reference/androidx/media3/common/package-summary#(androidx.media3.common.Player).listenTo(kotlin.Int,kotlin.IntArray,kotlin.Function2)` function. |
| `default final void` | `@https://developer.android.com/reference/androidx/media3/common/util/UnstableApi https://developer.android.com/reference/androidx/media3/common/PlayerFenceKt.https://developer.android.com/reference/androidx/media3/common/Player#(androidx.media3.common.Player).awaitContentPositionAtLeast(kotlin.Long,kotlin.Boolean,kotlin.time.Duration)( @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/media3/common/Player receiver, long targetPositionMs, boolean failOnNonFatalErrors, https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.time/-duration/index.html timeout )` Suspends until the content position reaches (or passes) `https://developer.android.com/reference/androidx/media3/test/utils/package-summary#(androidx.media3.common.Player).awaitContentPositionAtLeast(kotlin.Long,kotlin.Boolean,kotlin.time.Duration)` in the current media item. |
| `default final void` | `@https://developer.android.com/reference/androidx/media3/common/util/UnstableApi https://developer.android.com/reference/androidx/media3/common/PlayerFenceKt.https://developer.android.com/reference/androidx/media3/common/Player#(androidx.media3.common.Player).awaitFirstFrameRendered(kotlin.Boolean,kotlin.time.Duration)( @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/media3/common/Player receiver, boolean failOnNonFatalErrors, https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.time/-duration/index.html timeout )` Suspends until `https://developer.android.com/reference/androidx/media3/common/Player.Listener#onRenderedFirstFrame()` is invoked. |
| `default final void` | `@https://developer.android.com/reference/androidx/media3/common/util/UnstableApi https://developer.android.com/reference/androidx/media3/common/PlayerFenceKt.https://developer.android.com/reference/androidx/media3/common/Player#(androidx.media3.common.Player).awaitIsPlaying(kotlin.Boolean,kotlin.Boolean,kotlin.time.Duration)( @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/media3/common/Player receiver, boolean targetIsPlaying, boolean failOnNonFatalErrors, https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.time/-duration/index.html timeout )` Suspends until the player's `https://developer.android.com/reference/androidx/media3/common/Player#isPlaying()` value matches `https://developer.android.com/reference/androidx/media3/test/utils/package-summary#(androidx.media3.common.Player).awaitIsPlaying(kotlin.Boolean,kotlin.Boolean,kotlin.time.Duration)`. |
| `default final void` | `@https://developer.android.com/reference/androidx/media3/common/util/UnstableApi https://developer.android.com/reference/androidx/media3/common/PlayerFenceKt.https://developer.android.com/reference/androidx/media3/common/Player#(androidx.media3.common.Player).awaitPlaybackState(kotlin.Int,kotlin.Boolean,kotlin.time.Duration)( @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/media3/common/Player receiver, @https://developer.android.com/reference/androidx/media3/common/Player.State int targetState, boolean failOnNonFatalErrors, https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.time/-duration/index.html timeout )` Suspends until the player enters the provided `https://developer.android.com/reference/androidx/media3/test/utils/package-summary#(androidx.media3.common.Player).awaitPlaybackState(kotlin.Int,kotlin.Boolean,kotlin.time.Duration)`. |

## Constants

### COMMAND_ADJUST_DEVICE_VOLUME

```
default static final int COMMAND_ADJUST_DEVICE_VOLUME = 26
```

> [!CAUTION]
> **This field is deprecated.**   
>
> Use `https://developer.android.com/reference/androidx/media3/common/Player#COMMAND_ADJUST_DEVICE_VOLUME_WITH_FLAGS()` instead.

### COMMAND_ADJUST_DEVICE_VOLUME_WITH_FLAGS

```
default static final int COMMAND_ADJUST_DEVICE_VOLUME_WITH_FLAGS = 34
```

Command to increase and decrease the device volume and mute it with volume flags.

The following methods must only be called if this command is `https://developer.android.com/reference/androidx/media3/common/Player#isCommandAvailable(int)`:

- `https://developer.android.com/reference/androidx/media3/common/Player#increaseDeviceVolume(int)`
- `https://developer.android.com/reference/androidx/media3/common/Player#decreaseDeviceVolume(int)`
- `https://developer.android.com/reference/androidx/media3/common/Player#setDeviceMuted(boolean,int)`

### COMMAND_CHANGE_MEDIA_ITEMS

```
default static final int COMMAND_CHANGE_MEDIA_ITEMS = 20
```

Command to change the `https://developer.android.com/reference/androidx/media3/common/MediaItem` in the playlist.

The following methods must only be called if this command is `https://developer.android.com/reference/androidx/media3/common/Player#isCommandAvailable(int)`:

- `https://developer.android.com/reference/androidx/media3/common/Player#addMediaItem(androidx.media3.common.MediaItem)`
- `https://developer.android.com/reference/androidx/media3/common/Player#addMediaItem(int,androidx.media3.common.MediaItem)`
- `https://developer.android.com/reference/androidx/media3/common/Player#addMediaItems(java.util.List<androidx.media3.common.MediaItem>)`
- `https://developer.android.com/reference/androidx/media3/common/Player#addMediaItems(int,java.util.List<androidx.media3.common.MediaItem>)`
- `https://developer.android.com/reference/androidx/media3/common/Player#clearMediaItems()`
- `https://developer.android.com/reference/androidx/media3/common/Player#moveMediaItem(int,int)`
- `https://developer.android.com/reference/androidx/media3/common/Player#moveMediaItems(int,int,int)`
- `https://developer.android.com/reference/androidx/media3/common/Player#removeMediaItem(int)`
- `https://developer.android.com/reference/androidx/media3/common/Player#removeMediaItems(int,int)`
- `https://developer.android.com/reference/androidx/media3/common/Player#setMediaItems(java.util.List<androidx.media3.common.MediaItem>)`
- `https://developer.android.com/reference/androidx/media3/common/Player#setMediaItems(java.util.List<androidx.media3.common.MediaItem>,boolean)`
- `https://developer.android.com/reference/androidx/media3/common/Player#setMediaItems(java.util.List<androidx.media3.common.MediaItem>,int,long)`
- `https://developer.android.com/reference/androidx/media3/common/Player#replaceMediaItem(int,androidx.media3.common.MediaItem)`
- `https://developer.android.com/reference/androidx/media3/common/Player#replaceMediaItems(int,int,java.util.List<androidx.media3.common.MediaItem>)`

### COMMAND_GET_AUDIO_ATTRIBUTES

```
default static final int COMMAND_GET_AUDIO_ATTRIBUTES = 21
```

Command to get the player current `https://developer.android.com/reference/androidx/media3/common/AudioAttributes`.

The `https://developer.android.com/reference/androidx/media3/common/Player#getAudioAttributes()` method must only be called if this command is `https://developer.android.com/reference/androidx/media3/common/Player#isCommandAvailable(int)`.

### COMMAND_GET_CURRENT_MEDIA_ITEM

```
default static final int COMMAND_GET_CURRENT_MEDIA_ITEM = 16
```

Command to get information about the currently playing `https://developer.android.com/reference/androidx/media3/common/MediaItem`.

The following methods must only be called if this command is `https://developer.android.com/reference/androidx/media3/common/Player#isCommandAvailable(int)`:

- `https://developer.android.com/reference/androidx/media3/common/Player#getCurrentMediaItem()`
- `https://developer.android.com/reference/androidx/media3/common/Player#isCurrentMediaItemDynamic()`
- `https://developer.android.com/reference/androidx/media3/common/Player#isCurrentMediaItemLive()`
- `https://developer.android.com/reference/androidx/media3/common/Player#isCurrentMediaItemSeekable()`
- `https://developer.android.com/reference/androidx/media3/common/Player#getCurrentLiveOffset()`
- `https://developer.android.com/reference/androidx/media3/common/Player#getDuration()`
- `https://developer.android.com/reference/androidx/media3/common/Player#getCurrentPosition()`
- `https://developer.android.com/reference/androidx/media3/common/Player#getBufferedPosition()`
- `https://developer.android.com/reference/androidx/media3/common/Player#getContentDuration()`
- `https://developer.android.com/reference/androidx/media3/common/Player#getContentPosition()`
- `https://developer.android.com/reference/androidx/media3/common/Player#getContentBufferedPosition()`
- `https://developer.android.com/reference/androidx/media3/common/Player#getTotalBufferedDuration()`
- `https://developer.android.com/reference/androidx/media3/common/Player#isPlayingAd()`
- `https://developer.android.com/reference/androidx/media3/common/Player#getCurrentAdGroupIndex()`
- `https://developer.android.com/reference/androidx/media3/common/Player#getCurrentAdIndexInAdGroup()`

### COMMAND_GET_DEVICE_VOLUME

```
default static final int COMMAND_GET_DEVICE_VOLUME = 23
```

Command to get the device volume and whether it is muted.

The following methods must only be called if this command is `https://developer.android.com/reference/androidx/media3/common/Player#isCommandAvailable(int)`:

- `https://developer.android.com/reference/androidx/media3/common/Player#getDeviceVolume()`
- `https://developer.android.com/reference/androidx/media3/common/Player#isDeviceMuted()`

### COMMAND_GET_MEDIA_ITEMS_METADATA

```
default static final int COMMAND_GET_MEDIA_ITEMS_METADATA = 18
```

> [!CAUTION]
> **This field is deprecated.**   
>
> Use `https://developer.android.com/reference/androidx/media3/common/Player#COMMAND_GET_METADATA()` instead.

### COMMAND_GET_METADATA

```
default static final int COMMAND_GET_METADATA = 18
```

Command to get metadata related to the playlist and current `https://developer.android.com/reference/androidx/media3/common/MediaItem`.

The following methods must only be called if this command is `https://developer.android.com/reference/androidx/media3/common/Player#isCommandAvailable(int)`:

- `https://developer.android.com/reference/androidx/media3/common/Player#getMediaMetadata()`
- `https://developer.android.com/reference/androidx/media3/common/Player#getPlaylistMetadata()`

### COMMAND_GET_TEXT

```
default static final int COMMAND_GET_TEXT = 28
```

Command to get the text that should currently be displayed by the player.

The `https://developer.android.com/reference/androidx/media3/common/Player#getCurrentCues()` method must only be called if this command is `https://developer.android.com/reference/androidx/media3/common/Player#isCommandAvailable(int)`.

### COMMAND_GET_TIMELINE

```
default static final int COMMAND_GET_TIMELINE = 17
```

Command to get the information about the current timeline.

The following methods must only be called if this command is `https://developer.android.com/reference/androidx/media3/common/Player#isCommandAvailable(int)`:

- `https://developer.android.com/reference/androidx/media3/common/Player#getCurrentTimeline()`
- `https://developer.android.com/reference/androidx/media3/common/Player#getCurrentMediaItemIndex()`
- `https://developer.android.com/reference/androidx/media3/common/Player#getCurrentPeriodIndex()`
- `https://developer.android.com/reference/androidx/media3/common/Player#getMediaItemCount()`
- `https://developer.android.com/reference/androidx/media3/common/Player#getMediaItemAt(int)`
- `https://developer.android.com/reference/androidx/media3/common/Player#getNextMediaItemIndex()`
- `https://developer.android.com/reference/androidx/media3/common/Player#getPreviousMediaItemIndex()`
- `https://developer.android.com/reference/androidx/media3/common/Player#hasPreviousMediaItem()`
- `https://developer.android.com/reference/androidx/media3/common/Player#hasNextMediaItem()`

### COMMAND_GET_TRACKS

```
default static final int COMMAND_GET_TRACKS = 30
```

Command to get details of the current track selection.

The `https://developer.android.com/reference/androidx/media3/common/Player#getCurrentTracks()` method must only be called if this command is `https://developer.android.com/reference/androidx/media3/common/Player#isCommandAvailable(int)`.

### COMMAND_GET_VOLUME

```
default static final int COMMAND_GET_VOLUME = 22
```

Command to get the player volume.

The `https://developer.android.com/reference/androidx/media3/common/Player#getVolume()` method must only be called if this command is `https://developer.android.com/reference/androidx/media3/common/Player#isCommandAvailable(int)`.

### COMMAND_INVALID

```
default static final int COMMAND_INVALID = -1
```

Represents an invalid `https://developer.android.com/reference/androidx/media3/common/Player.Command`.

### COMMAND_PLAY_PAUSE

```
default static final int COMMAND_PLAY_PAUSE = 1
```

Command to start, pause or resume playback.

The following methods must only be called if this command is `https://developer.android.com/reference/androidx/media3/common/Player#isCommandAvailable(int)`:

- `https://developer.android.com/reference/androidx/media3/common/Player#play()`
- `https://developer.android.com/reference/androidx/media3/common/Player#pause()`
- `https://developer.android.com/reference/androidx/media3/common/Player#setPlayWhenReady(boolean)`

### COMMAND_PREPARE

```
default static final int COMMAND_PREPARE = 2
```

Command to prepare the player.

The `https://developer.android.com/reference/androidx/media3/common/Player#prepare()` method must only be called if this command is `https://developer.android.com/reference/androidx/media3/common/Player#isCommandAvailable(int)`.

### COMMAND_RELEASE

```
default static final int COMMAND_RELEASE = 32
```

Command to release the player.

The `https://developer.android.com/reference/androidx/media3/common/Player#release()` method must only be called if this command is `https://developer.android.com/reference/androidx/media3/common/Player#isCommandAvailable(int)`.

### COMMAND_SEEK_BACK

```
default static final int COMMAND_SEEK_BACK = 11
```

Command to seek back by a fixed increment inside the current `https://developer.android.com/reference/androidx/media3/common/MediaItem`.

The `https://developer.android.com/reference/androidx/media3/common/Player#seekBack()` method must only be called if this command is `https://developer.android.com/reference/androidx/media3/common/Player#isCommandAvailable(int)`.

### COMMAND_SEEK_FORWARD

```
default static final int COMMAND_SEEK_FORWARD = 12
```

Command to seek forward by a fixed increment inside the current `https://developer.android.com/reference/androidx/media3/common/MediaItem`.

The `https://developer.android.com/reference/androidx/media3/common/Player#seekForward()` method must only be called if this command is `https://developer.android.com/reference/androidx/media3/common/Player#isCommandAvailable(int)`.

### COMMAND_SEEK_IN_CURRENT_MEDIA_ITEM

```
default static final int COMMAND_SEEK_IN_CURRENT_MEDIA_ITEM = 5
```

Command to seek anywhere inside the current `https://developer.android.com/reference/androidx/media3/common/MediaItem`.

The `https://developer.android.com/reference/androidx/media3/common/Player#seekTo(long)` method must only be called if this command is `https://developer.android.com/reference/androidx/media3/common/Player#isCommandAvailable(int)`.

### COMMAND_SEEK_IN_CURRENT_WINDOW

```
@UnstableApi
default static final int COMMAND_SEEK_IN_CURRENT_WINDOW = 5
```

> [!CAUTION]
> **This field is deprecated.**   
>
> Use `https://developer.android.com/reference/androidx/media3/common/Player#COMMAND_SEEK_IN_CURRENT_MEDIA_ITEM()` instead.

### COMMAND_SEEK_TO_DEFAULT_POSITION

```
default static final int 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`.

The `https://developer.android.com/reference/androidx/media3/common/Player#seekToDefaultPosition()` method must only be called if this command is `https://developer.android.com/reference/androidx/media3/common/Player#isCommandAvailable(int)`.

### COMMAND_SEEK_TO_MEDIA_ITEM

```
default static final int COMMAND_SEEK_TO_MEDIA_ITEM = 10
```

Command to seek anywhere in any `https://developer.android.com/reference/androidx/media3/common/MediaItem`.

The following methods must only be called if this command is `https://developer.android.com/reference/androidx/media3/common/Player#isCommandAvailable(int)`:

- `https://developer.android.com/reference/androidx/media3/common/Player#seekTo(int,long)`
- `https://developer.android.com/reference/androidx/media3/common/Player#seekToDefaultPosition(int)`

### COMMAND_SEEK_TO_NEXT

```
default static final int 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`.

The `https://developer.android.com/reference/androidx/media3/common/Player#seekToNext()` method must only be called if this command is `https://developer.android.com/reference/androidx/media3/common/Player#isCommandAvailable(int)`.

### COMMAND_SEEK_TO_NEXT_MEDIA_ITEM

```
default static final int 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`.

The `https://developer.android.com/reference/androidx/media3/common/Player#seekToNextMediaItem()` method must only be called if this command is `https://developer.android.com/reference/androidx/media3/common/Player#isCommandAvailable(int)`.

### COMMAND_SEEK_TO_NEXT_WINDOW

```
@UnstableApi
default static final int COMMAND_SEEK_TO_NEXT_WINDOW = 8
```

> [!CAUTION]
> **This field is deprecated.**   
>
> Use `https://developer.android.com/reference/androidx/media3/common/Player#COMMAND_SEEK_TO_NEXT_MEDIA_ITEM()` instead.

### COMMAND_SEEK_TO_PREVIOUS

```
default static final int 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`.

The `https://developer.android.com/reference/androidx/media3/common/Player#seekToPrevious()` method must only be called if this command is `https://developer.android.com/reference/androidx/media3/common/Player#isCommandAvailable(int)`.

### COMMAND_SEEK_TO_PREVIOUS_MEDIA_ITEM

```
default static final int 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`.

The `https://developer.android.com/reference/androidx/media3/common/Player#seekToPreviousMediaItem()` method must only be called if this command is `https://developer.android.com/reference/androidx/media3/common/Player#isCommandAvailable(int)`.

### COMMAND_SEEK_TO_PREVIOUS_WINDOW

```
@UnstableApi
default static final int COMMAND_SEEK_TO_PREVIOUS_WINDOW = 6
```

> [!CAUTION]
> **This field is deprecated.**   
>
> Use `https://developer.android.com/reference/androidx/media3/common/Player#COMMAND_SEEK_TO_PREVIOUS_MEDIA_ITEM()` instead.

### COMMAND_SEEK_TO_WINDOW

```
@UnstableApi
default static final int COMMAND_SEEK_TO_WINDOW = 10
```

> [!CAUTION]
> **This field is deprecated.**   
>
> Use `https://developer.android.com/reference/androidx/media3/common/Player#COMMAND_SEEK_TO_MEDIA_ITEM()` instead.

### COMMAND_SET_AUDIO_ATTRIBUTES

```
default static final int COMMAND_SET_AUDIO_ATTRIBUTES = 35
```

Command to set the player's audio attributes.

The `https://developer.android.com/reference/androidx/media3/common/Player#setAudioAttributes(androidx.media3.common.AudioAttributes,boolean)` method must only be called if this command is `https://developer.android.com/reference/androidx/media3/common/Player#isCommandAvailable(int)`.

### COMMAND_SET_DEVICE_VOLUME

```
default static final int COMMAND_SET_DEVICE_VOLUME = 25
```

> [!CAUTION]
> **This field is deprecated.**   
>
> Use `https://developer.android.com/reference/androidx/media3/common/Player#COMMAND_SET_DEVICE_VOLUME_WITH_FLAGS()` instead.

### COMMAND_SET_DEVICE_VOLUME_WITH_FLAGS

```
default static final int COMMAND_SET_DEVICE_VOLUME_WITH_FLAGS = 33
```

Command to set the device volume with volume flags.

The `https://developer.android.com/reference/androidx/media3/common/Player#setDeviceVolume(int,int)` method must only be called if this command is `https://developer.android.com/reference/androidx/media3/common/Player#isCommandAvailable(int)`.

### COMMAND_SET_MEDIA_ITEM

```
default static final int COMMAND_SET_MEDIA_ITEM = 31
```

Command to set a `https://developer.android.com/reference/androidx/media3/common/MediaItem`.

The following methods must only be called if this command is `https://developer.android.com/reference/androidx/media3/common/Player#isCommandAvailable(int)`:

- `https://developer.android.com/reference/androidx/media3/common/Player#setMediaItem(androidx.media3.common.MediaItem)`
- `https://developer.android.com/reference/androidx/media3/common/Player#setMediaItem(androidx.media3.common.MediaItem,boolean)`
- `https://developer.android.com/reference/androidx/media3/common/Player#setMediaItem(androidx.media3.common.MediaItem,long)`

### COMMAND_SET_MEDIA_ITEMS_METADATA

```
default static final int COMMAND_SET_MEDIA_ITEMS_METADATA = 19
```

> [!CAUTION]
> **This field is deprecated.**   
>
> Use `https://developer.android.com/reference/androidx/media3/common/Player#COMMAND_SET_PLAYLIST_METADATA()` instead.

### COMMAND_SET_PLAYLIST_METADATA

```
default static final int COMMAND_SET_PLAYLIST_METADATA = 19
```

Command to set the playlist metadata.

The `https://developer.android.com/reference/androidx/media3/common/Player#setPlaylistMetadata(androidx.media3.common.MediaMetadata)` method must only be called if this command is `https://developer.android.com/reference/androidx/media3/common/Player#isCommandAvailable(int)`.

### COMMAND_SET_REPEAT_MODE

```
default static final int COMMAND_SET_REPEAT_MODE = 15
```

Command to set the repeat mode.

The `https://developer.android.com/reference/androidx/media3/common/Player#setRepeatMode(int)` method must only be called if this command is `https://developer.android.com/reference/androidx/media3/common/Player#isCommandAvailable(int)`.

### COMMAND_SET_SHUFFLE_MODE

```
default static final int COMMAND_SET_SHUFFLE_MODE = 14
```

Command to enable shuffling.

The `https://developer.android.com/reference/androidx/media3/common/Player#setShuffleModeEnabled(boolean)` method must only be called if this command is `https://developer.android.com/reference/androidx/media3/common/Player#isCommandAvailable(int)`.

### COMMAND_SET_SPEED_AND_PITCH

```
default static final int COMMAND_SET_SPEED_AND_PITCH = 13
```

Command to set the playback speed and pitch.

The following methods must only be called if this command is `https://developer.android.com/reference/androidx/media3/common/Player#isCommandAvailable(int)`:

- `https://developer.android.com/reference/androidx/media3/common/Player#setPlaybackParameters(androidx.media3.common.PlaybackParameters)`
- `https://developer.android.com/reference/androidx/media3/common/Player#setPlaybackSpeed(float)`

### COMMAND_SET_TRACK_SELECTION_PARAMETERS

```
default static final int COMMAND_SET_TRACK_SELECTION_PARAMETERS = 29
```

Command to set the player's track selection parameters.

The `https://developer.android.com/reference/androidx/media3/common/Player#setTrackSelectionParameters(androidx.media3.common.TrackSelectionParameters)` method must only be called if this command is `https://developer.android.com/reference/androidx/media3/common/Player#isCommandAvailable(int)`.

### COMMAND_SET_VIDEO_SURFACE

```
default static final int COMMAND_SET_VIDEO_SURFACE = 27
```

Command to set and clear the surface on which to render the video.

The following methods must only be called if this command is `https://developer.android.com/reference/androidx/media3/common/Player#isCommandAvailable(int)`:

- `https://developer.android.com/reference/androidx/media3/common/Player#setVideoSurface(android.view.Surface)`
- `https://developer.android.com/reference/androidx/media3/common/Player#clearVideoSurface()`
- `https://developer.android.com/reference/androidx/media3/common/Player#clearVideoSurface(android.view.Surface)`
- `https://developer.android.com/reference/androidx/media3/common/Player#setVideoSurfaceHolder(android.view.SurfaceHolder)`
- `https://developer.android.com/reference/androidx/media3/common/Player#clearVideoSurfaceHolder(android.view.SurfaceHolder)`
- `https://developer.android.com/reference/androidx/media3/common/Player#setVideoSurfaceView(android.view.SurfaceView)`
- `https://developer.android.com/reference/androidx/media3/common/Player#clearVideoSurfaceView(android.view.SurfaceView)`
- `https://developer.android.com/reference/androidx/media3/common/Player#setVideoTextureView(android.view.TextureView)`
- `https://developer.android.com/reference/androidx/media3/common/Player#clearVideoTextureView(android.view.TextureView)`

### COMMAND_SET_VOLUME

```
default static final int COMMAND_SET_VOLUME = 24
```

Command to set the player volume.

The `https://developer.android.com/reference/androidx/media3/common/Player#setVolume(float)` method must only be called if this command is `https://developer.android.com/reference/androidx/media3/common/Player#isCommandAvailable(int)`.

### COMMAND_STOP

```
default static final int COMMAND_STOP = 3
```

Command to stop playback.

The `https://developer.android.com/reference/androidx/media3/common/Player#stop()` method must only be called if this command is `https://developer.android.com/reference/androidx/media3/common/Player#isCommandAvailable(int)`.

### DISCONTINUITY_REASON_AUTO_TRANSITION

```
default static final int DISCONTINUITY_REASON_AUTO_TRANSITION = 0
```

Automatic playback transition from one period in the timeline to the next. The period index may be the same as it was before the discontinuity in case the current period is repeated.

This reason also indicates an automatic transition from the content period to an inserted ad period or vice versa. Or a transition caused by another player (e.g. multiple controllers can control the same playback on a remote device).

### DISCONTINUITY_REASON_INTERNAL

```
default static final int DISCONTINUITY_REASON_INTERNAL = 5
```

Discontinuity introduced internally (e.g. by the source).

### DISCONTINUITY_REASON_REMOVE

```
default static final int DISCONTINUITY_REASON_REMOVE = 4
```

Discontinuity caused by the removal of the current period from the `https://developer.android.com/reference/androidx/media3/common/Timeline`.

### DISCONTINUITY_REASON_SEEK

```
default static final int DISCONTINUITY_REASON_SEEK = 1
```

Seek within the current period or to another period.

### DISCONTINUITY_REASON_SEEK_ADJUSTMENT

```
default static final int 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.

### DISCONTINUITY_REASON_SILENCE_SKIP

```
default static final int DISCONTINUITY_REASON_SILENCE_SKIP = 6
```

Discontinuity introduced by a skipped silence.

### DISCONTINUITY_REASON_SKIP

```
default static final int DISCONTINUITY_REASON_SKIP = 3
```

Discontinuity introduced by a skipped period (for instance a skipped ad).

### EVENT_AUDIO_ATTRIBUTES_CHANGED

```
default static final int EVENT_AUDIO_ATTRIBUTES_CHANGED = 20
```

`https://developer.android.com/reference/androidx/media3/common/Player#getAudioAttributes()` changed.

### EVENT_AUDIO_SESSION_ID

```
default static final int EVENT_AUDIO_SESSION_ID = 21
```

The audio session id was set.

### EVENT_AVAILABLE_COMMANDS_CHANGED

```
default static final int 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`.

### EVENT_CUES

```
default static final int EVENT_CUES = 27
```

`https://developer.android.com/reference/androidx/media3/common/Player#getCurrentCues()` changed.

### EVENT_DEVICE_INFO_CHANGED

```
default static final int EVENT_DEVICE_INFO_CHANGED = 29
```

`https://developer.android.com/reference/androidx/media3/common/Player#getDeviceInfo()` changed.

### EVENT_DEVICE_VOLUME_CHANGED

```
default static final int 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.

### EVENT_IS_LOADING_CHANGED

```
default static final int EVENT_IS_LOADING_CHANGED = 3
```

`https://developer.android.com/reference/androidx/media3/common/Player#isLoading()` ()} changed.

### EVENT_IS_PLAYING_CHANGED

```
default static final int EVENT_IS_PLAYING_CHANGED = 7
```

`https://developer.android.com/reference/androidx/media3/common/Player#isPlaying()` changed.

### EVENT_MAX_SEEK_TO_PREVIOUS_POSITION_CHANGED

```
default static final int EVENT_MAX_SEEK_TO_PREVIOUS_POSITION_CHANGED = 18
```

`https://developer.android.com/reference/androidx/media3/common/Player#getMaxSeekToPreviousPosition()` changed.

### EVENT_MEDIA_ITEM_TRANSITION

```
default static final int EVENT_MEDIA_ITEM_TRANSITION = 1
```

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

### EVENT_MEDIA_METADATA_CHANGED

```
default static final int EVENT_MEDIA_METADATA_CHANGED = 14
```

`https://developer.android.com/reference/androidx/media3/common/Player#getMediaMetadata()` changed.

### EVENT_METADATA

```
default static final int EVENT_METADATA = 28
```

Metadata associated with the current playback time changed.

### EVENT_PLAYBACK_PARAMETERS_CHANGED

```
default static final int EVENT_PLAYBACK_PARAMETERS_CHANGED = 12
```

`https://developer.android.com/reference/androidx/media3/common/Player#getPlaybackParameters()` changed.

### EVENT_PLAYBACK_STATE_CHANGED

```
default static final int EVENT_PLAYBACK_STATE_CHANGED = 4
```

`https://developer.android.com/reference/androidx/media3/common/Player#getPlaybackState()` changed.

### EVENT_PLAYBACK_SUPPRESSION_REASON_CHANGED

```
default static final int EVENT_PLAYBACK_SUPPRESSION_REASON_CHANGED = 6
```

`https://developer.android.com/reference/androidx/media3/common/Player#getPlaybackSuppressionReason()` changed.

### EVENT_PLAYER_ERROR

```
default static final int EVENT_PLAYER_ERROR = 10
```

`https://developer.android.com/reference/androidx/media3/common/Player#getPlayerError()` changed.

### EVENT_PLAYLIST_METADATA_CHANGED

```
default static final int EVENT_PLAYLIST_METADATA_CHANGED = 15
```

`https://developer.android.com/reference/androidx/media3/common/Player#getPlaylistMetadata()` changed.

### EVENT_PLAY_WHEN_READY_CHANGED

```
default static final int EVENT_PLAY_WHEN_READY_CHANGED = 5
```

`https://developer.android.com/reference/androidx/media3/common/Player#getPlayWhenReady()` changed.

### EVENT_POSITION_DISCONTINUITY

```
default static final int EVENT_POSITION_DISCONTINUITY = 11
```

A position discontinuity occurred. See `https://developer.android.com/reference/androidx/media3/common/Player.Listener#onPositionDiscontinuity(androidx.media3.common.Player.PositionInfo,androidx.media3.common.Player.PositionInfo,int)`.

### EVENT_RENDERED_FIRST_FRAME

```
default static final int 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.

### EVENT_REPEAT_MODE_CHANGED

```
default static final int EVENT_REPEAT_MODE_CHANGED = 8
```

`https://developer.android.com/reference/androidx/media3/common/Player#getRepeatMode()` changed.

### EVENT_SEEK_BACK_INCREMENT_CHANGED

```
default static final int EVENT_SEEK_BACK_INCREMENT_CHANGED = 16
```

`https://developer.android.com/reference/androidx/media3/common/Player#getSeekBackIncrement()` changed.

### EVENT_SEEK_FORWARD_INCREMENT_CHANGED

```
default static final int EVENT_SEEK_FORWARD_INCREMENT_CHANGED = 17
```

`https://developer.android.com/reference/androidx/media3/common/Player#getSeekForwardIncrement()` changed.

### EVENT_SHUFFLE_MODE_ENABLED_CHANGED

```
default static final int EVENT_SHUFFLE_MODE_ENABLED_CHANGED = 9
```

`https://developer.android.com/reference/androidx/media3/common/Player#getShuffleModeEnabled()` changed.

### EVENT_SKIP_SILENCE_ENABLED_CHANGED

```
default static final int EVENT_SKIP_SILENCE_ENABLED_CHANGED = 23
```

Skipping silences in the audio stream is enabled or disabled.

### EVENT_SURFACE_SIZE_CHANGED

```
default static final int EVENT_SURFACE_SIZE_CHANGED = 24
```

The size of the surface onto which the video is being rendered changed.

### EVENT_TIMELINE_CHANGED

```
default static final int EVENT_TIMELINE_CHANGED = 0
```

`https://developer.android.com/reference/androidx/media3/common/Player#getCurrentTimeline()` changed.

### EVENT_TRACKS_CHANGED

```
default static final int EVENT_TRACKS_CHANGED = 2
```

`https://developer.android.com/reference/androidx/media3/common/Player#getCurrentTracks()` changed.

### EVENT_TRACK_SELECTION_PARAMETERS_CHANGED

```
default static final int EVENT_TRACK_SELECTION_PARAMETERS_CHANGED = 19
```

`https://developer.android.com/reference/androidx/media3/common/Player#getTrackSelectionParameters()` changed.

### EVENT_VIDEO_SIZE_CHANGED

```
default static final int EVENT_VIDEO_SIZE_CHANGED = 25
```

`https://developer.android.com/reference/androidx/media3/common/Player#getVideoSize()` changed.

### EVENT_VOLUME_CHANGED

```
default static final int EVENT_VOLUME_CHANGED = 22
```

`https://developer.android.com/reference/androidx/media3/common/Player#getVolume()` changed.

### MEDIA_ITEM_TRANSITION_REASON_AUTO

```
default static final int MEDIA_ITEM_TRANSITION_REASON_AUTO = 1
```

Playback has automatically transitioned to the next media item.

This reason also indicates a transition caused by another player (e.g. multiple controllers can control the same playback on a remote device).

### MEDIA_ITEM_TRANSITION_REASON_PLAYLIST_CHANGED

```
default static final int MEDIA_ITEM_TRANSITION_REASON_PLAYLIST_CHANGED = 3
```

The current media item has changed because of a change in the playlist. This can either be if the media item previously being played has been removed, or when the playlist becomes non-empty after being empty.

### MEDIA_ITEM_TRANSITION_REASON_REPEAT

```
default static final int MEDIA_ITEM_TRANSITION_REASON_REPEAT = 0
```

The media item has been repeated.

### MEDIA_ITEM_TRANSITION_REASON_SEEK

```
default static final int MEDIA_ITEM_TRANSITION_REASON_SEEK = 2
```

A seek to another media item has occurred.

### PLAYBACK_SUPPRESSION_REASON_NONE

```
default static final int PLAYBACK_SUPPRESSION_REASON_NONE = 0
```

Playback is not suppressed.

### PLAYBACK_SUPPRESSION_REASON_SCRUBBING

```
default static final int PLAYBACK_SUPPRESSION_REASON_SCRUBBING = 4
```

Playback is suppressed because the player is currently scrubbing.

### PLAYBACK_SUPPRESSION_REASON_TRANSIENT_AUDIO_FOCUS_LOSS

```
default static final int PLAYBACK_SUPPRESSION_REASON_TRANSIENT_AUDIO_FOCUS_LOSS = 1
```

Playback is suppressed due to transient audio focus loss.

### PLAYBACK_SUPPRESSION_REASON_UNSUITABLE_AUDIO_OUTPUT

```
default static final int 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).

### PLAYBACK_SUPPRESSION_REASON_UNSUITABLE_AUDIO_ROUTE

```
default static final int PLAYBACK_SUPPRESSION_REASON_UNSUITABLE_AUDIO_ROUTE = 2
```

> [!CAUTION]
> **This field is deprecated.**   
>
> Use `https://developer.android.com/reference/androidx/media3/common/Player#PLAYBACK_SUPPRESSION_REASON_UNSUITABLE_AUDIO_OUTPUT()` instead.

### PLAY_WHEN_READY_CHANGE_REASON_AUDIO_BECOMING_NOISY

```
default static final int PLAY_WHEN_READY_CHANGE_REASON_AUDIO_BECOMING_NOISY = 3
```

Playback has been paused to avoid becoming noisy.

### PLAY_WHEN_READY_CHANGE_REASON_AUDIO_FOCUS_LOSS

```
default static final int PLAY_WHEN_READY_CHANGE_REASON_AUDIO_FOCUS_LOSS = 2
```

Playback has been paused because of a loss of audio focus.

### PLAY_WHEN_READY_CHANGE_REASON_END_OF_MEDIA_ITEM

```
default static final int PLAY_WHEN_READY_CHANGE_REASON_END_OF_MEDIA_ITEM = 5
```

Playback has been paused at the end of a media item.

### PLAY_WHEN_READY_CHANGE_REASON_REMOTE

```
default static final int PLAY_WHEN_READY_CHANGE_REASON_REMOTE = 4
```

Playback has been started or paused because of a remote change.

### PLAY_WHEN_READY_CHANGE_REASON_SUPPRESSED_TOO_LONG

```
default static final int 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.

### PLAY_WHEN_READY_CHANGE_REASON_USER_REQUEST

```
default static final int 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)`.

### REPEAT_MODE_ALL

```
default static final int REPEAT_MODE_ALL = 2
```

Repeats the entire timeline infinitely. "Previous" and "Next" actions behave as they do in `https://developer.android.com/reference/androidx/media3/common/Player#REPEAT_MODE_OFF()`, but with looping at the ends so that "Previous" when playing the first `https://developer.android.com/reference/androidx/media3/common/MediaItem` will move to the last `https://developer.android.com/reference/androidx/media3/common/MediaItem`, and "Next" when playing the last `https://developer.android.com/reference/androidx/media3/common/MediaItem` will move to the first `https://developer.android.com/reference/androidx/media3/common/MediaItem`.

### REPEAT_MODE_OFF

```
default static final int REPEAT_MODE_OFF = 0
```

Normal playback without repetition. "Previous" and "Next" actions move to the previous and next `https://developer.android.com/reference/androidx/media3/common/MediaItem` respectively, and do nothing when there is no previous or next `https://developer.android.com/reference/androidx/media3/common/MediaItem` to move to.

### REPEAT_MODE_ONE

```
default static final int REPEAT_MODE_ONE = 1
```

Repeats the currently playing `https://developer.android.com/reference/androidx/media3/common/MediaItem` infinitely during ongoing playback. "Previous" and "Next" actions behave as they do in `https://developer.android.com/reference/androidx/media3/common/Player#REPEAT_MODE_OFF()`, moving to the previous and next `https://developer.android.com/reference/androidx/media3/common/MediaItem` respectively, and doing nothing when there is no previous or next `https://developer.android.com/reference/androidx/media3/common/MediaItem` to move to.

### STATE_BUFFERING

```
default static final int STATE_BUFFERING = 2
```

The player is not able to immediately play the media, but is doing work toward being able to do so. This state typically occurs when the player needs to buffer more data before playback can start.

### STATE_ENDED

```
default static final int STATE_ENDED = 4
```

The player has finished playing the media.

### STATE_IDLE

```
default static final int STATE_IDLE = 1
```

The player is idle, meaning it holds only limited resources. The player must be `https://developer.android.com/reference/androidx/media3/common/Player#prepare()` before it will play the media.

### STATE_READY

```
default static final int STATE_READY = 3
```

The player is able to immediately play from its current position. The player will be playing if `https://developer.android.com/reference/androidx/media3/common/Player#getPlayWhenReady()` is true, and paused otherwise.

### TIMELINE_CHANGE_REASON_PLAYLIST_CHANGED

```
default static final int TIMELINE_CHANGE_REASON_PLAYLIST_CHANGED = 0
```

Timeline changed as a result of a change of the playlist items or the order of the items.

### TIMELINE_CHANGE_REASON_SOURCE_UPDATE

```
default static final int 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).

This reason also indicates a change caused by another player (e.g. multiple controllers can control the same playback on the remote device).

## Public methods

### addListener

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

### addMediaItem

```
abstract void addMediaItem(MediaItem mediaItem)
```

Adds a media item to the end 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 |
|---|---|
| `https://developer.android.com/reference/androidx/media3/common/MediaItem mediaItem` | The `https://developer.android.com/reference/androidx/media3/common/MediaItem` to add. |

### addMediaItem

```
abstract void addMediaItem(int index, MediaItem mediaItem)
```

Adds a media item 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 item. If the index is larger than the size of the playlist, the media item is added to the end of the playlist. |
| `https://developer.android.com/reference/androidx/media3/common/MediaItem mediaItem` | The `https://developer.android.com/reference/androidx/media3/common/MediaItem` to add. |

### addMediaItems

```
abstract void addMediaItems(List<MediaItem> mediaItems)
```

Adds a list of media items to the end 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 |
|---|---|
| `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. |

### addMediaItems

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

### canAdvertiseSession

```
abstract boolean canAdvertiseSession()
```

Returns whether the player can be used to advertise a media session.

### clearMediaItems

```
abstract void clearMediaItems()
```

Clears 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()`.

### clearVideoSurface

```
abstract void clearVideoSurface()
```

Clears any `https://developer.android.com/reference/android/view/Surface.html`, `https://developer.android.com/reference/android/view/SurfaceHolder.html`, `https://developer.android.com/reference/android/view/SurfaceView.html` or `https://developer.android.com/reference/android/view/TextureView.html` currently set on the player.

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

### clearVideoSurface

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

Clears the `https://developer.android.com/reference/android/view/Surface.html` onto which video is being rendered if it matches the one passed. Else does nothing.

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

| Parameters |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/Nullable https://developer.android.com/reference/android/view/Surface.html surface` | The surface to clear. |

### clearVideoSurfaceHolder

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

Clears the `https://developer.android.com/reference/android/view/SurfaceHolder.html` that holds the `https://developer.android.com/reference/android/view/Surface.html` onto which video is being rendered if it matches the one passed. Else does nothing.

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

| Parameters |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/Nullable https://developer.android.com/reference/android/view/SurfaceHolder.html surfaceHolder` | The surface holder to clear. |

### clearVideoSurfaceView

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

Clears the `https://developer.android.com/reference/android/view/SurfaceView.html` onto which video is being rendered if it matches the one passed. Else does nothing.

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

| Parameters |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/Nullable https://developer.android.com/reference/android/view/SurfaceView.html surfaceView` | The texture view to clear. |

### clearVideoTextureView

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

Clears the `https://developer.android.com/reference/android/view/TextureView.html` onto which video is being rendered if it matches the one passed. Else does nothing.

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

| Parameters |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/Nullable https://developer.android.com/reference/android/view/TextureView.html textureView` | The texture view to clear. |

### decreaseDeviceVolume

```
abstract void [decreaseDeviceVolume](https://developer.android.com/reference/androidx/media3/common/Player#decreaseDeviceVolume())()
```

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

### decreaseDeviceVolume

```
abstract 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

```
abstract 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

```
abstract AudioAttributes getAudioAttributes()
```

Returns the attributes for audio playback.

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

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

### getAudioSessionId

```
@UnstableApi
default int getAudioSessionId()
```

Returns the audio session identifier, or `https://developer.android.com/reference/androidx/media3/common/C#AUDIO_SESSION_ID_UNSET()` if not set.

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

### getAvailableCommands

```
abstract 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)` |   |

### getBufferedPercentage

```
abstract @IntRange(from = 0, to = 100) int 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.

### getBufferedPosition

```
abstract 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

```
abstract 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()`.

### getContentDuration

```
abstract long 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. If there is no ad playing, the returned duration is the same as that returned by `https://developer.android.com/reference/androidx/media3/common/Player#getDuration()`.

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

```
abstract 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

```
abstract 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

```
abstract 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

```
abstract CueGroup getCurrentCues()
```

Returns the current `https://developer.android.com/reference/androidx/media3/common/text/CueGroup`.

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

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

### getCurrentLiveOffset

```
abstract long 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.

The offset is calculated as `currentTime - playbackPosition`, so should usually be positive.

Note that this offset may rely on an accurate local time, so this method may return an incorrect value if the difference between system clock and server clock is unknown.

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()`.

### getCurrentManifest

```
@UnstableApi
abstract @Nullable Object getCurrentManifest()
```

Returns the current manifest. The type depends on the type of media being played. May be null.

### getCurrentMediaItem

```
abstract @Nullable MediaItem getCurrentMediaItem()
```

Returns the currently playing `https://developer.android.com/reference/androidx/media3/common/MediaItem`. May be null if the timeline 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()`.

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

### getCurrentMediaItemIndex

```
abstract 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

```
abstract 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

```
abstract 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

```
abstract 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

```
abstract 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)` |   |

### getCurrentWindowIndex

```
@UnstableApi
abstract int [getCurrentWindowIndex](https://developer.android.com/reference/androidx/media3/common/Player#getCurrentWindowIndex())()
```

> [!CAUTION]
> **This method is deprecated.**   
>
> Use `https://developer.android.com/reference/androidx/media3/common/Player#getCurrentMediaItemIndex()` instead.

### getDeviceInfo

```
abstract DeviceInfo getDeviceInfo()
```

Gets the device information.

### getDeviceVolume

```
abstract @IntRange(from = 0) 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

```
abstract 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()`.

### getMaxSeekToPreviousPosition

```
abstract 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)` |   |

### getMediaItemAt

```
abstract MediaItem getMediaItemAt(int index)
```

Returns the `https://developer.android.com/reference/androidx/media3/common/MediaItem` at the given index.

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()`.

### getMediaItemCount

```
abstract int getMediaItemCount()
```

Returns the number of `https://developer.android.com/reference/androidx/media3/common/MediaItem` in the playlist.

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()`.

### getMediaMetadata

```
abstract 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)` |   |

### getNextMediaItemIndex

```
abstract int 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. Returns `https://developer.android.com/reference/androidx/media3/common/C#INDEX_UNSET()` if `https://developer.android.com/reference/androidx/media3/common/Player#hasNextMediaItem()` is ` false`.

Note: When the repeat mode is `https://developer.android.com/reference/androidx/media3/common/Player#REPEAT_MODE_ONE()`, this method behaves the same as when the current repeat mode is `https://developer.android.com/reference/androidx/media3/common/Player#REPEAT_MODE_OFF()`. See `https://developer.android.com/reference/androidx/media3/common/Player#REPEAT_MODE_ONE()` for more details.

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()`.

### getNextWindowIndex

```
@UnstableApi
abstract int [getNextWindowIndex](https://developer.android.com/reference/androidx/media3/common/Player#getNextWindowIndex())()
```

> [!CAUTION]
> **This method is deprecated.**   
>
> Use `https://developer.android.com/reference/androidx/media3/common/Player#getNextMediaItemIndex()` instead.

### getPlayWhenReady

```
abstract 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

```
abstract 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
abstract 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
abstract 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

```
abstract @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

```
abstract 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)` |   |

### getPreviousMediaItemIndex

```
abstract int 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. Returns `https://developer.android.com/reference/androidx/media3/common/C#INDEX_UNSET()` if `https://developer.android.com/reference/androidx/media3/common/Player#hasPreviousMediaItem()` is `false`.

Note: When the repeat mode is `https://developer.android.com/reference/androidx/media3/common/Player#REPEAT_MODE_ONE()`, this method behaves the same as when the current repeat mode is `https://developer.android.com/reference/androidx/media3/common/Player#REPEAT_MODE_OFF()`. See `https://developer.android.com/reference/androidx/media3/common/Player#REPEAT_MODE_ONE()` for more details.

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()`.

### getPreviousWindowIndex

```
@UnstableApi
abstract int [getPreviousWindowIndex](https://developer.android.com/reference/androidx/media3/common/Player#getPreviousWindowIndex())()
```

> [!CAUTION]
> **This method is deprecated.**   
>
> Use `https://developer.android.com/reference/androidx/media3/common/Player#getPreviousMediaItemIndex()` instead.

### getRepeatMode

```
@Player.RepeatMode
abstract 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

```
abstract 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

```
abstract 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

```
abstract 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

```
@UnstableApi
abstract Size getSurfaceSize()
```

Gets the size of the surface on which the video is rendered.

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

### getTotalBufferedDuration

```
abstract 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

```
abstract 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

```
abstract VideoSize getVideoSize()
```

Gets the size of the video.

The video's width and height are `0` if there is `https://developer.android.com/reference/androidx/media3/common/Tracks#isTypeSupported(int)` or its size has not been determined yet.

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

### getVolume

```
abstract @FloatRange(from = 0, to = 1.0) 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 |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/FloatRange(from = 0, to = 1.0) float` | The linear gain applied to all audio channels. |

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

### hasNextMediaItem

```
abstract boolean 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.

Note: When the repeat mode is `https://developer.android.com/reference/androidx/media3/common/Player#REPEAT_MODE_ONE()`, this method behaves the same as when the current repeat mode is `https://developer.android.com/reference/androidx/media3/common/Player#REPEAT_MODE_OFF()`. See `https://developer.android.com/reference/androidx/media3/common/Player#REPEAT_MODE_ONE()` for more details.

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()`.

### hasPreviousMediaItem

```
abstract boolean hasPreviousMediaItem()
```

Returns whether a previous media item exists, which may depend on the current repeat mode and whether shuffle mode is enabled.

Note: When the repeat mode is `https://developer.android.com/reference/androidx/media3/common/Player#REPEAT_MODE_ONE()`, this method behaves the same as when the current repeat mode is `https://developer.android.com/reference/androidx/media3/common/Player#REPEAT_MODE_OFF()`. See `https://developer.android.com/reference/androidx/media3/common/Player#REPEAT_MODE_ONE()` for more details.

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()`.

### increaseDeviceVolume

```
abstract void [increaseDeviceVolume](https://developer.android.com/reference/androidx/media3/common/Player#increaseDeviceVolume())()
```

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

### increaseDeviceVolume

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

### isCommandAvailable

```
abstract boolean isCommandAvailable(@Player.Command int command)
```

Returns whether the provided `https://developer.android.com/reference/androidx/media3/common/Player.Command` is available.

This method does not execute the command.

| Parameters |
|---|---|
| `@https://developer.android.com/reference/androidx/media3/common/Player.Command int command` | A `https://developer.android.com/reference/androidx/media3/common/Player.Command`. |

| Returns |
|---|---|
| `boolean` | Whether the `https://developer.android.com/reference/androidx/media3/common/Player.Command` is available. |

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

### isCurrentMediaItemDynamic

```
abstract boolean 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.

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()`.

| See also |
|---|---|
| `https://developer.android.com/reference/androidx/media3/common/Timeline.Window#isDynamic()` |   |

### isCurrentMediaItemLive

```
abstract boolean 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.

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()`.

| See also |
|---|---|
| `https://developer.android.com/reference/androidx/media3/common/Timeline.Window#isLive()` |   |

### isCurrentMediaItemSeekable

```
abstract boolean 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.

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()`.

| See also |
|---|---|
| `https://developer.android.com/reference/androidx/media3/common/Timeline.Window#isSeekable()` |   |

### isCurrentWindowDynamic

```
@UnstableApi
abstract boolean [isCurrentWindowDynamic](https://developer.android.com/reference/androidx/media3/common/Player#isCurrentWindowDynamic())()
```

> [!CAUTION]
> **This method is deprecated.**   
>
> Use `https://developer.android.com/reference/androidx/media3/common/Player#isCurrentMediaItemDynamic()` instead.

### isCurrentWindowLive

```
@UnstableApi
abstract boolean [isCurrentWindowLive](https://developer.android.com/reference/androidx/media3/common/Player#isCurrentWindowLive())()
```

> [!CAUTION]
> **This method is deprecated.**   
>
> Use `https://developer.android.com/reference/androidx/media3/common/Player#isCurrentMediaItemLive()` instead.

### isCurrentWindowSeekable

```
@UnstableApi
abstract boolean [isCurrentWindowSeekable](https://developer.android.com/reference/androidx/media3/common/Player#isCurrentWindowSeekable())()
```

> [!CAUTION]
> **This method is deprecated.**   
>
> Use `https://developer.android.com/reference/androidx/media3/common/Player#isCurrentMediaItemSeekable()` instead.

### isDeviceMuted

```
abstract 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

```
abstract 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)` |   |

### isPlaying

```
abstract boolean isPlaying()
```

Returns whether the player is playing, i.e. `https://developer.android.com/reference/androidx/media3/common/Player#getCurrentPosition()` is advancing.

If `false`, then at least one of the following is true:

- The `https://developer.android.com/reference/androidx/media3/common/Player#getPlaybackState()` is not `https://developer.android.com/reference/androidx/media3/common/Player#STATE_READY()`.
- There is no `https://developer.android.com/reference/androidx/media3/common/Player#getPlayWhenReady()`.
- Playback is `https://developer.android.com/reference/androidx/media3/common/Player#getPlaybackSuppressionReason()`.

| Returns |
|---|---|
| `boolean` | Whether the player is playing. |

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

### isPlayingAd

```
abstract 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()`.

### moveMediaItem

```
abstract void moveMediaItem(int currentIndex, int newIndex)
```

Moves the media item at the current index 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 currentIndex` | The current index of the media item to move. If the index is larger than the size of the playlist, the request is ignored. |
| `int newIndex` | The new index of the media item. If the new index is larger than the size of the playlist the item is moved to the end of the playlist. |

### moveMediaItems

```
abstract 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

```
abstract 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()`.

### pause

```
abstract void pause()
```

Pauses playback. Equivalent to `https://developer.android.com/reference/androidx/media3/common/Player#setPlayWhenReady(boolean)`.

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()`.

### play

```
abstract void 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()`. Equivalent to `https://developer.android.com/reference/androidx/media3/common/Player#setPlayWhenReady(boolean)`.

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()`.

### prepare

```
abstract 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

```
abstract 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

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

### removeMediaItem

```
abstract void removeMediaItem(int index)
```

Removes the media item 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 remove the media item. If the index is larger than the size of the playlist, the request is ignored. |

### removeMediaItems

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

### replaceMediaItem

```
abstract void replaceMediaItem(int index, MediaItem mediaItem)
```

Replaces the media item at the given index 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()`.

| Parameters |
|---|---|
| `int index` | The index at which to replace the media item. If the index is larger than the size of the playlist, the request is ignored. |
| `https://developer.android.com/reference/androidx/media3/common/MediaItem mediaItem` | The new `https://developer.android.com/reference/androidx/media3/common/MediaItem`. |

### replaceMediaItems

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

### seekBack

```
abstract void 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.

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

### seekForward

```
abstract void 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.

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

### seekTo

```
abstract void seekTo(long positionMs)
```

Seeks to a position specified in milliseconds in the current `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_SEEK_IN_CURRENT_MEDIA_ITEM()` is `https://developer.android.com/reference/androidx/media3/common/Player#getAvailableCommands()`.

| Parameters |
|---|---|
| `long positionMs` | The seek position in the current `https://developer.android.com/reference/androidx/media3/common/MediaItem`, or `https://developer.android.com/reference/androidx/media3/common/C#TIME_UNSET()` to seek to the media item's default position. |

### seekTo

```
abstract void seekTo(int mediaItemIndex, long positionMs)
```

Seeks to a position specified in milliseconds in the specified `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_SEEK_TO_MEDIA_ITEM()` is `https://developer.android.com/reference/androidx/media3/common/Player#getAvailableCommands()`.

| Parameters |
|---|---|
| `int mediaItemIndex` | The index of the `https://developer.android.com/reference/androidx/media3/common/MediaItem`. If the index is larger than the size of the playlist, the request is ignored. |
| `long positionMs` | The seek position in the specified `https://developer.android.com/reference/androidx/media3/common/MediaItem`, or `https://developer.android.com/reference/androidx/media3/common/C#TIME_UNSET()` to seek to the media item's default position. |

### seekToDefaultPosition

```
abstract void seekToDefaultPosition()
```

Seeks to the default position associated with the current `https://developer.android.com/reference/androidx/media3/common/MediaItem`. The position can depend on the type of media being played. For live streams it will typically be the live edge. For other streams it will typically be the start.

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

### seekToDefaultPosition

```
abstract void seekToDefaultPosition(int mediaItemIndex)
```

Seeks to the default position associated with the specified `https://developer.android.com/reference/androidx/media3/common/MediaItem`. The position can depend on the type of media being played. For live streams it will typically be the live edge. For other streams it will typically be the start.

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

| Parameters |
|---|---|
| `int mediaItemIndex` | The index of the `https://developer.android.com/reference/androidx/media3/common/MediaItem` whose associated default position should be seeked to. If the index is larger than the size of the playlist, the request is ignored. |

### seekToNext

```
abstract void seekToNext()
```

Seeks to a later position in the current or next `https://developer.android.com/reference/androidx/media3/common/MediaItem` (if available). More precisely:

- If the timeline is empty or seeking is not possible, does nothing.
- Otherwise, if `https://developer.android.com/reference/androidx/media3/common/Player#hasNextMediaItem()`, seeks to the default position of the next `https://developer.android.com/reference/androidx/media3/common/MediaItem`.
- Otherwise, if the current `https://developer.android.com/reference/androidx/media3/common/MediaItem` is `https://developer.android.com/reference/androidx/media3/common/Player#isCurrentMediaItemLive()` and has not ended, seeks to the live edge of the current `https://developer.android.com/reference/androidx/media3/common/MediaItem`.
- Otherwise, does nothing.

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

### seekToNextMediaItem

```
abstract void 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. Does nothing if `https://developer.android.com/reference/androidx/media3/common/Player#hasNextMediaItem()` is `false`.

Note: When the repeat mode is `https://developer.android.com/reference/androidx/media3/common/Player#REPEAT_MODE_ONE()`, this method behaves the same as when the current repeat mode is `https://developer.android.com/reference/androidx/media3/common/Player#REPEAT_MODE_OFF()`. See `https://developer.android.com/reference/androidx/media3/common/Player#REPEAT_MODE_ONE()` for more details.

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

### seekToPrevious

```
abstract void seekToPrevious()
```

Seeks to an earlier position in the current or previous `https://developer.android.com/reference/androidx/media3/common/MediaItem` (if available). More precisely:

- If the timeline is empty or seeking is not possible, does nothing.
- Otherwise, if the current `https://developer.android.com/reference/androidx/media3/common/MediaItem` is `https://developer.android.com/reference/androidx/media3/common/Player#isCurrentMediaItemLive()` and `https://developer.android.com/reference/androidx/media3/common/Player#isCurrentMediaItemSeekable()`, then:
  - If `https://developer.android.com/reference/androidx/media3/common/Player#hasPreviousMediaItem()`, seeks to the default position of the previous media item.
  - Otherwise, does nothing.
- Otherwise, if `https://developer.android.com/reference/androidx/media3/common/Player#hasPreviousMediaItem()` and the `https://developer.android.com/reference/androidx/media3/common/Player#getCurrentPosition()` is less than `https://developer.android.com/reference/androidx/media3/common/Player#getMaxSeekToPreviousPosition()`, seeks to the default position of the previous `https://developer.android.com/reference/androidx/media3/common/MediaItem`.
- Otherwise, seeks to 0 in the current `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_SEEK_TO_PREVIOUS()` is `https://developer.android.com/reference/androidx/media3/common/Player#getAvailableCommands()`.

### seekToPreviousMediaItem

```
abstract void 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. Does nothing if `https://developer.android.com/reference/androidx/media3/common/Player#hasPreviousMediaItem()` is `false`.

Note: When the repeat mode is `https://developer.android.com/reference/androidx/media3/common/Player#REPEAT_MODE_ONE()`, this method behaves the same as when the current repeat mode is `https://developer.android.com/reference/androidx/media3/common/Player#REPEAT_MODE_OFF()`. See `https://developer.android.com/reference/androidx/media3/common/Player#REPEAT_MODE_ONE()` for more details.

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

### setAudioAttributes

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

Sets the attributes for audio playback, used by the underlying audio track. If not set, the default audio attributes will be used. They are suitable for general media playback.

Setting the audio attributes during playback may introduce a short gap in audio output as the audio track is recreated. A new audio session id will also be generated.

If tunneling is enabled by the track selector, the specified audio attributes will be ignored, but they will take effect if audio is later played without tunneling.

If audio focus should be handled, the `https://developer.android.com/reference/androidx/media3/common/AudioAttributes#usage()` must be `https://developer.android.com/reference/androidx/media3/common/C#USAGE_MEDIA()` or `https://developer.android.com/reference/androidx/media3/common/C#USAGE_GAME()`. Other usages will throw an `https://developer.android.com/reference/java/lang/IllegalArgumentException.html`.

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

| Parameters |
|---|---|
| `https://developer.android.com/reference/androidx/media3/common/AudioAttributes audioAttributes` | The attributes to use for audio playback. |
| `boolean handleAudioFocus` | True if the player should handle audio focus, false otherwise. |

### setDeviceMuted

```
abstract void [setDeviceMuted](https://developer.android.com/reference/androidx/media3/common/Player#setDeviceMuted(boolean))(boolean muted)
```

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

### setDeviceMuted

```
abstract 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

```
abstract void [setDeviceVolume](https://developer.android.com/reference/androidx/media3/common/Player#setDeviceVolume(int))(@IntRange(from = 0) int volume)
```

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

### setDeviceVolume

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

### setMediaItem

```
abstract void setMediaItem(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.

To replace a media item (possibly seamlessly) without clearing the playlist, use `https://developer.android.com/reference/androidx/media3/common/Player#replaceMediaItem(int,androidx.media3.common.MediaItem)`.

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

| Parameters |
|---|---|
| `https://developer.android.com/reference/androidx/media3/common/MediaItem mediaItem` | The new `https://developer.android.com/reference/androidx/media3/common/MediaItem`. |

### setMediaItem

```
abstract void setMediaItem(MediaItem mediaItem, boolean resetPosition)
```

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

To replace a media item (possibly seamlessly) without clearing the playlist, use `https://developer.android.com/reference/androidx/media3/common/Player#replaceMediaItem(int,androidx.media3.common.MediaItem)`.

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

| Parameters |
|---|---|
| `https://developer.android.com/reference/androidx/media3/common/MediaItem mediaItem` | The new `https://developer.android.com/reference/androidx/media3/common/MediaItem`. |
| `boolean resetPosition` | Whether the playback position should be reset to the default position. 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()`. |

### setMediaItem

```
abstract void setMediaItem(MediaItem mediaItem, long startPositionMs)
```

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

To replace a media item (possibly seamlessly) without clearing the playlist, use `https://developer.android.com/reference/androidx/media3/common/Player#replaceMediaItem(int,androidx.media3.common.MediaItem)`.

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

| Parameters |
|---|---|
| `https://developer.android.com/reference/androidx/media3/common/MediaItem mediaItem` | The new `https://developer.android.com/reference/androidx/media3/common/MediaItem`. |
| `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. |

### setMediaItems

```
abstract void setMediaItems(List<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.

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

### setMediaItems

```
abstract 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

```
abstract 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

```
abstract 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

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

### setPlaybackSpeed

```
abstract void setPlaybackSpeed(@FloatRange(from = 0, fromInclusive = false) float speed)
```

Changes the rate at which playback occurs. The pitch is not changed.

This is equivalent to ` setPlaybackParameters(getPlaybackParameters().withSpeed(speed))`.

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/annotation/FloatRange(from = 0, fromInclusive = false) float speed` | The linear factor by which playback will be sped up. Must be higher than 0. 1 is normal speed, 2 is twice as fast, 0.5 is half normal speed. |

### setPlaylistMetadata

```
abstract void setPlaylistMetadata(MediaMetadata mediaMetadata)
```

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

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

### setShuffleModeEnabled

```
abstract 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

```
abstract 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

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

Sets the `https://developer.android.com/reference/android/view/Surface.html` onto which video will be rendered. The caller is responsible for tracking the lifecycle of the surface, and must clear the surface by calling ` setVideoSurface(null)` if the surface is destroyed.

If the surface is held by a `https://developer.android.com/reference/android/view/SurfaceView.html`, `https://developer.android.com/reference/android/view/TextureView.html` or `https://developer.android.com/reference/android/view/SurfaceHolder.html` then it's recommended to use `https://developer.android.com/reference/androidx/media3/common/Player#setVideoSurfaceView(android.view.SurfaceView)`, `https://developer.android.com/reference/androidx/media3/common/Player#setVideoTextureView(android.view.TextureView)` or `https://developer.android.com/reference/androidx/media3/common/Player#setVideoSurfaceHolder(android.view.SurfaceHolder)` rather than this method, since passing the holder allows the player to track the lifecycle of the surface automatically.

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

| Parameters |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/Nullable https://developer.android.com/reference/android/view/Surface.html surface` | The `https://developer.android.com/reference/android/view/Surface.html`. |

### setVideoSurfaceHolder

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

Sets the `https://developer.android.com/reference/android/view/SurfaceHolder.html` that holds the `https://developer.android.com/reference/android/view/Surface.html` onto which video will be rendered. The player will track the lifecycle of the surface automatically.

The thread that calls the `https://developer.android.com/reference/android/view/SurfaceHolder.Callback.html` methods must be the thread associated with `https://developer.android.com/reference/androidx/media3/common/Player#getApplicationLooper()`.

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

| Parameters |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/Nullable https://developer.android.com/reference/android/view/SurfaceHolder.html surfaceHolder` | The surface holder. |

### setVideoSurfaceView

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

Sets the `https://developer.android.com/reference/android/view/SurfaceView.html` onto which video will be rendered. The player will track the lifecycle of the surface automatically.

The thread that calls the `https://developer.android.com/reference/android/view/SurfaceHolder.Callback.html` methods must be the thread associated with `https://developer.android.com/reference/androidx/media3/common/Player#getApplicationLooper()`.

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

| Parameters |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/Nullable https://developer.android.com/reference/android/view/SurfaceView.html surfaceView` | The surface view. |

### setVideoTextureView

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

Sets the `https://developer.android.com/reference/android/view/TextureView.html` onto which video will be rendered. The player will track the lifecycle of the surface automatically.

Consider using `https://developer.android.com/reference/android/view/SurfaceView.html` via `https://developer.android.com/reference/androidx/media3/common/Player#setVideoSurfaceView(android.view.SurfaceView)` instead of `https://developer.android.com/reference/android/view/TextureView.html`. `https://developer.android.com/reference/android/view/SurfaceView.html` generally causes lower battery consumption, and has better handling for HDR and secure content. See [Choosing a surface type](https://developer.android.com/guide/topics/media/ui/playerview#surfacetype) for more information.

The thread that calls the `https://developer.android.com/reference/android/view/TextureView.SurfaceTextureListener.html` methods must be the thread associated with `https://developer.android.com/reference/androidx/media3/common/Player#getApplicationLooper()`.

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

| Parameters |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/Nullable https://developer.android.com/reference/android/view/TextureView.html textureView` | The texture view. |

### setVolume

```
abstract void setVolume(@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.

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 |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/FloatRange(from = 0, to = 1.0) float volume` | Linear output gain to apply to all audio channels. |

### stop

```
abstract 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

```
abstract 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()`.

## Extension functions

### PlayerExtensionsKt.listen

Artifact: [androidx.media3:media3-common-ktx](https://developer.android.com/jetpack/androidx/releases/media3) [View Source](https://cs.android.com/search?q=file:androidx/media3/common/PlayerExtensions.kt+function:listen)

```
@UnstableApi
default final @NonNull Void PlayerExtensionsKt.listen(
    @NonNull Player receiver,
    @NonNull Function2<@NonNull Player, @NonNull Player.Events, Unit> onEvents
)
```

Continuously listens to the `https://developer.android.com/reference/androidx/media3/common/Player.Listener#onEvents(androidx.media3.common.Player,androidx.media3.common.Player.Events)` callback, passing the received `https://developer.android.com/reference/androidx/media3/common/Player.Events` to the provided `https://developer.android.com/reference/androidx/media3/common/package-summary#(androidx.media3.common.Player).listen(kotlin.Function2)` function.

This function can be called from any thread. The `https://developer.android.com/reference/androidx/media3/common/package-summary#(androidx.media3.common.Player).listen(kotlin.Function2)` function will be invoked on the thread associated with `https://developer.android.com/reference/androidx/media3/common/Player#getApplicationLooper()`.

If, during the execution of `https://developer.android.com/reference/androidx/media3/common/package-summary#(androidx.media3.common.Player).listen(kotlin.Function2)`, an exception is thrown, the coroutine corresponding to listening to the Player will be terminated. Any used resources will be cleaned up (e.g. removing of the listeners) and exception will be re-thrown right after the last suspension point.

| Parameters |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/NonNull Function2<@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/media3/common/Player, @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/media3/common/Player.Events, https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html> onEvents` | The function to handle player events. |

| Returns |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/lang/Void.html` | Nothing This function never returns normally. It will either continue indefinitely or terminate due to an exception or cancellation. |

### PlayerExtensionsKt.listenTo

Artifact: [androidx.media3:media3-common-ktx](https://developer.android.com/jetpack/androidx/releases/media3) [View Source](https://cs.android.com/search?q=file:androidx/media3/common/PlayerExtensions.kt+function:listenTo)

```
@UnstableApi
default final @NonNull Void PlayerExtensionsKt.listenTo(
    @NonNull Player receiver,
    @Player.Event int firstEvent,
    int... otherEvents,
    @NonNull Function2<@NonNull Player, @NonNull Player.Events, Unit> onEvents
)
```

Continuously listens to the `https://developer.android.com/reference/androidx/media3/common/Player.Listener#onEvents(androidx.media3.common.Player,androidx.media3.common.Player.Events)` callback, passing the received `https://developer.android.com/reference/androidx/media3/common/Player.Events` to the provided `https://developer.android.com/reference/androidx/media3/common/package-summary#(androidx.media3.common.Player).listenTo(kotlin.Int,kotlin.IntArray,kotlin.Function2)` function. A non-zero number of events has to be specified (hence `https://developer.android.com/reference/androidx/media3/common/package-summary#(androidx.media3.common.Player).listenTo(kotlin.Int,kotlin.IntArray,kotlin.Function2)` and `https://developer.android.com/reference/androidx/media3/common/package-summary#(androidx.media3.common.Player).listenTo(kotlin.Int,kotlin.IntArray,kotlin.Function2)`). The order is not important.

This function can be called from any thread. The `https://developer.android.com/reference/androidx/media3/common/package-summary#(androidx.media3.common.Player).listenTo(kotlin.Int,kotlin.IntArray,kotlin.Function2)` function will be invoked on the thread associated with `https://developer.android.com/reference/androidx/media3/common/Player#getApplicationLooper()`.

If, during the execution of `https://developer.android.com/reference/androidx/media3/common/package-summary#(androidx.media3.common.Player).listenTo(kotlin.Int,kotlin.IntArray,kotlin.Function2)`, an exception is thrown, the coroutine corresponding to listening to the Player will be terminated. Any used resources will be cleaned up (e.g. removing of the listeners) and exception will be re-thrown right after the last suspension point.

| Parameters |
|---|---|
| `@https://developer.android.com/reference/androidx/media3/common/Player.Event int firstEvent` | One of the `https://developer.android.com/reference/androidx/media3/common/Player.Event` to listen to. Does not have to actually be the first one, since the order is not taken into account. This parameter is separated from `https://developer.android.com/reference/androidx/media3/common/package-summary#(androidx.media3.common.Player).listenTo(kotlin.Int,kotlin.IntArray,kotlin.Function2)` to avoid creating an array when only one event is needed or avoid accidentally not passing any events. |
| `int... otherEvents` | The set of other `https://developer.android.com/reference/androidx/media3/common/Player.Event` to listen for. |
| `@https://developer.android.com/reference/androidx/annotation/NonNull Function2<@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/media3/common/Player, @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/media3/common/Player.Events, https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html> onEvents` | The function to handle player events. |

| Returns |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/lang/Void.html` | Nothing This function never returns normally. It will either continue indefinitely or terminate due to an exception or cancellation. |

### PlayerFenceKt.awaitContentPositionAtLeast

Artifact: [androidx.media3:media3-test-utils](https://developer.android.com/jetpack/androidx/releases/media3) [View Source](https://cs.android.com/search?q=file:androidx/media3/test/utils/PlayerFence.kt+function:awaitContentPositionAtLeast)

```
@UnstableApi
default final void PlayerFenceKt.awaitContentPositionAtLeast(
    @NonNull Player receiver,
    long targetPositionMs,
    boolean failOnNonFatalErrors,
    Duration timeout
)
```

Suspends until the content position reaches (or passes) `https://developer.android.com/reference/androidx/media3/test/utils/package-summary#(androidx.media3.common.Player).awaitContentPositionAtLeast(kotlin.Long,kotlin.Boolean,kotlin.time.Duration)` in the current media item.

This makes some assumptions:

1. The condition completes immediately if `https://developer.android.com/reference/androidx/media3/common/Player#getContentPosition()` is already at least `https://developer.android.com/reference/androidx/media3/test/utils/package-summary#(androidx.media3.common.Player).awaitContentPositionAtLeast(kotlin.Long,kotlin.Boolean,kotlin.time.Duration)`.

2. Seeking past the target position satisfies the condition.

3. If playback ends, or the media item changes, before the target position is reached, an exception is thrown.

Must be called on the player's application looper thread.

| Parameters |
|---|---|
| `long targetPositionMs` | The `https://developer.android.com/reference/androidx/media3/common/Player#getContentPosition()` to wait for. |
| `boolean failOnNonFatalErrors` | Whether non-fatal errors (such as those from `https://developer.android.com/reference/androidx/media3/exoplayer/analytics/AnalyticsListener#onAudioCodecError(androidx.media3.exoplayer.analytics.AnalyticsListener.EventTime,java.lang.Exception)`) cause an exception to be thrown immediately. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.time/-duration/index.html timeout` | The max time to wait for, or `null` to use a default timeout of 10 seconds. |

| Throws |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-illegal-state-exception/index.html` | if not called on the player's application looper thread. |

### PlayerFenceKt.awaitFirstFrameRendered

Artifact: [androidx.media3:media3-test-utils](https://developer.android.com/jetpack/androidx/releases/media3) [View Source](https://cs.android.com/search?q=file:androidx/media3/test/utils/PlayerFence.kt+function:awaitFirstFrameRendered)

```
@UnstableApi
default final void PlayerFenceKt.awaitFirstFrameRendered(
    @NonNull Player receiver,
    boolean failOnNonFatalErrors,
    Duration timeout
)
```

Suspends until `https://developer.android.com/reference/androidx/media3/common/Player.Listener#onRenderedFirstFrame()` is invoked.

This should be called before the callback has been invoked (e.g. before calling `https://developer.android.com/reference/androidx/media3/common/Player#prepare()`), otherwise it risks awaiting forever.

Must be called on the player's application looper thread.

| Parameters |
|---|---|
| `boolean failOnNonFatalErrors` | Whether non-fatal errors (such as those from `https://developer.android.com/reference/androidx/media3/exoplayer/analytics/AnalyticsListener#onAudioCodecError(androidx.media3.exoplayer.analytics.AnalyticsListener.EventTime,java.lang.Exception)`) cause an exception to be thrown immediately. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.time/-duration/index.html timeout` | The max time to wait for, or `null` to use a default timeout of 10 seconds. |

| Throws |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-illegal-state-exception/index.html` | if not called on the player's application looper thread. |

### PlayerFenceKt.awaitIsPlaying

Artifact: [androidx.media3:media3-test-utils](https://developer.android.com/jetpack/androidx/releases/media3) [View Source](https://cs.android.com/search?q=file:androidx/media3/test/utils/PlayerFence.kt+function:awaitIsPlaying)

```
@UnstableApi
default final void PlayerFenceKt.awaitIsPlaying(
    @NonNull Player receiver,
    boolean targetIsPlaying,
    boolean failOnNonFatalErrors,
    Duration timeout
)
```

Suspends until the player's `https://developer.android.com/reference/androidx/media3/common/Player#isPlaying()` value matches `https://developer.android.com/reference/androidx/media3/test/utils/package-summary#(androidx.media3.common.Player).awaitIsPlaying(kotlin.Boolean,kotlin.Boolean,kotlin.time.Duration)`.

If the player's `https://developer.android.com/reference/androidx/media3/common/Player#isPlaying()` value is already `https://developer.android.com/reference/androidx/media3/test/utils/package-summary#(androidx.media3.common.Player).awaitIsPlaying(kotlin.Boolean,kotlin.Boolean,kotlin.time.Duration)` this returns immediately.

Must be called on the player's application looper thread.

| Parameters |
|---|---|
| `boolean targetIsPlaying` | The value of `https://developer.android.com/reference/androidx/media3/common/Player#isPlaying()` to wait for. |
| `boolean failOnNonFatalErrors` | Whether non-fatal errors (such as those from `https://developer.android.com/reference/androidx/media3/exoplayer/analytics/AnalyticsListener#onAudioCodecError(androidx.media3.exoplayer.analytics.AnalyticsListener.EventTime,java.lang.Exception)`) cause an exception to be thrown immediately. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.time/-duration/index.html timeout` | The max time to wait for, or `null` to use a default timeout of 10 seconds. |

| Throws |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-illegal-state-exception/index.html` | if not called on the player's application looper thread. |

### PlayerFenceKt.awaitPlaybackState

Artifact: [androidx.media3:media3-test-utils](https://developer.android.com/jetpack/androidx/releases/media3) [View Source](https://cs.android.com/search?q=file:androidx/media3/test/utils/PlayerFence.kt+function:awaitPlaybackState)

```
@UnstableApi
default final void PlayerFenceKt.awaitPlaybackState(
    @NonNull Player receiver,
    @Player.State int targetState,
    boolean failOnNonFatalErrors,
    Duration timeout
)
```

Suspends until the player enters the provided `https://developer.android.com/reference/androidx/media3/test/utils/package-summary#(androidx.media3.common.Player).awaitPlaybackState(kotlin.Int,kotlin.Boolean,kotlin.time.Duration)`.

If the player is already in the provided `https://developer.android.com/reference/androidx/media3/test/utils/package-summary#(androidx.media3.common.Player).awaitPlaybackState(kotlin.Int,kotlin.Boolean,kotlin.time.Duration)` this returns immediately.

Must be called on the player's application looper thread.

| Parameters |
|---|---|
| `@https://developer.android.com/reference/androidx/media3/common/Player.State int targetState` | The playback `https://developer.android.com/reference/androidx/media3/common/Player.State` to await. |
| `boolean failOnNonFatalErrors` | Whether non-fatal errors (such as those from `https://developer.android.com/reference/androidx/media3/exoplayer/analytics/AnalyticsListener#onAudioCodecError(androidx.media3.exoplayer.analytics.AnalyticsListener.EventTime,java.lang.Exception)`) cause an exception to be thrown immediately. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.time/-duration/index.html timeout` | The max time to wait for, or `null` to use a default timeout of 10 seconds. |

| Throws |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-illegal-state-exception/index.html` | if not called on the player's application looper thread. |