Package com.google.android.exoplayer2

## Interface Player

- All Known Subinterfaces:
    `ExoPlayer`
  All Known Implementing Classes:
    `BasePlayer`, `CastPlayer`, `ForwardingPlayer`, `SimpleExoPlayer`, `StubExoPlayer`

      public interface Player

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

  This interface includes some convenience methods that can be implemented by calling other methods in the interface. `BasePlayer` implements these convenience methods so inheriting `BasePlayer` is recommended when implementing the interface so that only the minimal set of required methods can be implemented.

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

  - They can provide a `Timeline` representing the structure of the media being played, which can be obtained by calling `getCurrentTimeline()`.
  - They can provide a `TrackGroupArray` defining the currently available tracks, which can be obtained by calling `getCurrentTrackGroups()`.
  - They can provide a `TrackSelectionArray` defining which of the currently available tracks are selected to be rendered. This can be obtained by calling `getCurrentTrackSelections()`}.

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Interface | Description
    --- | --- | ---
    `static interface` | `Player.Command` | Commands that can be executed on a `Player`.
    `static class` | `Player.Commands` | A set of `commands`.
    `static interface` | `Player.DiscontinuityReason` | Reasons for position discontinuities.
    `static interface` | `Player.Event` | Events that can be reported via `Player.Listener.onEvents(Player, Events)`.
    `static interface` | `Player.EventListener` | Deprecated. Use `Player.Listener`.
    `static class` | `Player.Events` | A set of `events`.
    `static interface` | `Player.Listener` | Listener of all changes in the Player.
    `static interface` | `Player.MediaItemTransitionReason` | Reasons for media item transitions.
    `static interface` | `Player.PlaybackSuppressionReason` | Reason why playback is suppressed even though `getPlayWhenReady()` is `true`.
    `static interface` | `Player.PlayWhenReadyChangeReason` | Reasons for `playWhenReady` changes.
    `static class` | `Player.PositionInfo` | Position info describing a playback position involved in a discontinuity.
    `static interface` | `Player.RepeatMode` | Repeat modes for playback.
    `static interface` | `Player.State` | Playback state.
    `static interface` | `Player.TimelineChangeReason` | Reasons for timeline changes.

  - ### Field Summary

    Fields
    Modifier and Type | Field | Description
    --- | --- | ---
    `static int` | `COMMAND_ADJUST_DEVICE_VOLUME` | Command to increase and decrease the device volume and mute it.
    `static int` | `COMMAND_CHANGE_MEDIA_ITEMS` | Command to change the `MediaItems` in the playlist.
    `static int` | `COMMAND_GET_AUDIO_ATTRIBUTES` | Command to get the player current `AudioAttributes`.
    `static int` | `COMMAND_GET_CURRENT_MEDIA_ITEM` | Command to get the `MediaItem` of the current window.
    `static int` | `COMMAND_GET_DEVICE_VOLUME` | Command to get the device volume and whether it is muted.
    `static int` | `COMMAND_GET_MEDIA_ITEMS_METADATA` | Command to get the `MediaItems` metadata.
    `static int` | `COMMAND_GET_TEXT` | Command to get the text that should currently be displayed by the player.
    `static int` | `COMMAND_GET_TIMELINE` | Command to get the information about the current timeline.
    `static int` | `COMMAND_GET_VOLUME` | Command to get the player volume.
    `static int` | `COMMAND_INVALID` | Represents an invalid `Player.Command`.
    `static int` | `COMMAND_PLAY_PAUSE` | Command to start, pause or resume playback.
    `static int` | `COMMAND_PREPARE_STOP` | Command to prepare the player, stop playback or release the player.
    `static int` | `COMMAND_SEEK_BACK` | Command to seek back by a fixed increment into the current window.
    `static int` | `COMMAND_SEEK_FORWARD` | Command to seek forward by a fixed increment into the current window.
    `static int` | `COMMAND_SEEK_IN_CURRENT_WINDOW` | Command to seek anywhere into the current window.
    `static int` | `COMMAND_SEEK_TO_DEFAULT_POSITION` | Command to seek to the default position of the current window.
    `static int` | `COMMAND_SEEK_TO_NEXT` | Command to seek to a later position in the current or next window.
    `static int` | `COMMAND_SEEK_TO_NEXT_WINDOW` | Command to seek to the default position of the next window.
    `static int` | `COMMAND_SEEK_TO_PREVIOUS` | Command to seek to an earlier position in the current or previous window.
    `static int` | `COMMAND_SEEK_TO_PREVIOUS_WINDOW` | Command to seek to the default position of the previous window.
    `static int` | `COMMAND_SEEK_TO_WINDOW` | Command to seek anywhere in any window.
    `static int` | `COMMAND_SET_DEVICE_VOLUME` | Command to set the device volume and mute it.
    `static int` | `COMMAND_SET_MEDIA_ITEMS_METADATA` | Command to set the `MediaItems` metadata.
    `static int` | `COMMAND_SET_REPEAT_MODE` | Command to set the repeat mode.
    `static int` | `COMMAND_SET_SHUFFLE_MODE` | Command to enable shuffling.
    `static int` | `COMMAND_SET_SPEED_AND_PITCH` | Command to set the playback speed and pitch.
    `static int` | `COMMAND_SET_VIDEO_SURFACE` | Command to set and clear the surface on which to render the video.
    `static int` | `COMMAND_SET_VOLUME` | Command to set the player volume.
    `static int` | `DISCONTINUITY_REASON_AUTO_TRANSITION` | Automatic playback transition from one period in the timeline to the next.
    `static int` | `DISCONTINUITY_REASON_INTERNAL` | Discontinuity introduced internally (e.g.
    `static int` | `DISCONTINUITY_REASON_REMOVE` | Discontinuity caused by the removal of the current period from the `Timeline`.
    `static int` | `DISCONTINUITY_REASON_SEEK` | Seek within the current period or to another period.
    `static int` | `DISCONTINUITY_REASON_SEEK_ADJUSTMENT` | Seek adjustment due to being unable to seek to the requested position or because the seek was permitted to be inexact.
    `static int` | `DISCONTINUITY_REASON_SKIP` | Discontinuity introduced by a skipped period (for instance a skipped ad).
    `static int` | `EVENT_AVAILABLE_COMMANDS_CHANGED` | `isCommandAvailable(int)` changed for at least one `Player.Command`.
    `static int` | `EVENT_IS_LOADING_CHANGED` | `isLoading()` ()} changed.
    `static int` | `EVENT_IS_PLAYING_CHANGED` | `isPlaying()` changed.
    `static int` | `EVENT_MAX_SEEK_TO_PREVIOUS_POSITION_CHANGED` | `getMaxSeekToPreviousPosition()` changed.
    `static int` | `EVENT_MEDIA_ITEM_TRANSITION` | `getCurrentMediaItem()` changed or the player started repeating the current item.
    `static int` | `EVENT_MEDIA_METADATA_CHANGED` | `getMediaMetadata()` changed.
    `static int` | `EVENT_PLAY_WHEN_READY_CHANGED` | `getPlayWhenReady()` changed.
    `static int` | `EVENT_PLAYBACK_PARAMETERS_CHANGED` | `getPlaybackParameters()` changed.
    `static int` | `EVENT_PLAYBACK_STATE_CHANGED` | `getPlaybackState()` changed.
    `static int` | `EVENT_PLAYBACK_SUPPRESSION_REASON_CHANGED` | `getPlaybackSuppressionReason()` changed.
    `static int` | `EVENT_PLAYER_ERROR` | `getPlayerError()` changed.
    `static int` | `EVENT_PLAYLIST_METADATA_CHANGED` | `getPlaylistMetadata()` changed.
    `static int` | `EVENT_POSITION_DISCONTINUITY` | A position discontinuity occurred.
    `static int` | `EVENT_REPEAT_MODE_CHANGED` | `getRepeatMode()` changed.
    `static int` | `EVENT_SEEK_BACK_INCREMENT_CHANGED` | `getSeekBackIncrement()` changed.
    `static int` | `EVENT_SEEK_FORWARD_INCREMENT_CHANGED` | `getSeekForwardIncrement()` changed.
    `static int` | `EVENT_SHUFFLE_MODE_ENABLED_CHANGED` | `getShuffleModeEnabled()` changed.
    `static int` | `EVENT_STATIC_METADATA_CHANGED` | Deprecated. Use `EVENT_MEDIA_METADATA_CHANGED` for structured metadata changes.
    `static int` | `EVENT_TIMELINE_CHANGED` | `getCurrentTimeline()` changed.
    `static int` | `EVENT_TRACKS_CHANGED` | `getCurrentTrackGroups()` or `getCurrentTrackSelections()` changed.
    `static int` | `MEDIA_ITEM_TRANSITION_REASON_AUTO` | Playback has automatically transitioned to the next media item.
    `static int` | `MEDIA_ITEM_TRANSITION_REASON_PLAYLIST_CHANGED` | The current media item has changed because of a change in the playlist.
    `static int` | `MEDIA_ITEM_TRANSITION_REASON_REPEAT` | The media item has been repeated.
    `static int` | `MEDIA_ITEM_TRANSITION_REASON_SEEK` | A seek to another media item has occurred.
    `static int` | `PLAY_WHEN_READY_CHANGE_REASON_AUDIO_BECOMING_NOISY` | Playback has been paused to avoid becoming noisy.
    `static int` | `PLAY_WHEN_READY_CHANGE_REASON_AUDIO_FOCUS_LOSS` | Playback has been paused because of a loss of audio focus.
    `static int` | `PLAY_WHEN_READY_CHANGE_REASON_END_OF_MEDIA_ITEM` | Playback has been paused at the end of a media item.
    `static int` | `PLAY_WHEN_READY_CHANGE_REASON_REMOTE` | Playback has been started or paused because of a remote change.
    `static int` | `PLAY_WHEN_READY_CHANGE_REASON_USER_REQUEST` | Playback has been started or paused by a call to `setPlayWhenReady(boolean)`.
    `static int` | `PLAYBACK_SUPPRESSION_REASON_NONE` | Playback is not suppressed.
    `static int` | `PLAYBACK_SUPPRESSION_REASON_TRANSIENT_AUDIO_FOCUS_LOSS` | Playback is suppressed due to transient audio focus loss.
    `static int` | `REPEAT_MODE_ALL` | Repeats the entire timeline infinitely.
    `static int` | `REPEAT_MODE_OFF` | Normal playback without repetition.
    `static int` | `REPEAT_MODE_ONE` | Repeats the currently playing window infinitely during ongoing playback.
    `static int` | `STATE_BUFFERING` | The player is not able to immediately play the media, but is doing work toward being able to do so.
    `static int` | `STATE_ENDED` | The player has finished playing the media.
    `static int` | `STATE_IDLE` | The player is idle, and must be `prepared` before it will play the media.
    `static int` | `STATE_READY` | The player is able to immediately play from its current position.
    `static int` | `TIMELINE_CHANGE_REASON_PLAYLIST_CHANGED` | Timeline changed as a result of a change of the playlist items or the order of the items.
    `static int` | `TIMELINE_CHANGE_REASON_SOURCE_UPDATE` | Timeline changed as a result of a source update (e.g.

  - ### Method Summary

    All Methods Instance Methods Abstract Methods Deprecated Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `void` | `addListener​(Player.EventListener listener)` | Deprecated. Use `addListener(Listener)` and `removeListener(Listener)` instead.
    `void` | `addListener​(Player.Listener listener)` | Registers a listener to receive all events from the player.
    `void` | `addMediaItem​(int index, MediaItem mediaItem)` | Adds a media item at the given index of the playlist.
    `void` | `addMediaItem​(MediaItem mediaItem)` | Adds a media item to the end of the playlist.
    `void` | `addMediaItems​(int index, List<MediaItem> mediaItems)` | Adds a list of media items at the given index of the playlist.
    `void` | `addMediaItems​(List<MediaItem> mediaItems)` | Adds a list of media items to the end of the playlist.
    `void` | `clearMediaItems()` | Clears the playlist.
    `void` | `clearVideoSurface()` | Clears any `Surface`, `SurfaceHolder`, `SurfaceView` or `TextureView` currently set on the player.
    `void` | `clearVideoSurface​(Surface surface)` | Clears the `Surface` onto which video is being rendered if it matches the one passed.
    `void` | `clearVideoSurfaceHolder​(SurfaceHolder surfaceHolder)` | Clears the `SurfaceHolder` that holds the `Surface` onto which video is being rendered if it matches the one passed.
    `void` | `clearVideoSurfaceView​(SurfaceView surfaceView)` | Clears the `SurfaceView` onto which video is being rendered if it matches the one passed.
    `void` | `clearVideoTextureView​(TextureView textureView)` | Clears the `TextureView` onto which video is being rendered if it matches the one passed.
    `void` | `decreaseDeviceVolume()` | Decreases the volume of the device.
    `Looper` | `getApplicationLooper()` | Returns the `Looper` associated with the application thread that's used to access the player and on which player events are received.
    `AudioAttributes` | `getAudioAttributes()` | Returns the attributes for audio playback.
    `Player.Commands` | `getAvailableCommands()` | Returns the player's currently available `Player.Commands`.
    `int` | `getBufferedPercentage()` | Returns an estimate of the percentage in the current content window or ad up to which data is buffered, or 0 if no estimate is available.
    `long` | `getBufferedPosition()` | Returns an estimate of the position in the current content window or ad up to which data is buffered, in milliseconds.
    `long` | `getContentBufferedPosition()` | If `isPlayingAd()` returns `true`, returns an estimate of the content position in the current content window up to which data is buffered, in milliseconds.
    `long` | `getContentDuration()` | If `isPlayingAd()` returns `true`, returns the duration of the current content window in milliseconds, or `C.TIME_UNSET` if the duration is not known.
    `long` | `getContentPosition()` | If `isPlayingAd()` returns `true`, returns the content position that will be played once all ads in the ad group have finished playing, in milliseconds.
    `int` | `getCurrentAdGroupIndex()` | If `isPlayingAd()` returns true, returns the index of the ad group in the period currently being played.
    `int` | `getCurrentAdIndexInAdGroup()` | If `isPlayingAd()` returns true, returns the index of the ad in its ad group.
    `List<Cue>` | `getCurrentCues()` | Returns the current `Cues`.
    `long` | `getCurrentLiveOffset()` | Returns the offset of the current playback position from the live edge in milliseconds, or `C.TIME_UNSET` if the current window `isn't live` or the offset is unknown.
    `Object` | `getCurrentManifest()` | Returns the current manifest.
    `MediaItem` | `getCurrentMediaItem()` | Returns the media item of the current window in the timeline.
    `int` | `getCurrentPeriodIndex()` | Returns the index of the period currently being played.
    `long` | `getCurrentPosition()` | Returns the playback position in the current content window or ad, in milliseconds, or the prospective position in milliseconds if the `current timeline` is empty.
    `List<Metadata>` | `getCurrentStaticMetadata()` | Deprecated. Use `getMediaMetadata()` and `Player.Listener.onMediaMetadataChanged(MediaMetadata)` for access to structured metadata, or access the raw static metadata directly from the `track selections' formats`.
    `Timeline` | `getCurrentTimeline()` | Returns the current `Timeline`.
    `TrackGroupArray` | `getCurrentTrackGroups()` | Returns the available track groups.
    `TrackSelectionArray` | `getCurrentTrackSelections()` | Returns the current track selections.
    `int` | `getCurrentWindowIndex()` | Returns the index of the current `window` in the `timeline`, or the prospective window index if the `current timeline` is empty.
    `DeviceInfo` | `getDeviceInfo()` | Gets the device information.
    `int` | `getDeviceVolume()` | Gets the current volume of the device.
    `long` | `getDuration()` | Returns the duration of the current content window or ad in milliseconds, or `C.TIME_UNSET` if the duration is not known.
    `int` | `getMaxSeekToPreviousPosition()` | Returns the maximum position for which `seekToPrevious()` seeks to the previous window, in milliseconds.
    `MediaItem` | `getMediaItemAt​(int index)` | Returns the `MediaItem` at the given index.
    `int` | `getMediaItemCount()` | Returns the number of `media items` in the playlist.
    `MediaMetadata` | `getMediaMetadata()` | Returns the current combined `MediaMetadata`, or `MediaMetadata.EMPTY` if not supported.
    `int` | `getNextWindowIndex()` | Returns the index of the window that will be played if `seekToNextWindow()` is called, which may depend on the current repeat mode and whether shuffle mode is enabled.
    `PlaybackParameters` | `getPlaybackParameters()` | Returns the currently active playback parameters.
    `int` | `getPlaybackState()` | Returns the current `playback state` of the player.
    `int` | `getPlaybackSuppressionReason()` | Returns the reason why playback is suppressed even though `getPlayWhenReady()` is `true`, or `PLAYBACK_SUPPRESSION_REASON_NONE` if playback is not suppressed.
    `PlaybackException` | `getPlayerError()` | Returns the error that caused playback to fail.
    `MediaMetadata` | `getPlaylistMetadata()` | Returns the playlist `MediaMetadata`, as set by `setPlaylistMetadata(MediaMetadata)`, or `MediaMetadata.EMPTY` if not supported.
    `boolean` | `getPlayWhenReady()` | Whether playback will proceed when `getPlaybackState()` == `STATE_READY`.
    `int` | `getPreviousWindowIndex()` | Returns the index of the window that will be played if `seekToPreviousWindow()` is called, which may depend on the current repeat mode and whether shuffle mode is enabled.
    `int` | `getRepeatMode()` | Returns the current `Player.RepeatMode` used for playback.
    `long` | `getSeekBackIncrement()` | Returns the `seekBack()` increment.
    `long` | `getSeekForwardIncrement()` | Returns the `seekForward()` increment.
    `boolean` | `getShuffleModeEnabled()` | Returns whether shuffling of windows is enabled.
    `long` | `getTotalBufferedDuration()` | Returns an estimate of the total buffered duration from the current position, in milliseconds.
    `VideoSize` | `getVideoSize()` | Gets the size of the video.
    `float` | `getVolume()` | Returns the audio volume, with 0 being silence and 1 being unity gain (signal unchanged).
    `boolean` | `hasNext()` | Deprecated. Use `hasNextWindow()` instead.
    `boolean` | `hasNextWindow()` | Returns whether a next window exists, which may depend on the current repeat mode and whether shuffle mode is enabled.
    `boolean` | `hasPrevious()` | Deprecated. Use `hasPreviousWindow()` instead.
    `boolean` | `hasPreviousWindow()` | Returns whether a previous window exists, which may depend on the current repeat mode and whether shuffle mode is enabled.
    `void` | `increaseDeviceVolume()` | Increases the volume of the device.
    `boolean` | `isCommandAvailable​(int command)` | Returns whether the provided `Player.Command` is available.
    `boolean` | `isCurrentWindowDynamic()` | Returns whether the current window is dynamic, or `false` if the `Timeline` is empty.
    `boolean` | `isCurrentWindowLive()` | Returns whether the current window is live, or `false` if the `Timeline` is empty.
    `boolean` | `isCurrentWindowSeekable()` | Returns whether the current window is seekable, or `false` if the `Timeline` is empty.
    `boolean` | `isDeviceMuted()` | Gets whether the device is muted or not.
    `boolean` | `isLoading()` | Whether the player is currently loading the source.
    `boolean` | `isPlaying()` | Returns whether the player is playing, i.e.
    `boolean` | `isPlayingAd()` | Returns whether the player is currently playing an ad.
    `void` | `moveMediaItem​(int currentIndex, int newIndex)` | Moves the media item at the current index to the new index.
    `void` | `moveMediaItems​(int fromIndex, int toIndex, int newIndex)` | Moves the media item range to the new index.
    `void` | `next()` | Deprecated. Use `seekToNextWindow()` instead.
    `void` | `pause()` | Pauses playback.
    `void` | `play()` | Resumes playback as soon as `getPlaybackState()` == `STATE_READY`.
    `void` | `prepare()` | Prepares the player.
    `void` | `previous()` | Deprecated. Use `seekToPreviousWindow()` instead.
    `void` | `release()` | Releases the player.
    `void` | `removeListener​(Player.EventListener listener)` | Deprecated. Use `addListener(Listener)` and `removeListener(Listener)` instead.
    `void` | `removeListener​(Player.Listener listener)` | Unregister a listener registered through `addListener(Listener)`.
    `void` | `removeMediaItem​(int index)` | Removes the media item at the given index of the playlist.
    `void` | `removeMediaItems​(int fromIndex, int toIndex)` | Removes a range of media items from the playlist.
    `void` | `seekBack()` | Seeks back in the current window by `getSeekBackIncrement()` milliseconds.
    `void` | `seekForward()` | Seeks forward in the current window by `getSeekForwardIncrement()` milliseconds.
    `void` | `seekTo​(int windowIndex, long positionMs)` | Seeks to a position specified in milliseconds in the specified window.
    `void` | `seekTo​(long positionMs)` | Seeks to a position specified in milliseconds in the current window.
    `void` | `seekToDefaultPosition()` | Seeks to the default position associated with the current window.
    `void` | `seekToDefaultPosition​(int windowIndex)` | Seeks to the default position associated with the specified window.
    `void` | `seekToNext()` | Seeks to a later position in the current or next window (if available).
    `void` | `seekToNextWindow()` | Seeks to the default position of the next window, which may depend on the current repeat mode and whether shuffle mode is enabled.
    `void` | `seekToPrevious()` | Seeks to an earlier position in the current or previous window (if available).
    `void` | `seekToPreviousWindow()` | Seeks to the default position of the previous window, which may depend on the current repeat mode and whether shuffle mode is enabled.
    `void` | `setDeviceMuted​(boolean muted)` | Sets the mute state of the device.
    `void` | `setDeviceVolume​(int volume)` | Sets the volume of the device.
    `void` | `setMediaItem​(MediaItem mediaItem)` | Clears the playlist, adds the specified `MediaItem` and resets the position to the default position.
    `void` | `setMediaItem​(MediaItem mediaItem, boolean resetPosition)` | Clears the playlist and adds the specified `MediaItem`.
    `void` | `setMediaItem​(MediaItem mediaItem, long startPositionMs)` | Clears the playlist and adds the specified `MediaItem`.
    `void` | `setMediaItems​(List<MediaItem> mediaItems)` | Clears the playlist, adds the specified `MediaItems` and resets the position to the default position.
    `void` | `setMediaItems​(List<MediaItem> mediaItems, boolean resetPosition)` | Clears the playlist and adds the specified `MediaItems`.
    `void` | `setMediaItems​(List<MediaItem> mediaItems, int startWindowIndex, long startPositionMs)` | Clears the playlist and adds the specified `MediaItems`.
    `void` | `setPlaybackParameters​(PlaybackParameters playbackParameters)` | Attempts to set the playback parameters.
    `void` | `setPlaybackSpeed​(float speed)` | Changes the rate at which playback occurs.
    `void` | `setPlaylistMetadata​(MediaMetadata mediaMetadata)` | Sets the playlist `MediaMetadata`.
    `void` | `setPlayWhenReady​(boolean playWhenReady)` | Sets whether playback should proceed when `getPlaybackState()` == `STATE_READY`.
    `void` | `setRepeatMode​(int repeatMode)` | Sets the `Player.RepeatMode` to be used for playback.
    `void` | `setShuffleModeEnabled​(boolean shuffleModeEnabled)` | Sets whether shuffling of windows is enabled.
    `void` | `setVideoSurface​(Surface surface)` | Sets the `Surface` onto which video will be rendered.
    `void` | `setVideoSurfaceHolder​(SurfaceHolder surfaceHolder)` | Sets the `SurfaceHolder` that holds the `Surface` onto which video will be rendered.
    `void` | `setVideoSurfaceView​(SurfaceView surfaceView)` | Sets the `SurfaceView` onto which video will be rendered.
    `void` | `setVideoTextureView​(TextureView textureView)` | Sets the `TextureView` onto which video will be rendered.
    `void` | `setVolume​(float audioVolume)` | Sets the audio volume, with 0 being silence and 1 being unity gain (signal unchanged).
    `void` | `stop()` | Stops playback without resetting the player.
    `void` | `stop​(boolean reset)` | Deprecated. Use `stop()` and `clearMediaItems()` (if `reset` is true) or just `stop()` (if `reset` is false).

- - ### Field Detail

    - #### STATE_IDLE

          static final int STATE_IDLE

      The player is idle, and must be `prepared` before it will play the media.
      See Also:
        Constant Field Values

    - #### STATE_BUFFERING

          static final int STATE_BUFFERING

      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.
      See Also:
        Constant Field Values

    - #### STATE_READY

          static final int STATE_READY

      The player is able to immediately play from its current position. The player will be playing if `getPlayWhenReady()` is true, and paused otherwise.
      See Also:
        Constant Field Values

    - #### STATE_ENDED

          static final int STATE_ENDED

      The player has finished playing the media.
      See Also:
        Constant Field Values

    - #### PLAY_WHEN_READY_CHANGE_REASON_USER_REQUEST

          static final int PLAY_WHEN_READY_CHANGE_REASON_USER_REQUEST

      Playback has been started or paused by a call to `setPlayWhenReady(boolean)`.
      See Also:
        Constant Field Values

    - #### PLAY_WHEN_READY_CHANGE_REASON_AUDIO_FOCUS_LOSS

          static final int PLAY_WHEN_READY_CHANGE_REASON_AUDIO_FOCUS_LOSS

      Playback has been paused because of a loss of audio focus.
      See Also:
        Constant Field Values

    - #### PLAY_WHEN_READY_CHANGE_REASON_AUDIO_BECOMING_NOISY

          static final int PLAY_WHEN_READY_CHANGE_REASON_AUDIO_BECOMING_NOISY

      Playback has been paused to avoid becoming noisy.
      See Also:
        Constant Field Values

    - #### PLAY_WHEN_READY_CHANGE_REASON_REMOTE

          static final int PLAY_WHEN_READY_CHANGE_REASON_REMOTE

      Playback has been started or paused because of a remote change.
      See Also:
        Constant Field Values

    - #### PLAY_WHEN_READY_CHANGE_REASON_END_OF_MEDIA_ITEM

          static final int PLAY_WHEN_READY_CHANGE_REASON_END_OF_MEDIA_ITEM

      Playback has been paused at the end of a media item.
      See Also:
        Constant Field Values

    - #### PLAYBACK_SUPPRESSION_REASON_NONE

          static final int PLAYBACK_SUPPRESSION_REASON_NONE

      Playback is not suppressed.
      See Also:
        Constant Field Values

    - #### PLAYBACK_SUPPRESSION_REASON_TRANSIENT_AUDIO_FOCUS_LOSS

          static final int PLAYBACK_SUPPRESSION_REASON_TRANSIENT_AUDIO_FOCUS_LOSS

      Playback is suppressed due to transient audio focus loss.
      See Also:
        Constant Field Values

    - #### REPEAT_MODE_OFF

          static final int REPEAT_MODE_OFF

      Normal playback without repetition. "Previous" and "Next" actions move to the previous and next windows respectively, and do nothing when there is no previous or next window to move to.
      See Also:
        Constant Field Values

    - #### REPEAT_MODE_ONE

          static final int REPEAT_MODE_ONE

      Repeats the currently playing window infinitely during ongoing playback. "Previous" and "Next" actions behave as they do in `REPEAT_MODE_OFF`, moving to the previous and next windows respectively, and doing nothing when there is no previous or next window to move to.
      See Also:
        Constant Field Values

    - #### REPEAT_MODE_ALL

          static final int REPEAT_MODE_ALL

      Repeats the entire timeline infinitely. "Previous" and "Next" actions behave as they do in `REPEAT_MODE_OFF`, but with looping at the ends so that "Previous" when playing the first window will move to the last window, and "Next" when playing the last window will move to the first window.
      See Also:
        Constant Field Values

    - #### DISCONTINUITY_REASON_AUTO_TRANSITION

          static final int DISCONTINUITY_REASON_AUTO_TRANSITION

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

      See Also:
        Constant Field Values

    - #### DISCONTINUITY_REASON_SEEK

          static final int DISCONTINUITY_REASON_SEEK

      Seek within the current period or to another period.
      See Also:
        Constant Field Values

    - #### DISCONTINUITY_REASON_SEEK_ADJUSTMENT

          static final int DISCONTINUITY_REASON_SEEK_ADJUSTMENT

      Seek adjustment due to being unable to seek to the requested position or because the seek was permitted to be inexact.
      See Also:
        Constant Field Values

    - #### DISCONTINUITY_REASON_SKIP

          static final int DISCONTINUITY_REASON_SKIP

      Discontinuity introduced by a skipped period (for instance a skipped ad).
      See Also:
        Constant Field Values

    - #### DISCONTINUITY_REASON_REMOVE

          static final int DISCONTINUITY_REASON_REMOVE

      Discontinuity caused by the removal of the current period from the `Timeline`.
      See Also:
        Constant Field Values

    - #### DISCONTINUITY_REASON_INTERNAL

          static final int DISCONTINUITY_REASON_INTERNAL

      Discontinuity introduced internally (e.g. by the source).
      See Also:
        Constant Field Values

    - #### TIMELINE_CHANGE_REASON_PLAYLIST_CHANGED

          static final int TIMELINE_CHANGE_REASON_PLAYLIST_CHANGED

      Timeline changed as a result of a change of the playlist items or the order of the items.
      See Also:
        Constant Field Values

    - #### TIMELINE_CHANGE_REASON_SOURCE_UPDATE

          static final int TIMELINE_CHANGE_REASON_SOURCE_UPDATE

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

      See Also:
        Constant Field Values

    - #### MEDIA_ITEM_TRANSITION_REASON_REPEAT

          static final int MEDIA_ITEM_TRANSITION_REASON_REPEAT

      The media item has been repeated.
      See Also:
        Constant Field Values

    - #### MEDIA_ITEM_TRANSITION_REASON_AUTO

          static final int MEDIA_ITEM_TRANSITION_REASON_AUTO

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

      See Also:
        Constant Field Values

    - #### MEDIA_ITEM_TRANSITION_REASON_SEEK

          static final int MEDIA_ITEM_TRANSITION_REASON_SEEK

      A seek to another media item has occurred.
      See Also:
        Constant Field Values

    - #### MEDIA_ITEM_TRANSITION_REASON_PLAYLIST_CHANGED

          static final int MEDIA_ITEM_TRANSITION_REASON_PLAYLIST_CHANGED

      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.
      See Also:
        Constant Field Values

    - #### EVENT_TIMELINE_CHANGED

          static final int EVENT_TIMELINE_CHANGED

      `getCurrentTimeline()` changed.
      See Also:
        Constant Field Values

    - #### EVENT_MEDIA_ITEM_TRANSITION

          static final int EVENT_MEDIA_ITEM_TRANSITION

      `getCurrentMediaItem()` changed or the player started repeating the current item.
      See Also:
        Constant Field Values

    - #### EVENT_TRACKS_CHANGED

          static final int EVENT_TRACKS_CHANGED

      `getCurrentTrackGroups()` or `getCurrentTrackSelections()` changed.
      See Also:
        Constant Field Values

    - #### EVENT_STATIC_METADATA_CHANGED

          @Deprecated
          static final int EVENT_STATIC_METADATA_CHANGED

      Deprecated.
      Use `EVENT_MEDIA_METADATA_CHANGED` for structured metadata changes.
      See Also:
        Constant Field Values

    - #### EVENT_IS_LOADING_CHANGED

          static final int EVENT_IS_LOADING_CHANGED

      `isLoading()` ()} changed.
      See Also:
        Constant Field Values

    - #### EVENT_PLAYBACK_STATE_CHANGED

          static final int EVENT_PLAYBACK_STATE_CHANGED

      `getPlaybackState()` changed.
      See Also:
        Constant Field Values

    - #### EVENT_PLAY_WHEN_READY_CHANGED

          static final int EVENT_PLAY_WHEN_READY_CHANGED

      `getPlayWhenReady()` changed.
      See Also:
        Constant Field Values

    - #### EVENT_PLAYBACK_SUPPRESSION_REASON_CHANGED

          static final int EVENT_PLAYBACK_SUPPRESSION_REASON_CHANGED

      `getPlaybackSuppressionReason()` changed.
      See Also:
        Constant Field Values

    - #### EVENT_IS_PLAYING_CHANGED

          static final int EVENT_IS_PLAYING_CHANGED

      `isPlaying()` changed.
      See Also:
        Constant Field Values

    - #### EVENT_REPEAT_MODE_CHANGED

          static final int EVENT_REPEAT_MODE_CHANGED

      `getRepeatMode()` changed.
      See Also:
        Constant Field Values

    - #### EVENT_SHUFFLE_MODE_ENABLED_CHANGED

          static final int EVENT_SHUFFLE_MODE_ENABLED_CHANGED

      `getShuffleModeEnabled()` changed.
      See Also:
        Constant Field Values

    - #### EVENT_PLAYER_ERROR

          static final int EVENT_PLAYER_ERROR

      `getPlayerError()` changed.
      See Also:
        Constant Field Values

    - #### EVENT_POSITION_DISCONTINUITY

          static final int EVENT_POSITION_DISCONTINUITY

      A position discontinuity occurred. See `Player.Listener.onPositionDiscontinuity(PositionInfo, PositionInfo, int)`.
      See Also:
        Constant Field Values

    - #### EVENT_PLAYBACK_PARAMETERS_CHANGED

          static final int EVENT_PLAYBACK_PARAMETERS_CHANGED

      `getPlaybackParameters()` changed.
      See Also:
        Constant Field Values

    - #### EVENT_AVAILABLE_COMMANDS_CHANGED

          static final int EVENT_AVAILABLE_COMMANDS_CHANGED

      `isCommandAvailable(int)` changed for at least one `Player.Command`.
      See Also:
        Constant Field Values

    - #### EVENT_MEDIA_METADATA_CHANGED

          static final int EVENT_MEDIA_METADATA_CHANGED

      `getMediaMetadata()` changed.
      See Also:
        Constant Field Values

    - #### EVENT_PLAYLIST_METADATA_CHANGED

          static final int EVENT_PLAYLIST_METADATA_CHANGED

      `getPlaylistMetadata()` changed.
      See Also:
        Constant Field Values

    - #### EVENT_SEEK_BACK_INCREMENT_CHANGED

          static final int EVENT_SEEK_BACK_INCREMENT_CHANGED

      `getSeekBackIncrement()` changed.
      See Also:
        Constant Field Values

    - #### EVENT_SEEK_FORWARD_INCREMENT_CHANGED

          static final int EVENT_SEEK_FORWARD_INCREMENT_CHANGED

      `getSeekForwardIncrement()` changed.
      See Also:
        Constant Field Values

    - #### EVENT_MAX_SEEK_TO_PREVIOUS_POSITION_CHANGED

          static final int EVENT_MAX_SEEK_TO_PREVIOUS_POSITION_CHANGED

      `getMaxSeekToPreviousPosition()` changed.
      See Also:
        Constant Field Values

    - #### COMMAND_PLAY_PAUSE

          static final int COMMAND_PLAY_PAUSE

      Command to start, pause or resume playback.
      See Also:
        Constant Field Values

    - #### COMMAND_PREPARE_STOP

          static final int COMMAND_PREPARE_STOP

      Command to prepare the player, stop playback or release the player.
      See Also:
        Constant Field Values

    - #### COMMAND_SEEK_TO_DEFAULT_POSITION

          static final int COMMAND_SEEK_TO_DEFAULT_POSITION

      Command to seek to the default position of the current window.
      See Also:
        Constant Field Values

    - #### COMMAND_SEEK_IN_CURRENT_WINDOW

          static final int COMMAND_SEEK_IN_CURRENT_WINDOW

      Command to seek anywhere into the current window.
      See Also:
        Constant Field Values

    - #### COMMAND_SEEK_TO_PREVIOUS_WINDOW

          static final int COMMAND_SEEK_TO_PREVIOUS_WINDOW

      Command to seek to the default position of the previous window.
      See Also:
        Constant Field Values

    - #### COMMAND_SEEK_TO_PREVIOUS

          static final int COMMAND_SEEK_TO_PREVIOUS

      Command to seek to an earlier position in the current or previous window.
      See Also:
        Constant Field Values

    - #### COMMAND_SEEK_TO_NEXT_WINDOW

          static final int COMMAND_SEEK_TO_NEXT_WINDOW

      Command to seek to the default position of the next window.
      See Also:
        Constant Field Values

    - #### COMMAND_SEEK_TO_NEXT

          static final int COMMAND_SEEK_TO_NEXT

      Command to seek to a later position in the current or next window.
      See Also:
        Constant Field Values

    - #### COMMAND_SEEK_TO_WINDOW

          static final int COMMAND_SEEK_TO_WINDOW

      Command to seek anywhere in any window.
      See Also:
        Constant Field Values

    - #### COMMAND_SEEK_BACK

          static final int COMMAND_SEEK_BACK

      Command to seek back by a fixed increment into the current window.
      See Also:
        Constant Field Values

    - #### COMMAND_SEEK_FORWARD

          static final int COMMAND_SEEK_FORWARD

      Command to seek forward by a fixed increment into the current window.
      See Also:
        Constant Field Values

    - #### COMMAND_SET_SPEED_AND_PITCH

          static final int COMMAND_SET_SPEED_AND_PITCH

      Command to set the playback speed and pitch.
      See Also:
        Constant Field Values

    - #### COMMAND_SET_SHUFFLE_MODE

          static final int COMMAND_SET_SHUFFLE_MODE

      Command to enable shuffling.
      See Also:
        Constant Field Values

    - #### COMMAND_SET_REPEAT_MODE

          static final int COMMAND_SET_REPEAT_MODE

      Command to set the repeat mode.
      See Also:
        Constant Field Values

    - #### COMMAND_GET_CURRENT_MEDIA_ITEM

          static final int COMMAND_GET_CURRENT_MEDIA_ITEM

      Command to get the `MediaItem` of the current window.
      See Also:
        Constant Field Values

    - #### COMMAND_GET_TIMELINE

          static final int COMMAND_GET_TIMELINE

      Command to get the information about the current timeline.
      See Also:
        Constant Field Values

    - #### COMMAND_GET_MEDIA_ITEMS_METADATA

          static final int COMMAND_GET_MEDIA_ITEMS_METADATA

      Command to get the `MediaItems` metadata.
      See Also:
        Constant Field Values

    - #### COMMAND_SET_MEDIA_ITEMS_METADATA

          static final int COMMAND_SET_MEDIA_ITEMS_METADATA

      Command to set the `MediaItems` metadata.
      See Also:
        Constant Field Values

    - #### COMMAND_CHANGE_MEDIA_ITEMS

          static final int COMMAND_CHANGE_MEDIA_ITEMS

      Command to change the `MediaItems` in the playlist.
      See Also:
        Constant Field Values

    - #### COMMAND_GET_AUDIO_ATTRIBUTES

          static final int COMMAND_GET_AUDIO_ATTRIBUTES

      Command to get the player current `AudioAttributes`.
      See Also:
        Constant Field Values

    - #### COMMAND_GET_VOLUME

          static final int COMMAND_GET_VOLUME

      Command to get the player volume.
      See Also:
        Constant Field Values

    - #### COMMAND_GET_DEVICE_VOLUME

          static final int COMMAND_GET_DEVICE_VOLUME

      Command to get the device volume and whether it is muted.
      See Also:
        Constant Field Values

    - #### COMMAND_SET_VOLUME

          static final int COMMAND_SET_VOLUME

      Command to set the player volume.
      See Also:
        Constant Field Values

    - #### COMMAND_SET_DEVICE_VOLUME

          static final int COMMAND_SET_DEVICE_VOLUME

      Command to set the device volume and mute it.
      See Also:
        Constant Field Values

    - #### COMMAND_ADJUST_DEVICE_VOLUME

          static final int COMMAND_ADJUST_DEVICE_VOLUME

      Command to increase and decrease the device volume and mute it.
      See Also:
        Constant Field Values

    - #### COMMAND_SET_VIDEO_SURFACE

          static final int COMMAND_SET_VIDEO_SURFACE

      Command to set and clear the surface on which to render the video.
      See Also:
        Constant Field Values

    - #### COMMAND_GET_TEXT

          static final int COMMAND_GET_TEXT

      Command to get the text that should currently be displayed by the player.
      See Also:
        Constant Field Values

    - #### COMMAND_INVALID

          static final int COMMAND_INVALID

      Represents an invalid `Player.Command`.
      See Also:
        Constant Field Values

  - ### Method Detail

    - #### getApplicationLooper

          Looper getApplicationLooper()

      Returns the `Looper` associated with the application thread that's used to access the player and on which player events are received.

    - #### addListener

          @Deprecated
          void addListener​(Player.EventListener listener)

      Deprecated.
      Use `addListener(Listener)` and `removeListener(Listener)` instead.
      Registers a listener to receive events from the player.

      The listener's methods will be called on the thread that was used to construct the player. However, if the thread used to construct the player does not have a `Looper`, then the listener will be called on the main thread.

      Parameters:
        `listener` - The listener to register.

    - #### addListener

          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 that was used to construct the player. However, if the thread used to construct the player does not have a `Looper`, then the listener will be called on the main thread.

      Parameters:
        `listener` - The listener to register.

    - #### removeListener

          @Deprecated
          void removeListener​(Player.EventListener listener)

      Deprecated.
      Use `addListener(Listener)` and `removeListener(Listener)` instead.
      Unregister a listener registered through `addListener(EventListener)`. The listener will no longer receive events from the player.
      Parameters:
        `listener` - The listener to unregister.

    - #### removeListener

          void removeListener​(Player.Listener listener)

      Unregister a listener registered through `addListener(Listener)`. The listener will no longer receive events.
      Parameters:
        `listener` - The listener to unregister.

    - #### setMediaItems

          void setMediaItems​(List<MediaItem> mediaItems)

      Clears the playlist, adds the specified `MediaItems` and resets the position to the default position.
      Parameters:
        `mediaItems` - The new `MediaItems`.

    - #### setMediaItems

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

      Clears the playlist and adds the specified `MediaItems`.
      Parameters:
        `mediaItems` - The new `MediaItems`.
        `resetPosition` - Whether the playback position should be reset to the default position in the first `Timeline.Window`. If false, playback will start from the position defined by `getCurrentWindowIndex()` and `getCurrentPosition()`.

    - #### setMediaItems

          void setMediaItems​(List<MediaItem> mediaItems,
                             int startWindowIndex,
                             long startPositionMs)

      Clears the playlist and adds the specified `MediaItems`.
      Parameters:
        `mediaItems` - The new `MediaItems`.
        `startWindowIndex` - The window index to start playback from. If `C.INDEX_UNSET` is passed, the current position is not reset.
        `startPositionMs` - The position in milliseconds to start playback from. If `C.TIME_UNSET` is passed, the default position of the given window is used. In any case, if `startWindowIndex` is set to `C.INDEX_UNSET`, this parameter is ignored and the position is not reset at all.
      Throws:
        `IllegalSeekPositionException` - If the provided `startWindowIndex` is not within the bounds of the list of media items.

    - #### setMediaItem

          void setMediaItem​(MediaItem mediaItem)

      Clears the playlist, adds the specified `MediaItem` and resets the position to the default position.
      Parameters:
        `mediaItem` - The new `MediaItem`.

    - #### setMediaItem

          void setMediaItem​(MediaItem mediaItem,
                            long startPositionMs)

      Clears the playlist and adds the specified `MediaItem`.
      Parameters:
        `mediaItem` - The new `MediaItem`.
        `startPositionMs` - The position in milliseconds to start playback from.

    - #### setMediaItem

          void setMediaItem​(MediaItem mediaItem,
                            boolean resetPosition)

      Clears the playlist and adds the specified `MediaItem`.
      Parameters:
        `mediaItem` - The new `MediaItem`.
        `resetPosition` - Whether the playback position should be reset to the default position. If false, playback will start from the position defined by `getCurrentWindowIndex()` and `getCurrentPosition()`.

    - #### addMediaItem

          void addMediaItem​(MediaItem mediaItem)

      Adds a media item to the end of the playlist.
      Parameters:
        `mediaItem` - The `MediaItem` to add.

    - #### addMediaItem

          void addMediaItem​(int index,
                            MediaItem mediaItem)

      Adds a media item at the given index of the playlist.
      Parameters:
        `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.
        `mediaItem` - The `MediaItem` to add.

    - #### addMediaItems

          void addMediaItems​(List<MediaItem> mediaItems)

      Adds a list of media items to the end of the playlist.
      Parameters:
        `mediaItems` - The `MediaItems` to add.

    - #### addMediaItems

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

      Adds a list of media items at the given index of the playlist.
      Parameters:
        `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.
        `mediaItems` - The `MediaItems` to add.

    - #### moveMediaItem

          void moveMediaItem​(int currentIndex,
                             int newIndex)

      Moves the media item at the current index to the new index.
      Parameters:
        `currentIndex` - The current index of the media item to move.
        `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

          void moveMediaItems​(int fromIndex,
                              int toIndex,
                              int newIndex)

      Moves the media item range to the new index.
      Parameters:
        `fromIndex` - The start of the range to move.
        `toIndex` - The first item not to be included in the range (exclusive).
        `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.

    - #### removeMediaItem

          void removeMediaItem​(int index)

      Removes the media item at the given index of the playlist.
      Parameters:
        `index` - The index at which to remove the media item.

    - #### removeMediaItems

          void removeMediaItems​(int fromIndex,
                                int toIndex)

      Removes a range of media items from the playlist.
      Parameters:
        `fromIndex` - The index at which to start removing media items.
        `toIndex` - The index of the first item to be kept (exclusive). If the index is larger than the size of the playlist, media items to the end of the playlist are removed.

    - #### clearMediaItems

          void clearMediaItems()

      Clears the playlist.

    - #### isCommandAvailable

          boolean isCommandAvailable​(@Command
                                     int command)

      Returns whether the provided `Player.Command` is available.

      This method does not execute the command.

      Executing a command that is not available (for example, calling `seekToNextWindow()` if `COMMAND_SEEK_TO_NEXT_WINDOW` is unavailable) will neither throw an exception nor generate a `getPlayerError()` player error}.

      `COMMAND_SEEK_TO_PREVIOUS_WINDOW` and `COMMAND_SEEK_TO_NEXT_WINDOW` are unavailable if there is no such `MediaItem`.

      Parameters:
        `command` - A `Player.Command`.
      Returns:
        Whether the `Player.Command` is available.
      See Also:
        `Player.Listener.onAvailableCommandsChanged(Commands)`

    - #### getAvailableCommands

          Player.Commands getAvailableCommands()

      Returns the player's currently available `Player.Commands`.

      The returned `Player.Commands` are not updated when available commands change. Use `Player.Listener.onAvailableCommandsChanged(Commands)` to get an update when the available commands change.

      Executing a command that is not available (for example, calling `seekToNextWindow()` if `COMMAND_SEEK_TO_NEXT_WINDOW` is unavailable) will neither throw an exception nor generate a `getPlayerError()` player error}.

      `COMMAND_SEEK_TO_PREVIOUS_WINDOW` and `COMMAND_SEEK_TO_NEXT_WINDOW` are unavailable if there is no such `MediaItem`.

      Returns:
        The currently available `Player.Commands`.
      See Also:
        `Player.Listener.onAvailableCommandsChanged(com.google.android.exoplayer2.Player.Commands)`

    - #### prepare

          void prepare()

      Prepares the player.

    - #### getPlaybackState

          @State
          int getPlaybackState()

      Returns the current `playback state` of the player.
      Returns:
        The current `playback state`.
      See Also:
        `Player.Listener.onPlaybackStateChanged(int)`

    - #### getPlaybackSuppressionReason

          @PlaybackSuppressionReason
          int getPlaybackSuppressionReason()

      Returns the reason why playback is suppressed even though `getPlayWhenReady()` is `true`, or `PLAYBACK_SUPPRESSION_REASON_NONE` if playback is not suppressed.
      Returns:
        The current `playback suppression reason`.
      See Also:
        `Player.Listener.onPlaybackSuppressionReasonChanged(int)`

    - #### isPlaying

          boolean isPlaying()

      Returns whether the player is playing, i.e. `getCurrentPosition()` is advancing.

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

      - The `playback state` is not `ready`.
      - There is no `intention to play`.
      - Playback is `suppressed for other reasons`.
      Returns:
        Whether the player is playing.
      See Also:
        `Player.Listener.onIsPlayingChanged(boolean)`

    - #### getPlayerError

          @Nullable
          PlaybackException getPlayerError()

      Returns the error that caused playback to fail. This is the same error that will have been reported via `Player.Listener.onPlayerError(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 `getPlaybackState()` is not `STATE_IDLE`.

      Returns:
        The error, or `null`.
      See Also:
        `Player.Listener.onPlayerError(PlaybackException)`

    - #### play

          void play()

      Resumes playback as soon as `getPlaybackState()` == `STATE_READY`. Equivalent to `setPlayWhenReady(true)`.

    - #### pause

          void pause()

      Pauses playback. Equivalent to `setPlayWhenReady(false)`.

    - #### setPlayWhenReady

          void setPlayWhenReady​(boolean playWhenReady)

      Sets whether playback should proceed when `getPlaybackState()` == `STATE_READY`.

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

      Parameters:
        `playWhenReady` - Whether playback should proceed when ready.

    - #### getPlayWhenReady

          boolean getPlayWhenReady()

      Whether playback will proceed when `getPlaybackState()` == `STATE_READY`.
      Returns:
        Whether playback will proceed when ready.
      See Also:
        `Player.Listener.onPlayWhenReadyChanged(boolean, int)`

    - #### setRepeatMode

          void setRepeatMode​(@RepeatMode
                             int repeatMode)

      Sets the `Player.RepeatMode` to be used for playback.
      Parameters:
        `repeatMode` - The repeat mode.

    - #### getRepeatMode

          @RepeatMode
          int getRepeatMode()

      Returns the current `Player.RepeatMode` used for playback.
      Returns:
        The current repeat mode.
      See Also:
        `Player.Listener.onRepeatModeChanged(int)`

    - #### setShuffleModeEnabled

          void setShuffleModeEnabled​(boolean shuffleModeEnabled)

      Sets whether shuffling of windows is enabled.
      Parameters:
        `shuffleModeEnabled` - Whether shuffling is enabled.

    - #### getShuffleModeEnabled

          boolean getShuffleModeEnabled()

      Returns whether shuffling of windows is enabled.
      See Also:
        `Player.Listener.onShuffleModeEnabledChanged(boolean)`

    - #### isLoading

          boolean isLoading()

      Whether the player is currently loading the source.
      Returns:
        Whether the player is currently loading the source.
      See Also:
        `Player.Listener.onIsLoadingChanged(boolean)`

    - #### seekToDefaultPosition

          void seekToDefaultPosition()

      Seeks to the default position associated with the current window. The position can depend on the type of media being played. For live streams it will typically be the live edge of the window. For other streams it will typically be the start of the window.

    - #### seekToDefaultPosition

          void seekToDefaultPosition​(int windowIndex)

      Seeks to the default position associated with the specified window. The position can depend on the type of media being played. For live streams it will typically be the live edge of the window. For other streams it will typically be the start of the window.
      Parameters:
        `windowIndex` - The index of the window whose associated default position should be seeked to.
      Throws:
        `IllegalSeekPositionException` - If the player has a non-empty timeline and the provided `windowIndex` is not within the bounds of the current timeline.

    - #### seekTo

          void seekTo​(long positionMs)

      Seeks to a position specified in milliseconds in the current window.
      Parameters:
        `positionMs` - The seek position in the current window, or `C.TIME_UNSET` to seek to the window's default position.

    - #### seekTo

          void seekTo​(int windowIndex,
                      long positionMs)

      Seeks to a position specified in milliseconds in the specified window.
      Parameters:
        `windowIndex` - The index of the window.
        `positionMs` - The seek position in the specified window, or `C.TIME_UNSET` to seek to the window's default position.
      Throws:
        `IllegalSeekPositionException` - If the player has a non-empty timeline and the provided `windowIndex` is not within the bounds of the current timeline.

    - #### getSeekBackIncrement

          long getSeekBackIncrement()

      Returns the `seekBack()` increment.
      Returns:
        The seek back increment, in milliseconds.
      See Also:
        `Player.Listener.onSeekBackIncrementChanged(long)`

    - #### seekBack

          void seekBack()

      Seeks back in the current window by `getSeekBackIncrement()` milliseconds.

    - #### getSeekForwardIncrement

          long getSeekForwardIncrement()

      Returns the `seekForward()` increment.
      Returns:
        The seek forward increment, in milliseconds.
      See Also:
        `Player.Listener.onSeekForwardIncrementChanged(long)`

    - #### seekForward

          void seekForward()

      Seeks forward in the current window by `getSeekForwardIncrement()` milliseconds.

    - #### hasPrevious

          @Deprecated
          boolean hasPrevious()

      Deprecated.
      Use `hasPreviousWindow()` instead.

    - #### hasPreviousWindow

          boolean hasPreviousWindow()

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

      Note: When the repeat mode is `REPEAT_MODE_ONE`, this method behaves the same as when the current repeat mode is `REPEAT_MODE_OFF`. See `REPEAT_MODE_ONE` for more details.

    - #### previous

          @Deprecated
          void previous()

      Deprecated.
      Use `seekToPreviousWindow()` instead.

    - #### seekToPreviousWindow

          void seekToPreviousWindow()

      Seeks to the default position of the previous window, which may depend on the current repeat mode and whether shuffle mode is enabled. Does nothing if `hasPreviousWindow()` is `false`.

      Note: When the repeat mode is `REPEAT_MODE_ONE`, this method behaves the same as when the current repeat mode is `REPEAT_MODE_OFF`. See `REPEAT_MODE_ONE` for more details.

    - #### getMaxSeekToPreviousPosition

          int getMaxSeekToPreviousPosition()

      Returns the maximum position for which `seekToPrevious()` seeks to the previous window, in milliseconds.
      Returns:
        The maximum seek to previous position, in milliseconds.
      See Also:
        `Player.EventListener.onMaxSeekToPreviousPositionChanged(int)`

    - #### seekToPrevious

          void seekToPrevious()

      Seeks to an earlier position in the current or previous window (if available). More precisely:
      - If the timeline is empty or seeking is not possible, does nothing.
      - Otherwise, if the current window is `live` and `unseekable`, then:
        - If `a previous window exists`, seeks to the default position of the previous window.
        - Otherwise, does nothing.
      - Otherwise, if `a previous window exists` and the `current position` is less than `getMaxSeekToPreviousPosition()`, seeks to the default position of the previous window.
      - Otherwise, seeks to 0 in the current window.

    - #### hasNext

          @Deprecated
          boolean hasNext()

      Deprecated.
      Use `hasNextWindow()` instead.

    - #### hasNextWindow

          boolean hasNextWindow()

      Returns whether a next window exists, which may depend on the current repeat mode and whether shuffle mode is enabled.

      Note: When the repeat mode is `REPEAT_MODE_ONE`, this method behaves the same as when the current repeat mode is `REPEAT_MODE_OFF`. See `REPEAT_MODE_ONE` for more details.

    - #### next

          @Deprecated
          void next()

      Deprecated.
      Use `seekToNextWindow()` instead.

    - #### seekToNextWindow

          void seekToNextWindow()

      Seeks to the default position of the next window, which may depend on the current repeat mode and whether shuffle mode is enabled. Does nothing if `hasNextWindow()` is `false`.

      Note: When the repeat mode is `REPEAT_MODE_ONE`, this method behaves the same as when the current repeat mode is `REPEAT_MODE_OFF`. See `REPEAT_MODE_ONE` for more details.

    - #### seekToNext

          void seekToNext()

      Seeks to a later position in the current or next window (if available). More precisely:
      - If the timeline is empty or seeking is not possible, does nothing.
      - Otherwise, if `a next window exists`, seeks to the default position of the next window.
      - Otherwise, if the current window is `live` and has not ended, seeks to the live edge of the current window.
      - Otherwise, does nothing.

    - #### setPlaybackParameters

          void setPlaybackParameters​(PlaybackParameters playbackParameters)

      Attempts to set the playback parameters. Passing `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. `Player.Listener.onPlaybackParametersChanged(PlaybackParameters)` will be called whenever the currently active playback parameters change.

      Parameters:
        `playbackParameters` - The playback parameters.

    - #### setPlaybackSpeed

          void setPlaybackSpeed​(float speed)

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

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

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

    - #### getPlaybackParameters

          PlaybackParameters getPlaybackParameters()

      Returns the currently active playback parameters.
      See Also:
        `Player.Listener.onPlaybackParametersChanged(PlaybackParameters)`

    - #### stop

          void stop()

      Stops playback without resetting the player. Use `pause()` rather than this method if the intention is to pause playback.

      Calling this method will cause the playback state to transition to `STATE_IDLE`. The player instance can still be used, and `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.

    - #### stop

          @Deprecated
          void stop​(boolean reset)

      Deprecated.
      Use `stop()` and `clearMediaItems()` (if `reset` is true) or just `stop()` (if `reset` is false). Any player error will be cleared when `re-preparing` the player.

    - #### release

          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.

    - #### getCurrentTrackGroups

          TrackGroupArray getCurrentTrackGroups()

      Returns the available track groups.
      See Also:
        `Player.Listener.onTracksChanged(TrackGroupArray, TrackSelectionArray)`

    - #### getCurrentTrackSelections

          TrackSelectionArray getCurrentTrackSelections()

      Returns the current track selections.

      A concrete implementation may include null elements if it has a fixed number of renderer components, wishes to report a TrackSelection for each of them, and has one or more renderer components that is not assigned any selected tracks.

      See Also:
        `Player.Listener.onTracksChanged(TrackGroupArray, TrackSelectionArray)`

    - #### getCurrentStaticMetadata

          @Deprecated
          List<Metadata> getCurrentStaticMetadata()

      Deprecated.
      Use `getMediaMetadata()` and `Player.Listener.onMediaMetadataChanged(MediaMetadata)` for access to structured metadata, or access the raw static metadata directly from the `track selections' formats`.

    - #### getMediaMetadata

          MediaMetadata getMediaMetadata()

      Returns the current combined `MediaMetadata`, or `MediaMetadata.EMPTY` if not supported.

      This `MediaMetadata` is a combination of the `MediaItem.mediaMetadata` and the static and dynamic metadata from the `track selections' formats` and `MetadataOutput.onMetadata(Metadata)`.

    - #### getPlaylistMetadata

          MediaMetadata getPlaylistMetadata()

      Returns the playlist `MediaMetadata`, as set by `setPlaylistMetadata(MediaMetadata)`, or `MediaMetadata.EMPTY` if not supported.

    - #### setPlaylistMetadata

          void setPlaylistMetadata​(MediaMetadata mediaMetadata)

      Sets the playlist `MediaMetadata`.

    - #### getCurrentManifest

          @Nullable
          Object getCurrentManifest()

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

    - #### getCurrentTimeline

          Timeline getCurrentTimeline()

      Returns the current `Timeline`. Never null, but may be empty.
      See Also:
        `Player.Listener.onTimelineChanged(Timeline, int)`

    - #### getCurrentPeriodIndex

          int getCurrentPeriodIndex()

      Returns the index of the period currently being played.

    - #### getCurrentWindowIndex

          int getCurrentWindowIndex()

      Returns the index of the current `window` in the `timeline`, or the prospective window index if the `current timeline` is empty.

    - #### getNextWindowIndex

          int getNextWindowIndex()

      Returns the index of the window that will be played if `seekToNextWindow()` is called, which may depend on the current repeat mode and whether shuffle mode is enabled. Returns `C.INDEX_UNSET` if `hasNextWindow()` is `false`.

      Note: When the repeat mode is `REPEAT_MODE_ONE`, this method behaves the same as when the current repeat mode is `REPEAT_MODE_OFF`. See `REPEAT_MODE_ONE` for more details.

    - #### getPreviousWindowIndex

          int getPreviousWindowIndex()

      Returns the index of the window that will be played if `seekToPreviousWindow()` is called, which may depend on the current repeat mode and whether shuffle mode is enabled. Returns `C.INDEX_UNSET` if `hasPreviousWindow()` is `false`.

      Note: When the repeat mode is `REPEAT_MODE_ONE`, this method behaves the same as when the current repeat mode is `REPEAT_MODE_OFF`. See `REPEAT_MODE_ONE` for more details.

    - #### getCurrentMediaItem

          @Nullable
          MediaItem getCurrentMediaItem()

      Returns the media item of the current window in the timeline. May be null if the timeline is empty.
      See Also:
        `Player.Listener.onMediaItemTransition(MediaItem, int)`

    - #### getMediaItemCount

          int getMediaItemCount()

      Returns the number of `media items` in the playlist.

    - #### getMediaItemAt

          MediaItem getMediaItemAt​(int index)

      Returns the `MediaItem` at the given index.

    - #### getDuration

          long getDuration()

      Returns the duration of the current content window or ad in milliseconds, or `C.TIME_UNSET` if the duration is not known.

    - #### getCurrentPosition

          long getCurrentPosition()

      Returns the playback position in the current content window or ad, in milliseconds, or the prospective position in milliseconds if the `current timeline` is empty.

    - #### getBufferedPosition

          long getBufferedPosition()

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

    - #### getBufferedPercentage

          int getBufferedPercentage()

      Returns an estimate of the percentage in the current content window or ad up to which data is buffered, or 0 if no estimate is available.

    - #### getTotalBufferedDuration

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

    - #### isCurrentWindowDynamic

          boolean isCurrentWindowDynamic()

      Returns whether the current window is dynamic, or `false` if the `Timeline` is empty.
      See Also:
        `Timeline.Window.isDynamic`

    - #### isCurrentWindowLive

          boolean isCurrentWindowLive()

      Returns whether the current window is live, or `false` if the `Timeline` is empty.
      See Also:
        `Timeline.Window.isLive()`

    - #### getCurrentLiveOffset

          long getCurrentLiveOffset()

      Returns the offset of the current playback position from the live edge in milliseconds, or `C.TIME_UNSET` if the current window `isn't live` 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.

    - #### isCurrentWindowSeekable

          boolean isCurrentWindowSeekable()

      Returns whether the current window is seekable, or `false` if the `Timeline` is empty.
      See Also:
        `Timeline.Window.isSeekable`

    - #### isPlayingAd

          boolean isPlayingAd()

      Returns whether the player is currently playing an ad.

    - #### getCurrentAdGroupIndex

          int getCurrentAdGroupIndex()

      If `isPlayingAd()` returns true, returns the index of the ad group in the period currently being played. Returns `C.INDEX_UNSET` otherwise.

    - #### getCurrentAdIndexInAdGroup

          int getCurrentAdIndexInAdGroup()

      If `isPlayingAd()` returns true, returns the index of the ad in its ad group. Returns `C.INDEX_UNSET` otherwise.

    - #### getContentDuration

          long getContentDuration()

      If `isPlayingAd()` returns `true`, returns the duration of the current content window in milliseconds, or `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 `getDuration()`.

    - #### getContentPosition

          long getContentPosition()

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

    - #### getContentBufferedPosition

          long getContentBufferedPosition()

      If `isPlayingAd()` returns `true`, returns an estimate of the content position in the current content window up to which data is buffered, in milliseconds. If there is no ad playing, the returned position is the same as that returned by `getBufferedPosition()`.

    - #### getAudioAttributes

          AudioAttributes getAudioAttributes()

      Returns the attributes for audio playback.

    - #### setVolume

          void setVolume​(float audioVolume)

      Sets the audio volume, with 0 being silence and 1 being unity gain (signal unchanged).
      Parameters:
        `audioVolume` - Linear output gain to apply to all audio channels.

    - #### getVolume

          float getVolume()

      Returns the audio volume, with 0 being silence and 1 being unity gain (signal unchanged).
      Returns:
        The linear gain applied to all audio channels.

    - #### clearVideoSurface

          void clearVideoSurface()

      Clears any `Surface`, `SurfaceHolder`, `SurfaceView` or `TextureView` currently set on the player.

    - #### clearVideoSurface

          void clearVideoSurface​(@Nullable
                                 Surface surface)

      Clears the `Surface` onto which video is being rendered if it matches the one passed. Else does nothing.
      Parameters:
        `surface` - The surface to clear.

    - #### setVideoSurface

          void setVideoSurface​(@Nullable
                               Surface surface)

      Sets the `Surface` 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 `SurfaceView`, `TextureView` or `SurfaceHolder` then it's recommended to use `setVideoSurfaceView(SurfaceView)`, `setVideoTextureView(TextureView)` or `setVideoSurfaceHolder(SurfaceHolder)` rather than this method, since passing the holder allows the player to track the lifecycle of the surface automatically.

      Parameters:
        `surface` - The `Surface`.

    - #### setVideoSurfaceHolder

          void setVideoSurfaceHolder​(@Nullable
                                     SurfaceHolder surfaceHolder)

      Sets the `SurfaceHolder` that holds the `Surface` onto which video will be rendered. The player will track the lifecycle of the surface automatically.

      The thread that calls the `SurfaceHolder.Callback` methods must be the thread associated with `getApplicationLooper()`.

      Parameters:
        `surfaceHolder` - The surface holder.

    - #### clearVideoSurfaceHolder

          void clearVideoSurfaceHolder​(@Nullable
                                       SurfaceHolder surfaceHolder)

      Clears the `SurfaceHolder` that holds the `Surface` onto which video is being rendered if it matches the one passed. Else does nothing.
      Parameters:
        `surfaceHolder` - The surface holder to clear.

    - #### setVideoSurfaceView

          void setVideoSurfaceView​(@Nullable
                                   SurfaceView surfaceView)

      Sets the `SurfaceView` onto which video will be rendered. The player will track the lifecycle of the surface automatically.

      The thread that calls the `SurfaceHolder.Callback` methods must be the thread associated with `getApplicationLooper()`.

      Parameters:
        `surfaceView` - The surface view.

    - #### clearVideoSurfaceView

          void clearVideoSurfaceView​(@Nullable
                                     SurfaceView surfaceView)

      Clears the `SurfaceView` onto which video is being rendered if it matches the one passed. Else does nothing.
      Parameters:
        `surfaceView` - The texture view to clear.

    - #### setVideoTextureView

          void setVideoTextureView​(@Nullable
                                   TextureView textureView)

      Sets the `TextureView` onto which video will be rendered. The player will track the lifecycle of the surface automatically.

      The thread that calls the `TextureView.SurfaceTextureListener` methods must be the thread associated with `getApplicationLooper()`.

      Parameters:
        `textureView` - The texture view.

    - #### clearVideoTextureView

          void clearVideoTextureView​(@Nullable
                                     TextureView textureView)

      Clears the `TextureView` onto which video is being rendered if it matches the one passed. Else does nothing.
      Parameters:
        `textureView` - The texture view to clear.

    - #### getVideoSize

          VideoSize getVideoSize()

      Gets the size of the video.

      The video's width and height are `0` if there is no video or its size has not been determined yet.

      See Also:
        `Player.Listener.onVideoSizeChanged(VideoSize)`

    - #### getCurrentCues

          List<Cue> getCurrentCues()

      Returns the current `Cues`. This list may be empty.

    - #### getDeviceInfo

          DeviceInfo getDeviceInfo()

      Gets the device information.

    - #### getDeviceVolume

          int getDeviceVolume()

      Gets the current volume of the device.

      For devices with `local playback`, the volume returned by this method varies according to the current `stream type`. The stream type is determined by `AudioAttributes.usage` which can be converted to stream type with `Util.getStreamTypeForAudioUsage(int)`.

      For devices with `remote playback`, the volume of the remote device is returned.

    - #### isDeviceMuted

          boolean isDeviceMuted()

      Gets whether the device is muted or not.

    - #### setDeviceVolume

          void setDeviceVolume​(int volume)

      Sets the volume of the device.
      Parameters:
        `volume` - The volume to set.

    - #### increaseDeviceVolume

          void increaseDeviceVolume()

      Increases the volume of the device.

    - #### decreaseDeviceVolume

          void decreaseDeviceVolume()

      Decreases the volume of the device.

    - #### setDeviceMuted

          void setDeviceMuted​(boolean muted)

      Sets the mute state of the device.