Package com.google.android.exoplayer2

## Interface Player

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

      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.

  All methods must be called from a single application thread unless indicated otherwise. Callbacks in registered listeners are called on the same thread.

  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 `Tracks` defining the currently available tracks and which are selected to be rendered, which can be obtained by calling `getCurrentTracks()`.

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Interface | Description
    --- | --- | ---
    `static interface` | `Player.Command` | Commands that indicate which method calls are currently permitted on a particular `Player` instance.
    `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 class` | `Player.Events` | A set of events.
    `static interface` | `Player.Listener` | Listener for changes in a `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 media items 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 information about the currently playing `MediaItem`.
    `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 metadata related to the playlist and current `MediaItem`.
    `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_TRACKS` | Command to get details of the current track selection.
    `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` | Command to prepare the player.
    `static int` | `COMMAND_SEEK_BACK` | Command to seek back by a fixed increment inside the current `MediaItem`.
    `static int` | `COMMAND_SEEK_FORWARD` | Command to seek forward by a fixed increment inside the current `MediaItem`.
    `static int` | `COMMAND_SEEK_IN_CURRENT_MEDIA_ITEM` | Command to seek anywhere inside the current `MediaItem`.
    `static int` | `COMMAND_SEEK_IN_CURRENT_WINDOW` | Deprecated. Use `COMMAND_SEEK_IN_CURRENT_MEDIA_ITEM` instead.
    `static int` | `COMMAND_SEEK_TO_DEFAULT_POSITION` | Command to seek to the default position of the current `MediaItem`.
    `static int` | `COMMAND_SEEK_TO_MEDIA_ITEM` | Command to seek anywhere in any `MediaItem`.
    `static int` | `COMMAND_SEEK_TO_NEXT` | Command to seek to a later position in the current `MediaItem` or the default position of the next `MediaItem`.
    `static int` | `COMMAND_SEEK_TO_NEXT_MEDIA_ITEM` | Command to seek to the default position of the next `MediaItem`.
    `static int` | `COMMAND_SEEK_TO_NEXT_WINDOW` | Deprecated. Use `COMMAND_SEEK_TO_NEXT_MEDIA_ITEM` instead.
    `static int` | `COMMAND_SEEK_TO_PREVIOUS` | Command to seek to an earlier position in the current `MediaItem` or the default position of the previous `MediaItem`.
    `static int` | `COMMAND_SEEK_TO_PREVIOUS_MEDIA_ITEM` | Command to seek to the default position of the previous `MediaItem`.
    `static int` | `COMMAND_SEEK_TO_PREVIOUS_WINDOW` | Deprecated. Use `COMMAND_SEEK_TO_PREVIOUS_MEDIA_ITEM` instead.
    `static int` | `COMMAND_SEEK_TO_WINDOW` | Deprecated. Use `COMMAND_SEEK_TO_MEDIA_ITEM` instead.
    `static int` | `COMMAND_SET_DEVICE_VOLUME` | Command to set the device volume.
    `static int` | `COMMAND_SET_MEDIA_ITEM` | Command to set a `MediaItem`.
    `static int` | `COMMAND_SET_MEDIA_ITEMS_METADATA` | Command to set the playlist 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_TRACK_SELECTION_PARAMETERS` | Command to set the player's track selection parameters.
    `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` | `COMMAND_STOP` | Command to stop playback.
    `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_AUDIO_ATTRIBUTES_CHANGED` | `getAudioAttributes()` changed.
    `static int` | `EVENT_AUDIO_SESSION_ID` | The audio session id was set.
    `static int` | `EVENT_AVAILABLE_COMMANDS_CHANGED` | `isCommandAvailable(int)` changed for at least one `Player.Command`.
    `static int` | `EVENT_CUES` | `getCurrentCues()` changed.
    `static int` | `EVENT_DEVICE_INFO_CHANGED` | `getDeviceInfo()` changed.
    `static int` | `EVENT_DEVICE_VOLUME_CHANGED` | `getDeviceVolume()` changed.
    `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_METADATA` | Metadata associated with the current playback time 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_RENDERED_FIRST_FRAME` | A frame is rendered for the first time since setting the surface, or since the renderer was reset, or since the stream being rendered was changed.
    `static 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_SKIP_SILENCE_ENABLED_CHANGED` | Skipping silences in the audio stream is enabled or disabled.
    `static int` | `EVENT_SURFACE_SIZE_CHANGED` | The size of the surface onto which the video is being rendered changed.
    `static int` | `EVENT_TIMELINE_CHANGED` | `getCurrentTimeline()` changed.
    `static int` | `EVENT_TRACK_SELECTION_PARAMETERS_CHANGED` | `getTrackSelectionParameters()` changed.
    `static int` | `EVENT_TRACKS_CHANGED` | `getCurrentTracks()` changed.
    `static int` | `EVENT_VIDEO_SIZE_CHANGED` | `getVideoSize()` changed.
    `static int` | `EVENT_VOLUME_CHANGED` | `getVolume()` 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 `MediaItem` 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, meaning it holds only limited resources.
    `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.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.
    `boolean` | `canAdvertiseSession()` | Returns whether the player can be used to advertise a media session.
    `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 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 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 up to which data is buffered, in milliseconds.
    `long` | `getContentDuration()` | If `isPlayingAd()` returns `true`, returns the duration of the current content 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.
    `CueGroup` | `getCurrentCues()` | Returns the current `CueGroup`.
    `long` | `getCurrentLiveOffset()` | Returns the offset of the current playback position from the live edge in milliseconds, or `C.TIME_UNSET` if the current `MediaItem` `isCurrentMediaItemLive()` isn't live} or the offset is unknown.
    `Object` | `getCurrentManifest()` | Returns the current manifest.
    `MediaItem` | `getCurrentMediaItem()` | Returns the currently playing `MediaItem`.
    `int` | `getCurrentMediaItemIndex()` | Returns the index of the current `MediaItem` in the `timeline`, or the prospective index if the `current timeline` is empty.
    `int` | `getCurrentPeriodIndex()` | Returns the index of the period currently being played.
    `long` | `getCurrentPosition()` | Returns the playback position in the current content or ad, in milliseconds, or the prospective position in milliseconds if the `current timeline` is empty.
    `Timeline` | `getCurrentTimeline()` | Returns the current `Timeline`.
    `Tracks` | `getCurrentTracks()` | Returns the current tracks.
    `int` | `getCurrentWindowIndex()` | Deprecated. Use `getCurrentMediaItemIndex()` instead.
    `DeviceInfo` | `getDeviceInfo()` | Gets the device information.
    `int` | `getDeviceVolume()` | Gets the current volume of the device.
    `long` | `getDuration()` | Returns the duration of the current content or ad in milliseconds, or `C.TIME_UNSET` if the duration is not known.
    `long` | `getMaxSeekToPreviousPosition()` | Returns the maximum position for which `seekToPrevious()` seeks to the previous `MediaItem`, 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` | `getNextMediaItemIndex()` | Returns the index of the `MediaItem` that will be played if `seekToNextMediaItem()` is called, which may depend on the current repeat mode and whether shuffle mode is enabled.
    `int` | `getNextWindowIndex()` | Deprecated. Use `getNextMediaItemIndex()` instead.
    `PlaybackParameters` | `getPlaybackParameters()` | Returns the currently active playback parameters.
    `@com.google.android.exoplayer2.Player.State int` | `getPlaybackState()` | Returns the current playback state of the player.
    `@com.google.android.exoplayer2.Player.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.
    `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` | `getPreviousMediaItemIndex()` | Returns the index of the `MediaItem` that will be played if `seekToPreviousMediaItem()` is called, which may depend on the current repeat mode and whether shuffle mode is enabled.
    `int` | `getPreviousWindowIndex()` | Deprecated. Use `getPreviousMediaItemIndex()` instead.
    `@com.google.android.exoplayer2.Player.RepeatMode 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 media items is enabled.
    `Size` | `getSurfaceSize()` | Gets the size of the surface on which the video is rendered.
    `long` | `getTotalBufferedDuration()` | Returns an estimate of the total buffered duration from the current position, in milliseconds.
    `TrackSelectionParameters` | `getTrackSelectionParameters()` | Returns the parameters constraining the track selection.
    `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 `hasNextMediaItem()` instead.
    `boolean` | `hasNextMediaItem()` | Returns whether a next `MediaItem` exists, which may depend on the current repeat mode and whether shuffle mode is enabled.
    `boolean` | `hasNextWindow()` | Deprecated. Use `hasNextMediaItem()` instead.
    `boolean` | `hasPrevious()` | Deprecated. Use `hasPreviousMediaItem()` instead.
    `boolean` | `hasPreviousMediaItem()` | Returns whether a previous media item exists, which may depend on the current repeat mode and whether shuffle mode is enabled.
    `boolean` | `hasPreviousWindow()` | Deprecated. Use `hasPreviousMediaItem()` instead.
    `void` | `increaseDeviceVolume()` | Increases the volume of the device.
    `boolean` | `isCommandAvailable​(@com.google.android.exoplayer2.Player.Command int command)` | Returns whether the provided `Player.Command` is available.
    `boolean` | `isCurrentMediaItemDynamic()` | Returns whether the current `MediaItem` is dynamic (may change when the `Timeline` is updated), or `false` if the `Timeline` is empty.
    `boolean` | `isCurrentMediaItemLive()` | Returns whether the current `MediaItem` is live, or `false` if the `Timeline` is empty.
    `boolean` | `isCurrentMediaItemSeekable()` | Returns whether the current `MediaItem` is seekable, or `false` if the `Timeline` is empty.
    `boolean` | `isCurrentWindowDynamic()` | Deprecated. Use `isCurrentMediaItemDynamic()` instead.
    `boolean` | `isCurrentWindowLive()` | Deprecated. Use `isCurrentMediaItemLive()` instead.
    `boolean` | `isCurrentWindowSeekable()` | Deprecated. Use `isCurrentMediaItemSeekable()` instead.
    `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 `seekToNextMediaItem()` instead.
    `void` | `pause()` | Pauses playback.
    `void` | `play()` | Resumes playback as soon as `getPlaybackState()` == `STATE_READY`.
    `void` | `prepare()` | Prepares the player.
    `void` | `previous()` | Deprecated. Use `seekToPreviousMediaItem()` instead.
    `void` | `release()` | Releases the player.
    `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 `MediaItem` by `getSeekBackIncrement()` milliseconds.
    `void` | `seekForward()` | Seeks forward in the current `MediaItem` by `getSeekForwardIncrement()` milliseconds.
    `void` | `seekTo​(int mediaItemIndex, long positionMs)` | Seeks to a position specified in milliseconds in the specified `MediaItem`.
    `void` | `seekTo​(long positionMs)` | Seeks to a position specified in milliseconds in the current `MediaItem`.
    `void` | `seekToDefaultPosition()` | Seeks to the default position associated with the current `MediaItem`.
    `void` | `seekToDefaultPosition​(int mediaItemIndex)` | Seeks to the default position associated with the specified `MediaItem`.
    `void` | `seekToNext()` | Seeks to a later position in the current or next `MediaItem` (if available).
    `void` | `seekToNextMediaItem()` | Seeks to the default position of the next `MediaItem`, which may depend on the current repeat mode and whether shuffle mode is enabled.
    `void` | `seekToNextWindow()` | Deprecated. Use `seekToNextMediaItem()` instead.
    `void` | `seekToPrevious()` | Seeks to an earlier position in the current or previous `MediaItem` (if available).
    `void` | `seekToPreviousMediaItem()` | Seeks to the default position of the previous `MediaItem`, which may depend on the current repeat mode and whether shuffle mode is enabled.
    `void` | `seekToPreviousWindow()` | Deprecated. Use `seekToPreviousMediaItem()` instead.
    `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 media items and resets the position to the default position.
    `void` | `setMediaItems​(List<MediaItem> mediaItems, boolean resetPosition)` | Clears the playlist and adds the specified media items.
    `void` | `setMediaItems​(List<MediaItem> mediaItems, int startIndex, long startPositionMs)` | Clears the playlist and adds the specified media items.
    `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​(@com.google.android.exoplayer2.Player.RepeatMode int repeatMode)` | Sets the `Player.RepeatMode` to be used for playback.
    `void` | `setShuffleModeEnabled​(boolean shuffleModeEnabled)` | Sets whether shuffling of media items is enabled.
    `void` | `setTrackSelectionParameters​(TrackSelectionParameters parameters)` | Sets the parameters constraining the track selection.
    `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 volume)` | Sets the audio volume, valid values are between 0 (silence) and 1 (unity gain, signal unchanged), inclusive.
    `void` | `stop()` | Stops playback without resetting the playlist.
    `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, meaning it holds only limited resources. The player 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 `MediaItem` respectively, and do nothing when there is no previous or next `MediaItem` to move to.
      See Also:
        Constant Field Values

    - #### REPEAT_MODE_ONE

          static final int REPEAT_MODE_ONE

      Repeats the currently playing `MediaItem` infinitely during ongoing playback. "Previous" and "Next" actions behave as they do in `REPEAT_MODE_OFF`, moving to the previous and next `MediaItem` respectively, and doing nothing when there is no previous or next `MediaItem` 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 `MediaItem` will move to the last `MediaItem`, and "Next" when playing the last `MediaItem` will move to the first `MediaItem`.
      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

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

    - #### EVENT_TRACK_SELECTION_PARAMETERS_CHANGED

          static final int EVENT_TRACK_SELECTION_PARAMETERS_CHANGED

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

    - #### EVENT_AUDIO_ATTRIBUTES_CHANGED

          static final int EVENT_AUDIO_ATTRIBUTES_CHANGED

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

    - #### EVENT_AUDIO_SESSION_ID

          static final int EVENT_AUDIO_SESSION_ID

      The audio session id was set.
      See Also:
        Constant Field Values

    - #### EVENT_VOLUME_CHANGED

          static final int EVENT_VOLUME_CHANGED

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

    - #### EVENT_SKIP_SILENCE_ENABLED_CHANGED

          static final int EVENT_SKIP_SILENCE_ENABLED_CHANGED

      Skipping silences in the audio stream is enabled or disabled.
      See Also:
        Constant Field Values

    - #### EVENT_SURFACE_SIZE_CHANGED

          static final int EVENT_SURFACE_SIZE_CHANGED

      The size of the surface onto which the video is being rendered changed.
      See Also:
        Constant Field Values

    - #### EVENT_VIDEO_SIZE_CHANGED

          static final int EVENT_VIDEO_SIZE_CHANGED

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

    - #### EVENT_RENDERED_FIRST_FRAME

          static final int EVENT_RENDERED_FIRST_FRAME

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

    - #### EVENT_CUES

          static final int EVENT_CUES

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

    - #### EVENT_METADATA

          static final int EVENT_METADATA

      Metadata associated with the current playback time changed.
      See Also:
        Constant Field Values

    - #### EVENT_DEVICE_INFO_CHANGED

          static final int EVENT_DEVICE_INFO_CHANGED

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

    - #### EVENT_DEVICE_VOLUME_CHANGED

          static final int EVENT_DEVICE_VOLUME_CHANGED

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

    - #### COMMAND_PLAY_PAUSE

          static final int COMMAND_PLAY_PAUSE

      Command to start, pause or resume playback.

      The following methods must only be called if this command is available:

      - `play()`
      - `pause()`
      - `setPlayWhenReady(boolean)`
      See Also:
        Constant Field Values

    - #### COMMAND_PREPARE

          static final int COMMAND_PREPARE

      Command to prepare the player.

      The `prepare()` method must only be called if this command is available.

      See Also:
        Constant Field Values

    - #### COMMAND_STOP

          static final int COMMAND_STOP

      Command to stop playback.

      The `stop()` method must only be called if this command is available.

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

      The `seekToDefaultPosition()` method must only be called if this command is available.

      See Also:
        Constant Field Values

    - #### COMMAND_SEEK_IN_CURRENT_MEDIA_ITEM

          static final int COMMAND_SEEK_IN_CURRENT_MEDIA_ITEM

      Command to seek anywhere inside the current `MediaItem`.

      The `seekTo(long)` method must only be called if this command is available.

      See Also:
        Constant Field Values

    - #### COMMAND_SEEK_IN_CURRENT_WINDOW

          @Deprecated
          static final int COMMAND_SEEK_IN_CURRENT_WINDOW

      Deprecated.
      Use `COMMAND_SEEK_IN_CURRENT_MEDIA_ITEM` instead.
      See Also:
        Constant Field Values

    - #### COMMAND_SEEK_TO_PREVIOUS_MEDIA_ITEM

          static final int COMMAND_SEEK_TO_PREVIOUS_MEDIA_ITEM

      Command to seek to the default position of the previous `MediaItem`.

      The `seekToPreviousMediaItem()` method must only be called if this command is available.

      See Also:
        Constant Field Values

    - #### COMMAND_SEEK_TO_PREVIOUS_WINDOW

          @Deprecated
          static final int COMMAND_SEEK_TO_PREVIOUS_WINDOW

      Deprecated.
      Use `COMMAND_SEEK_TO_PREVIOUS_MEDIA_ITEM` instead.
      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 `MediaItem` or the default position of the previous `MediaItem`.

      The `seekToPrevious()` method must only be called if this command is available.

      See Also:
        Constant Field Values

    - #### COMMAND_SEEK_TO_NEXT_MEDIA_ITEM

          static final int COMMAND_SEEK_TO_NEXT_MEDIA_ITEM

      Command to seek to the default position of the next `MediaItem`.

      The `seekToNextMediaItem()` method must only be called if this command is available.

      See Also:
        Constant Field Values

    - #### COMMAND_SEEK_TO_NEXT_WINDOW

          @Deprecated
          static final int COMMAND_SEEK_TO_NEXT_WINDOW

      Deprecated.
      Use `COMMAND_SEEK_TO_NEXT_MEDIA_ITEM` instead.
      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 `MediaItem` or the default position of the next `MediaItem`.

      The `seekToNext()` method must only be called if this command is available.

      See Also:
        Constant Field Values

    - #### COMMAND_SEEK_TO_MEDIA_ITEM

          static final int COMMAND_SEEK_TO_MEDIA_ITEM

      Command to seek anywhere in any `MediaItem`.

      The following methods must only be called if this command is available:

      - `seekTo(int, long)`
      - `seekToDefaultPosition(int)`
      See Also:
        Constant Field Values

    - #### COMMAND_SEEK_TO_WINDOW

          @Deprecated
          static final int COMMAND_SEEK_TO_WINDOW

      Deprecated.
      Use `COMMAND_SEEK_TO_MEDIA_ITEM` instead.
      See Also:
        Constant Field Values

    - #### COMMAND_SEEK_BACK

          static final int COMMAND_SEEK_BACK

      Command to seek back by a fixed increment inside the current `MediaItem`.

      The `seekBack()` method must only be called if this command is available.

      See Also:
        Constant Field Values

    - #### COMMAND_SEEK_FORWARD

          static final int COMMAND_SEEK_FORWARD

      Command to seek forward by a fixed increment inside the current `MediaItem`.

      The `seekForward()` method must only be called if this command is available.

      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.

      The following methods must only be called if this command is available:

      - `setPlaybackParameters(PlaybackParameters)`
      - `setPlaybackSpeed(float)`
      See Also:
        Constant Field Values

    - #### COMMAND_SET_SHUFFLE_MODE

          static final int COMMAND_SET_SHUFFLE_MODE

      Command to enable shuffling.

      The `setShuffleModeEnabled(boolean)` method must only be called if this command is available.

      See Also:
        Constant Field Values

    - #### COMMAND_SET_REPEAT_MODE

          static final int COMMAND_SET_REPEAT_MODE

      Command to set the repeat mode.

      The `setRepeatMode(int)` method must only be called if this command is available.

      See Also:
        Constant Field Values

    - #### COMMAND_GET_CURRENT_MEDIA_ITEM

          static final int COMMAND_GET_CURRENT_MEDIA_ITEM

      Command to get information about the currently playing `MediaItem`.

      The following methods must only be called if this command is available:

      - `getCurrentMediaItem()`
      - `isCurrentMediaItemDynamic()`
      - `isCurrentMediaItemLive()`
      - `isCurrentMediaItemSeekable()`
      - `getCurrentLiveOffset()`
      - `getDuration()`
      - `getCurrentPosition()`
      - `getBufferedPosition()`
      - `getContentDuration()`
      - `getContentPosition()`
      - `getContentBufferedPosition()`
      - `getTotalBufferedDuration()`
      - `isPlayingAd()`
      - `getCurrentAdGroupIndex()`
      - `getCurrentAdIndexInAdGroup()`
      See Also:
        Constant Field Values

    - #### COMMAND_GET_TIMELINE

          static final int COMMAND_GET_TIMELINE

      Command to get the information about the current timeline.

      The following methods must only be called if this command is available:

      - `getCurrentTimeline()`
      - `getCurrentMediaItemIndex()`
      - `getCurrentPeriodIndex()`
      - `getMediaItemCount()`
      - `getMediaItemAt(int)`
      - `getNextMediaItemIndex()`
      - `getPreviousMediaItemIndex()`
      - `hasPreviousMediaItem()`
      - `hasNextMediaItem()`
      See Also:
        Constant Field Values

    - #### COMMAND_GET_MEDIA_ITEMS_METADATA

          static final int COMMAND_GET_MEDIA_ITEMS_METADATA

      Command to get metadata related to the playlist and current `MediaItem`.

      The following methods must only be called if this command is available:

      - `getMediaMetadata()`
      - `getPlaylistMetadata()`
      See Also:
        Constant Field Values

    - #### COMMAND_SET_MEDIA_ITEMS_METADATA

          static final int COMMAND_SET_MEDIA_ITEMS_METADATA

      Command to set the playlist metadata.

      The `setPlaylistMetadata(MediaMetadata)` method must only be called if this command is available.

      See Also:
        Constant Field Values

    - #### COMMAND_SET_MEDIA_ITEM

          static final int COMMAND_SET_MEDIA_ITEM

      Command to set a `MediaItem`.

      The following methods must only be called if this command is available:

      - `setMediaItem(MediaItem)`
      - `setMediaItem(MediaItem, boolean)`
      - `setMediaItem(MediaItem, long)`
      See Also:
        Constant Field Values

    - #### COMMAND_CHANGE_MEDIA_ITEMS

          static final int COMMAND_CHANGE_MEDIA_ITEMS

      Command to change the media items in the playlist.

      The following methods must only be called if this command is available:

      - `addMediaItem(MediaItem)`
      - `addMediaItem(int, MediaItem)`
      - `addMediaItems(List)`
      - `addMediaItems(int, List)`
      - `clearMediaItems()`
      - `moveMediaItem(int, int)`
      - `moveMediaItems(int, int, int)`
      - `removeMediaItem(int)`
      - `removeMediaItems(int, int)`
      - `setMediaItems(List)`
      - `setMediaItems(List, boolean)`
      - `setMediaItems(List, int, long)`
      See Also:
        Constant Field Values

    - #### COMMAND_GET_AUDIO_ATTRIBUTES

          static final int COMMAND_GET_AUDIO_ATTRIBUTES

      Command to get the player current `AudioAttributes`.

      The `getAudioAttributes()` method must only be called if this command is available.

      See Also:
        Constant Field Values

    - #### COMMAND_GET_VOLUME

          static final int COMMAND_GET_VOLUME

      Command to get the player volume.

      The `getVolume()` method must only be called if this command is available.

      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.

      The following methods must only be called if this command is available:

      - `getDeviceVolume()`
      - `isDeviceMuted()`
      See Also:
        Constant Field Values

    - #### COMMAND_SET_VOLUME

          static final int COMMAND_SET_VOLUME

      Command to set the player volume.

      The `setVolume(float)` method must only be called if this command is available.

      See Also:
        Constant Field Values

    - #### COMMAND_SET_DEVICE_VOLUME

          static final int COMMAND_SET_DEVICE_VOLUME

      Command to set the device volume.

      The `setDeviceVolume(int)` method must only be called if this command is available.

      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.

      The following methods must only be called if this command is available:

      - `increaseDeviceVolume()`
      - `decreaseDeviceVolume()`
      - `setDeviceMuted(boolean)`
      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.

      The following methods must only be called if this command is available:

      - `setVideoSurface(Surface)`
      - `clearVideoSurface()`
      - `clearVideoSurface(Surface)`
      - `setVideoSurfaceHolder(SurfaceHolder)`
      - `clearVideoSurfaceHolder(SurfaceHolder)`
      - `setVideoSurfaceView(SurfaceView)`
      - `clearVideoSurfaceView(SurfaceView)`
      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.

      The `getCurrentCues()` method must only be called if this command is available.

      See Also:
        Constant Field Values

    - #### COMMAND_SET_TRACK_SELECTION_PARAMETERS

          static final int COMMAND_SET_TRACK_SELECTION_PARAMETERS

      Command to set the player's track selection parameters.

      The `setTrackSelectionParameters(TrackSelectionParameters)` method must only be called if this command is available.

      See Also:
        Constant Field Values

    - #### COMMAND_GET_TRACKS

          static final int COMMAND_GET_TRACKS

      Command to get details of the current track selection.

      The `getCurrentTracks()` method must only be called if this command is available.

      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.

      This method can be called from any thread.

    - #### 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 associated with `getApplicationLooper()`.

      This method can be called from any thread.

      Parameters:
        `listener` - The listener to register.

    - #### 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 media items and resets the position to the default position.

      This method must only be called if `COMMAND_CHANGE_MEDIA_ITEMS` is available.

      Parameters:
        `mediaItems` - The new media items.

    - #### setMediaItems

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

      Clears the playlist and adds the specified media items.

      This method must only be called if `COMMAND_CHANGE_MEDIA_ITEMS` is available.

      Parameters:
        `mediaItems` - The new media items.
        `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 `getCurrentMediaItemIndex()` and `getCurrentPosition()`.

    - #### setMediaItems

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

      Clears the playlist and adds the specified media items.

      This method must only be called if `COMMAND_CHANGE_MEDIA_ITEMS` is available.

      Parameters:
        `mediaItems` - The new media items.
        `startIndex` - The `MediaItem` 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 `MediaItem` is used. In any case, if `startIndex` is set to `C.INDEX_UNSET`, this parameter is ignored and the position is not reset at all.
      Throws:
        `IllegalSeekPositionException` - If the provided `startIndex` 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.

      This method must only be called if `COMMAND_SET_MEDIA_ITEM` is available.

      Parameters:
        `mediaItem` - The new `MediaItem`.

    - #### setMediaItem

          void setMediaItem​(MediaItem mediaItem,
                            long startPositionMs)

      Clears the playlist and adds the specified `MediaItem`.

      This method must only be called if `COMMAND_SET_MEDIA_ITEM` is available.

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

      This method must only be called if `COMMAND_SET_MEDIA_ITEM` is available.

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

    - #### addMediaItem

          void addMediaItem​(MediaItem mediaItem)

      Adds a media item to the end of the playlist.

      This method must only be called if `COMMAND_CHANGE_MEDIA_ITEMS` is available.

      Parameters:
        `mediaItem` - The `MediaItem` to add.

    - #### addMediaItem

          void addMediaItem​(int index,
                            MediaItem mediaItem)

      Adds a media item at the given index of the playlist.

      This method must only be called if `COMMAND_CHANGE_MEDIA_ITEMS` is available.

      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.

      This method must only be called if `COMMAND_CHANGE_MEDIA_ITEMS` is available.

      Parameters:
        `mediaItems` - The media items to add.

    - #### addMediaItems

          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 `COMMAND_CHANGE_MEDIA_ITEMS` is available.

      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 media items to add.

    - #### moveMediaItem

          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 `COMMAND_CHANGE_MEDIA_ITEMS` is available.

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

      This method must only be called if `COMMAND_CHANGE_MEDIA_ITEMS` is available.

      Parameters:
        `fromIndex` - The start of the range to move. If the index is larger than the size of the playlist, the request is ignored.
        `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.
        `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.

      This method must only be called if `COMMAND_CHANGE_MEDIA_ITEMS` is available.

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

          void removeMediaItems​(int fromIndex,
                                int toIndex)

      Removes a range of media items from the playlist.

      This method must only be called if `COMMAND_CHANGE_MEDIA_ITEMS` is available.

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

    - #### clearMediaItems

          void clearMediaItems()

      Clears the playlist.

      This method must only be called if `COMMAND_CHANGE_MEDIA_ITEMS` is available.

    - #### isCommandAvailable

          boolean isCommandAvailable​(@Command
                                     @com.google.android.exoplayer2.Player.Command int command)

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

      This method does not execute the command.

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

    - #### canAdvertiseSession

          boolean canAdvertiseSession()

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

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

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

    - #### prepare

          void prepare()

      Prepares the player.

      This method must only be called if `COMMAND_PREPARE` is available.

      This will move the player out of `idle state` and the player will start loading media and acquire resources needed for playback.

    - #### getPlaybackState

          @State
          @com.google.android.exoplayer2.Player.State int getPlaybackState()

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

    - #### getPlaybackSuppressionReason

          @PlaybackSuppressionReason
          @com.google.android.exoplayer2.Player.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 `Player.PlaybackSuppressionReason`.
      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)`.

      This method must only be called if `COMMAND_PLAY_PAUSE` is available.

    - #### pause

          void pause()

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

      This method must only be called if `COMMAND_PLAY_PAUSE` is available.

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

      This method must only be called if `COMMAND_PLAY_PAUSE` is available.

      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
                             @com.google.android.exoplayer2.Player.RepeatMode int repeatMode)

      Sets the `Player.RepeatMode` to be used for playback.

      This method must only be called if `COMMAND_SET_REPEAT_MODE` is available.

      Parameters:
        `repeatMode` - The repeat mode.

    - #### getRepeatMode

          @RepeatMode
          @com.google.android.exoplayer2.Player.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 media items is enabled.

      This method must only be called if `COMMAND_SET_SHUFFLE_MODE` is available.

      Parameters:
        `shuffleModeEnabled` - Whether shuffling is enabled.

    - #### getShuffleModeEnabled

          boolean getShuffleModeEnabled()

      Returns whether shuffling of media items 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 `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 `COMMAND_SEEK_TO_DEFAULT_POSITION` is available.

    - #### seekToDefaultPosition

          void seekToDefaultPosition​(int mediaItemIndex)

      Seeks to the default position associated with the specified `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 `COMMAND_SEEK_TO_MEDIA_ITEM` is available.

      Parameters:
        `mediaItemIndex` - The index of the `MediaItem` whose associated default position should be seeked to. If the index is larger than the size of the playlist, the request is ignored.

    - #### seekTo

          void seekTo​(long positionMs)

      Seeks to a position specified in milliseconds in the current `MediaItem`.

      This method must only be called if `COMMAND_SEEK_IN_CURRENT_MEDIA_ITEM` is available.

      Parameters:
        `positionMs` - The seek position in the current `MediaItem`, or `C.TIME_UNSET` to seek to the media item's default position.

    - #### seekTo

          void seekTo​(int mediaItemIndex,
                      long positionMs)

      Seeks to a position specified in milliseconds in the specified `MediaItem`.

      This method must only be called if `COMMAND_SEEK_TO_MEDIA_ITEM` is available.

      Parameters:
        `mediaItemIndex` - The index of the `MediaItem`. If the index is larger than the size of the playlist, the request is ignored.
        `positionMs` - The seek position in the specified `MediaItem`, or `C.TIME_UNSET` to seek to the media item's default position.

    - #### 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 `MediaItem` by `getSeekBackIncrement()` milliseconds.

      This method must only be called if `COMMAND_SEEK_BACK` is available.

    - #### 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 `MediaItem` by `getSeekForwardIncrement()` milliseconds.

      This method must only be called if `COMMAND_SEEK_FORWARD` is available.

    - #### hasPrevious

          @Deprecated
          boolean hasPrevious()

      Deprecated.
      Use `hasPreviousMediaItem()` instead.

    - #### hasPreviousWindow

          @Deprecated
          boolean hasPreviousWindow()

      Deprecated.
      Use `hasPreviousMediaItem()` instead.

    - #### hasPreviousMediaItem

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

      This method must only be called if `COMMAND_GET_TIMELINE` is available.

    - #### previous

          @Deprecated
          void previous()

      Deprecated.
      Use `seekToPreviousMediaItem()` instead.

    - #### seekToPreviousWindow

          @Deprecated
          void seekToPreviousWindow()

      Deprecated.
      Use `seekToPreviousMediaItem()` instead.

    - #### seekToPreviousMediaItem

          void seekToPreviousMediaItem()

      Seeks to the default position of the previous `MediaItem`, which may depend on the current repeat mode and whether shuffle mode is enabled. Does nothing if `hasPreviousMediaItem()` 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.

      This method must only be called if `COMMAND_SEEK_TO_PREVIOUS_MEDIA_ITEM` is available.

    - #### getMaxSeekToPreviousPosition

          long getMaxSeekToPreviousPosition()

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

    - #### seekToPrevious

          void seekToPrevious()

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

      This method must only be called if `COMMAND_SEEK_TO_PREVIOUS` is available.

    - #### hasNext

          @Deprecated
          boolean hasNext()

      Deprecated.
      Use `hasNextMediaItem()` instead.

    - #### hasNextWindow

          @Deprecated
          boolean hasNextWindow()

      Deprecated.
      Use `hasNextMediaItem()` instead.

    - #### hasNextMediaItem

          boolean hasNextMediaItem()

      Returns whether a next `MediaItem` 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.

      This method must only be called if `COMMAND_GET_TIMELINE` is available.

    - #### next

          @Deprecated
          void next()

      Deprecated.
      Use `seekToNextMediaItem()` instead.

    - #### seekToNextWindow

          @Deprecated
          void seekToNextWindow()

      Deprecated.
      Use `seekToNextMediaItem()` instead.

    - #### seekToNextMediaItem

          void seekToNextMediaItem()

      Seeks to the default position of the next `MediaItem`, which may depend on the current repeat mode and whether shuffle mode is enabled. Does nothing if `hasNextMediaItem()` 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.

      This method must only be called if `COMMAND_SEEK_TO_NEXT_MEDIA_ITEM` is available.

    - #### seekToNext

          void seekToNext()

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

      This method must only be called if `COMMAND_SEEK_TO_NEXT` is available.

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

      This method must only be called if `COMMAND_SET_SPEED_AND_PITCH` is available.

      Parameters:
        `playbackParameters` - The playback parameters.

    - #### setPlaybackSpeed

          void setPlaybackSpeed​(@FloatRange(from=0.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 `COMMAND_SET_SPEED_AND_PITCH` is available.

      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 playlist. 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` and the player will release the loaded media and resources required for playback. The player instance can still be used by calling `prepare()` again, 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.

      This method must only be called if `COMMAND_STOP` is available.

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

    - #### getCurrentTracks

          Tracks getCurrentTracks()

      Returns the current tracks.

      This method must only be called if `COMMAND_GET_TRACKS` is available.

      See Also:
        `Player.Listener.onTracksChanged(Tracks)`

    - #### getTrackSelectionParameters

          TrackSelectionParameters getTrackSelectionParameters()

      Returns the parameters constraining the track selection.
      See Also:
        `}`

    - #### setTrackSelectionParameters

          void setTrackSelectionParameters​(TrackSelectionParameters parameters)

      Sets the parameters constraining the track selection.

      Unsupported parameters will be silently ignored.

      Use `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 `COMMAND_SET_TRACK_SELECTION_PARAMETERS` is available.

    - #### getMediaMetadata

          MediaMetadata getMediaMetadata()

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

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

      This method must only be called if `COMMAND_GET_MEDIA_ITEMS_METADATA` is available.

    - #### getPlaylistMetadata

          MediaMetadata getPlaylistMetadata()

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

      This method must only be called if `COMMAND_GET_MEDIA_ITEMS_METADATA` is available.

    - #### setPlaylistMetadata

          void setPlaylistMetadata​(MediaMetadata mediaMetadata)

      Sets the playlist `MediaMetadata`.

      This method must only be called if `COMMAND_SET_MEDIA_ITEMS_METADATA` is available.

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

      This method must only be called if `COMMAND_GET_TIMELINE` is available.

      See Also:
        `Player.Listener.onTimelineChanged(Timeline, int)`

    - #### getCurrentPeriodIndex

          int getCurrentPeriodIndex()

      Returns the index of the period currently being played.

      This method must only be called if `COMMAND_GET_TIMELINE` is available.

    - #### getCurrentWindowIndex

          @Deprecated
          int getCurrentWindowIndex()

      Deprecated.
      Use `getCurrentMediaItemIndex()` instead.

    - #### getCurrentMediaItemIndex

          int getCurrentMediaItemIndex()

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

      This method must only be called if `COMMAND_GET_TIMELINE` is available.

    - #### getNextWindowIndex

          @Deprecated
          int getNextWindowIndex()

      Deprecated.
      Use `getNextMediaItemIndex()` instead.

    - #### getNextMediaItemIndex

          int getNextMediaItemIndex()

      Returns the index of the `MediaItem` that will be played if `seekToNextMediaItem()` is called, which may depend on the current repeat mode and whether shuffle mode is enabled. Returns `C.INDEX_UNSET` if `hasNextMediaItem()` 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.

      This method must only be called if `COMMAND_GET_TIMELINE` is available.

    - #### getPreviousWindowIndex

          @Deprecated
          int getPreviousWindowIndex()

      Deprecated.
      Use `getPreviousMediaItemIndex()` instead.

    - #### getPreviousMediaItemIndex

          int getPreviousMediaItemIndex()

      Returns the index of the `MediaItem` that will be played if `seekToPreviousMediaItem()` is called, which may depend on the current repeat mode and whether shuffle mode is enabled. Returns `C.INDEX_UNSET` if `hasPreviousMediaItem()` 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.

      This method must only be called if `COMMAND_GET_TIMELINE` is available.

    - #### getCurrentMediaItem

          @Nullable
          MediaItem getCurrentMediaItem()

      Returns the currently playing `MediaItem`. May be null if the timeline is empty.

      This method must only be called if `COMMAND_GET_CURRENT_MEDIA_ITEM` is available.

      See Also:
        `Player.Listener.onMediaItemTransition(MediaItem, int)`

    - #### getMediaItemCount

          int getMediaItemCount()

      Returns the number of media items in the playlist.

      This method must only be called if `COMMAND_GET_TIMELINE` is available.

    - #### getMediaItemAt

          MediaItem getMediaItemAt​(int index)

      Returns the `MediaItem` at the given index.

      This method must only be called if `COMMAND_GET_TIMELINE` is available.

    - #### getDuration

          long getDuration()

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

      This method must only be called if `COMMAND_GET_CURRENT_MEDIA_ITEM` is available.

    - #### getCurrentPosition

          long getCurrentPosition()

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

      This method must only be called if `COMMAND_GET_CURRENT_MEDIA_ITEM` is available.

    - #### getBufferedPosition

          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 `COMMAND_GET_CURRENT_MEDIA_ITEM` is available.

    - #### getBufferedPercentage

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

    - #### 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 media items.

      This method must only be called if `COMMAND_GET_CURRENT_MEDIA_ITEM` is available.

    - #### isCurrentWindowDynamic

          @Deprecated
          boolean isCurrentWindowDynamic()

      Deprecated.
      Use `isCurrentMediaItemDynamic()` instead.

    - #### isCurrentMediaItemDynamic

          boolean isCurrentMediaItemDynamic()

      Returns whether the current `MediaItem` is dynamic (may change when the `Timeline` is updated), or `false` if the `Timeline` is empty.

      This method must only be called if `COMMAND_GET_CURRENT_MEDIA_ITEM` is available.

      See Also:
        `Timeline.Window.isDynamic`

    - #### isCurrentWindowLive

          @Deprecated
          boolean isCurrentWindowLive()

      Deprecated.
      Use `isCurrentMediaItemLive()` instead.

    - #### isCurrentMediaItemLive

          boolean isCurrentMediaItemLive()

      Returns whether the current `MediaItem` is live, or `false` if the `Timeline` is empty.

      This method must only be called if `COMMAND_GET_CURRENT_MEDIA_ITEM` is available.

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

      This method must only be called if `COMMAND_GET_CURRENT_MEDIA_ITEM` is available.

    - #### isCurrentWindowSeekable

          @Deprecated
          boolean isCurrentWindowSeekable()

      Deprecated.
      Use `isCurrentMediaItemSeekable()` instead.

    - #### isCurrentMediaItemSeekable

          boolean isCurrentMediaItemSeekable()

      Returns whether the current `MediaItem` is seekable, or `false` if the `Timeline` is empty.

      This method must only be called if `COMMAND_GET_CURRENT_MEDIA_ITEM` is available.

      See Also:
        `Timeline.Window.isSeekable`

    - #### isPlayingAd

          boolean isPlayingAd()

      Returns whether the player is currently playing an ad.

      This method must only be called if `COMMAND_GET_CURRENT_MEDIA_ITEM` is available.

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

      This method must only be called if `COMMAND_GET_CURRENT_MEDIA_ITEM` is available.

    - #### getCurrentAdIndexInAdGroup

          int getCurrentAdIndexInAdGroup()

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

      This method must only be called if `COMMAND_GET_CURRENT_MEDIA_ITEM` is available.

    - #### getContentDuration

          long getContentDuration()

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

      This method must only be called if `COMMAND_GET_CURRENT_MEDIA_ITEM` is available.

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

      This method must only be called if `COMMAND_GET_CURRENT_MEDIA_ITEM` is available.

    - #### getContentBufferedPosition

          long getContentBufferedPosition()

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

      This method must only be called if `COMMAND_GET_CURRENT_MEDIA_ITEM` is available.

    - #### getAudioAttributes

          AudioAttributes getAudioAttributes()

      Returns the attributes for audio playback.

      This method must only be called if `COMMAND_GET_AUDIO_ATTRIBUTES` is available.

    - #### setVolume

          void setVolume​(@FloatRange(from=0.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 `COMMAND_SET_VOLUME` is available.

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

    - #### getVolume

          @FloatRange(from=0.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 `COMMAND_GET_VOLUME` is available.

      Returns:
        The linear gain applied to all audio channels.

    - #### clearVideoSurface

          void clearVideoSurface()

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

      This method must only be called if `COMMAND_SET_VIDEO_SURFACE` is available.

    - #### clearVideoSurface

          void clearVideoSurface​(@Nullable
                                 Surface surface)

      Clears the `Surface` onto which video is being rendered if it matches the one passed. Else does nothing.

      This method must only be called if `COMMAND_SET_VIDEO_SURFACE` is available.

      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.

      This method must only be called if `COMMAND_SET_VIDEO_SURFACE` is available.

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

      This method must only be called if `COMMAND_SET_VIDEO_SURFACE` is available.

      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.

      This method must only be called if `COMMAND_SET_VIDEO_SURFACE` is available.

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

      This method must only be called if `COMMAND_SET_VIDEO_SURFACE` is available.

      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.

      This method must only be called if `COMMAND_SET_VIDEO_SURFACE` is available.

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

      This method must only be called if `COMMAND_SET_VIDEO_SURFACE` is available.

      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.

      This method must only be called if `COMMAND_SET_VIDEO_SURFACE` is available.

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

    - #### getSurfaceSize

          Size getSurfaceSize()

      Gets the size of the surface on which the video is rendered.
      See Also:
        `Player.Listener.onSurfaceSizeChanged(int, int)`

    - #### getCurrentCues

          CueGroup getCurrentCues()

      Returns the current `CueGroup`.

      This method must only be called if `COMMAND_GET_TEXT` is available.

    - #### getDeviceInfo

          DeviceInfo getDeviceInfo()

      Gets the device information.

    - #### getDeviceVolume

          @IntRange(from=0L)
          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.

      This method must only be called if `COMMAND_GET_DEVICE_VOLUME` is available.

    - #### isDeviceMuted

          boolean isDeviceMuted()

      Gets whether the device is muted or not.

      This method must only be called if `COMMAND_GET_DEVICE_VOLUME` is available.

    - #### setDeviceVolume

          void setDeviceVolume​(@IntRange(from=0L)
                               int volume)

      Sets the volume of the device.

      This method must only be called if `COMMAND_SET_DEVICE_VOLUME` is available.

      Parameters:
        `volume` - The volume to set.

    - #### increaseDeviceVolume

          void increaseDeviceVolume()

      Increases the volume of the device.

      This method must only be called if `COMMAND_ADJUST_DEVICE_VOLUME` is available.

    - #### decreaseDeviceVolume

          void decreaseDeviceVolume()

      Decreases the volume of the device.

      This method must only be called if `COMMAND_ADJUST_DEVICE_VOLUME` is available.

    - #### setDeviceMuted

          void setDeviceMuted​(boolean muted)

      Sets the mute state of the device.

      This method must only be called if `COMMAND_ADJUST_DEVICE_VOLUME` is available.