Back to Exoplayer

BasePlayer (ExoPlayer library)

docs/doc/reference/com/google/android/exoplayer2/BasePlayer.html

latest52.0 KB
Original Source

Package com.google.android.exoplayer2

Class BasePlayer

  • java.lang.Object

    • com.google.android.exoplayer2.BasePlayer
  • All Implemented Interfaces:PlayerDirect Known Subclasses:CastPlayer, SimpleBasePlayer, SimpleExoPlayer, StubPlayer


[@Deprecated](https://developer.android.com/reference/java/lang/Deprecated.html "class or interface in java.lang")public abstract classBasePlayerextends[Object](https://developer.android.com/reference/java/lang/Object.html "class or interface in java.lang")implements[Player](Player.html "interface in com.google.android.exoplayer2")

Deprecated. com.google.android.exoplayer2 is deprecated. Please migrate to androidx.media3 (which contains the same ExoPlayer code). See the migration guide for more details, including a script to help with the migration.

Abstract base Player which implements common implementation independent methods.

Nested Class Summary

- 

Nested classes/interfaces inherited from interface com.google.android.exoplayer2.Player

Player.Command, Player.Commands, Player.DiscontinuityReason, Player.Event, Player.Events, Player.Listener, Player.MediaItemTransitionReason, Player.PlaybackSuppressionReason, Player.PlayWhenReadyChangeReason, Player.PositionInfo, Player.RepeatMode, Player.State, Player.TimelineChangeReason

Field Summary

Fields | Modifier and Type | Field | Description | | --- | --- | --- | | protected Timeline.Window | window | Deprecated. |

- 

Fields inherited from interface com.google.android.exoplayer2.Player

COMMAND_ADJUST_DEVICE_VOLUME, COMMAND_ADJUST_DEVICE_VOLUME_WITH_FLAGS, COMMAND_CHANGE_MEDIA_ITEMS, COMMAND_GET_AUDIO_ATTRIBUTES, COMMAND_GET_CURRENT_MEDIA_ITEM, COMMAND_GET_DEVICE_VOLUME, COMMAND_GET_MEDIA_ITEMS_METADATA, COMMAND_GET_METADATA, COMMAND_GET_TEXT, COMMAND_GET_TIMELINE, COMMAND_GET_TRACKS, COMMAND_GET_VOLUME, COMMAND_INVALID, COMMAND_PLAY_PAUSE, COMMAND_PREPARE, COMMAND_RELEASE, COMMAND_SEEK_BACK, COMMAND_SEEK_FORWARD, COMMAND_SEEK_IN_CURRENT_MEDIA_ITEM, COMMAND_SEEK_IN_CURRENT_WINDOW, COMMAND_SEEK_TO_DEFAULT_POSITION, COMMAND_SEEK_TO_MEDIA_ITEM, COMMAND_SEEK_TO_NEXT, COMMAND_SEEK_TO_NEXT_MEDIA_ITEM, COMMAND_SEEK_TO_NEXT_WINDOW, COMMAND_SEEK_TO_PREVIOUS, COMMAND_SEEK_TO_PREVIOUS_MEDIA_ITEM, COMMAND_SEEK_TO_PREVIOUS_WINDOW, COMMAND_SEEK_TO_WINDOW, COMMAND_SET_DEVICE_VOLUME, COMMAND_SET_DEVICE_VOLUME_WITH_FLAGS, COMMAND_SET_MEDIA_ITEM, COMMAND_SET_MEDIA_ITEMS_METADATA, COMMAND_SET_PLAYLIST_METADATA, COMMAND_SET_REPEAT_MODE, COMMAND_SET_SHUFFLE_MODE, COMMAND_SET_SPEED_AND_PITCH, COMMAND_SET_TRACK_SELECTION_PARAMETERS, COMMAND_SET_VIDEO_SURFACE, COMMAND_SET_VOLUME, COMMAND_STOP, DISCONTINUITY_REASON_AUTO_TRANSITION, DISCONTINUITY_REASON_INTERNAL, DISCONTINUITY_REASON_REMOVE, DISCONTINUITY_REASON_SEEK, DISCONTINUITY_REASON_SEEK_ADJUSTMENT, DISCONTINUITY_REASON_SKIP, EVENT_AUDIO_ATTRIBUTES_CHANGED, EVENT_AUDIO_SESSION_ID, EVENT_AVAILABLE_COMMANDS_CHANGED, EVENT_CUES, EVENT_DEVICE_INFO_CHANGED, EVENT_DEVICE_VOLUME_CHANGED, EVENT_IS_LOADING_CHANGED, EVENT_IS_PLAYING_CHANGED, EVENT_MAX_SEEK_TO_PREVIOUS_POSITION_CHANGED, EVENT_MEDIA_ITEM_TRANSITION, EVENT_MEDIA_METADATA_CHANGED, EVENT_METADATA, EVENT_PLAY_WHEN_READY_CHANGED, EVENT_PLAYBACK_PARAMETERS_CHANGED, EVENT_PLAYBACK_STATE_CHANGED, EVENT_PLAYBACK_SUPPRESSION_REASON_CHANGED, EVENT_PLAYER_ERROR, EVENT_PLAYLIST_METADATA_CHANGED, EVENT_POSITION_DISCONTINUITY, EVENT_RENDERED_FIRST_FRAME, EVENT_REPEAT_MODE_CHANGED, EVENT_SEEK_BACK_INCREMENT_CHANGED, EVENT_SEEK_FORWARD_INCREMENT_CHANGED, EVENT_SHUFFLE_MODE_ENABLED_CHANGED, EVENT_SKIP_SILENCE_ENABLED_CHANGED, EVENT_SURFACE_SIZE_CHANGED, EVENT_TIMELINE_CHANGED, EVENT_TRACK_SELECTION_PARAMETERS_CHANGED, EVENT_TRACKS_CHANGED, EVENT_VIDEO_SIZE_CHANGED, EVENT_VOLUME_CHANGED, MEDIA_ITEM_TRANSITION_REASON_AUTO, MEDIA_ITEM_TRANSITION_REASON_PLAYLIST_CHANGED, MEDIA_ITEM_TRANSITION_REASON_REPEAT, MEDIA_ITEM_TRANSITION_REASON_SEEK, PLAY_WHEN_READY_CHANGE_REASON_AUDIO_BECOMING_NOISY, PLAY_WHEN_READY_CHANGE_REASON_AUDIO_FOCUS_LOSS, PLAY_WHEN_READY_CHANGE_REASON_END_OF_MEDIA_ITEM, PLAY_WHEN_READY_CHANGE_REASON_REMOTE, PLAY_WHEN_READY_CHANGE_REASON_SUPPRESSED_TOO_LONG, PLAY_WHEN_READY_CHANGE_REASON_USER_REQUEST, PLAYBACK_SUPPRESSION_REASON_NONE, PLAYBACK_SUPPRESSION_REASON_TRANSIENT_AUDIO_FOCUS_LOSS, PLAYBACK_SUPPRESSION_REASON_UNSUITABLE_AUDIO_ROUTE, REPEAT_MODE_ALL, REPEAT_MODE_OFF, REPEAT_MODE_ONE, STATE_BUFFERING, STATE_ENDED, STATE_IDLE, STATE_READY, TIMELINE_CHANGE_REASON_PLAYLIST_CHANGED, TIMELINE_CHANGE_REASON_SOURCE_UPDATE

Constructor Summary

Constructors | Modifier | Constructor | Description | | --- | --- | --- | | protected | BasePlayer() | Deprecated. |

Method Summary

All Methods Instance Methods Abstract Methods Concrete Methods Deprecated Methods | Modifier and Type | Method | Description | | --- | --- | --- | | void | addMediaItem​(int index, MediaItem mediaItem) | Deprecated.

Adds a media item at the given index of the playlist. | | void | addMediaItem​(MediaItem mediaItem) | Deprecated.

Adds a media item to the end of the playlist. | | void | addMediaItems​(List<MediaItem> mediaItems) | Deprecated.

Adds a list of media items to the end of the playlist. | | boolean | canAdvertiseSession() | Deprecated.

Returns whether the player can be used to advertise a media session. | | void | clearMediaItems() | Deprecated.

Clears the playlist. | | int | getBufferedPercentage() | Deprecated.

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 | getContentDuration() | Deprecated.

If Player.isPlayingAd() returns true, returns the duration of the current content in milliseconds, or C.TIME_UNSET if the duration is not known. | | long | getCurrentLiveOffset() | Deprecated.

Returns the offset of the current playback position from the live edge in milliseconds, or C.TIME_UNSET if the current MediaItem Player.isCurrentMediaItemLive() isn't live} or the offset is unknown. | | Object | getCurrentManifest() | Deprecated.

Returns the current manifest. | | MediaItem | getCurrentMediaItem() | Deprecated.

Returns the currently playing MediaItem. | | int | getCurrentWindowIndex() | Deprecated. Use Player.getCurrentMediaItemIndex() instead.

| | MediaItem | getMediaItemAt​(int index) | Deprecated.

Returns the MediaItem at the given index. | | int | getMediaItemCount() | Deprecated.

Returns the number of media items in the playlist. | | int | getNextMediaItemIndex() | Deprecated.

Returns the index of the MediaItem that will be played if Player.seekToNextMediaItem() is called, which may depend on the current repeat mode and whether shuffle mode is enabled. | | int | getNextWindowIndex() | Deprecated. Use getNextMediaItemIndex() instead.

| | int | getPreviousMediaItemIndex() | Deprecated.

Returns the index of the MediaItem that will be played if Player.seekToPreviousMediaItem() is called, which may depend on the current repeat mode and whether shuffle mode is enabled. | | int | getPreviousWindowIndex() | Deprecated. Use getPreviousMediaItemIndex() instead.

| | boolean | hasNext() | Deprecated. Use hasNextMediaItem() instead.

| | boolean | hasNextMediaItem() | Deprecated.

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

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.

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

Returns whether the provided Player.Command is available. | | boolean | isCurrentMediaItemDynamic() | Deprecated.

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

Returns whether the current MediaItem is live, or false if the Timeline is empty. | | boolean | isCurrentMediaItemSeekable() | Deprecated.

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 | isPlaying() | Deprecated.

Returns whether the player is playing, i.e. | | void | moveMediaItem​(int currentIndex, int newIndex) | Deprecated.

Moves the media item at the current index to the new index. | | void | next() | Deprecated. Use seekToNextMediaItem() instead.

| | void | pause() | Deprecated.

Pauses playback. | | void | play() | Deprecated.

Resumes playback as soon as Player.getPlaybackState() == Player.STATE_READY. | | void | previous() | Deprecated. Use seekToPreviousMediaItem() instead.

| | void | removeMediaItem​(int index) | Deprecated.

Removes the media item at the given index of the playlist. | | void | replaceMediaItem​(int index, MediaItem mediaItem) | Deprecated.

Replaces the media item at the given index of the playlist. | | void | seekBack() | Deprecated.

Seeks back in the current MediaItem by Player.getSeekBackIncrement() milliseconds. | | void | seekForward() | Deprecated.

Seeks forward in the current MediaItem by Player.getSeekForwardIncrement() milliseconds. | | void | seekTo​(int mediaItemIndex, long positionMs) | Deprecated.

Seeks to a position specified in milliseconds in the specified MediaItem. | | abstract void | seekTo​(int mediaItemIndex, long positionMs, @com.google.android.exoplayer2.Player.Command int seekCommand, boolean isRepeatingCurrentItem) | Deprecated.

Seeks to a position in the specified MediaItem. | | void | seekTo​(long positionMs) | Deprecated.

Seeks to a position specified in milliseconds in the current MediaItem. | | void | seekToDefaultPosition() | Deprecated.

Seeks to the default position associated with the current MediaItem. | | void | seekToDefaultPosition​(int mediaItemIndex) | Deprecated.

Seeks to the default position associated with the specified MediaItem. | | void | seekToNext() | Deprecated.

Seeks to a later position in the current or next MediaItem (if available). | | void | seekToNextMediaItem() | Deprecated.

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

Seeks to an earlier position in the current or previous MediaItem (if available). | | void | seekToPreviousMediaItem() | Deprecated.

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 | setMediaItem​(MediaItem mediaItem) | Deprecated.

Clears the playlist, adds the specified MediaItem and resets the position to the default position. | | void | setMediaItem​(MediaItem mediaItem, boolean resetPosition) | Deprecated.

Clears the playlist and adds the specified MediaItem. | | void | setMediaItem​(MediaItem mediaItem, long startPositionMs) | Deprecated.

Clears the playlist and adds the specified MediaItem. | | void | setMediaItems​(List<MediaItem> mediaItems) | Deprecated.

Clears the playlist, adds the specified media items and resets the position to the default position. | | void | setPlaybackSpeed​(float speed) | Deprecated.

Changes the rate at which playback occurs. |

- 

Methods inherited from class java.lang.Object

clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

- 

Methods inherited from interface com.google.android.exoplayer2.Player

addListener, addMediaItems, clearVideoSurface, clearVideoSurface, clearVideoSurfaceHolder, clearVideoSurfaceView, clearVideoTextureView, decreaseDeviceVolume, decreaseDeviceVolume, getApplicationLooper, getAudioAttributes, getAvailableCommands, getBufferedPosition, getContentBufferedPosition, getContentPosition, getCurrentAdGroupIndex, getCurrentAdIndexInAdGroup, getCurrentCues, getCurrentMediaItemIndex, getCurrentPeriodIndex, getCurrentPosition, getCurrentTimeline, getCurrentTracks, getDeviceInfo, getDeviceVolume, getDuration, getMaxSeekToPreviousPosition, getMediaMetadata, getPlaybackParameters, getPlaybackState, getPlaybackSuppressionReason, getPlayerError, getPlaylistMetadata, getPlayWhenReady, getRepeatMode, getSeekBackIncrement, getSeekForwardIncrement, getShuffleModeEnabled, getSurfaceSize, getTotalBufferedDuration, getTrackSelectionParameters, getVideoSize, getVolume, increaseDeviceVolume, increaseDeviceVolume, isDeviceMuted, isLoading, isPlayingAd, moveMediaItems, prepare, release, removeListener, removeMediaItems, replaceMediaItems, setDeviceMuted, setDeviceMuted, setDeviceVolume, setDeviceVolume, setMediaItems, setMediaItems, setPlaybackParameters, setPlaylistMetadata, setPlayWhenReady, setRepeatMode, setShuffleModeEnabled, setTrackSelectionParameters, setVideoSurface, setVideoSurfaceHolder, setVideoSurfaceView, setVideoTextureView, setVolume, stop

Field Detail

- 

window

protected final[Timeline.Window](Timeline.Window.html "class in com.google.android.exoplayer2")window

Deprecated.

Constructor Detail

- 

BasePlayer

protected BasePlayer()

Deprecated.

Method Detail

- 

setMediaItem

public final void setMediaItem​([MediaItem](MediaItem.html "class in com.google.android.exoplayer2")mediaItem)

Deprecated.

Description copied from interface: Player

Clears the playlist, adds the specified MediaItem and resets the position to the default position.

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

Specified by:setMediaItem in interface PlayerParameters:mediaItem - The new MediaItem.

- 

setMediaItem

public final void setMediaItem​([MediaItem](MediaItem.html "class in com.google.android.exoplayer2")mediaItem,
                               long startPositionMs)

Deprecated.

Description copied from interface: Player

Clears the playlist and adds the specified MediaItem.

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

Specified by:setMediaItem in interface PlayerParameters:mediaItem - The new MediaItem.startPositionMs - The position in milliseconds to start playback from.

- 

setMediaItem

public final void setMediaItem​([MediaItem](MediaItem.html "class in com.google.android.exoplayer2")mediaItem,
                               boolean resetPosition)

Deprecated.

Description copied from interface: Player

Clears the playlist and adds the specified MediaItem.

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

Specified by:setMediaItem in interface PlayerParameters: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 Player.getCurrentMediaItemIndex() and Player.getCurrentPosition().

- 

setMediaItems

public final void setMediaItems​([List](https://developer.android.com/reference/java/util/List.html "class or interface in java.util")<[MediaItem](MediaItem.html "class in com.google.android.exoplayer2")> mediaItems)

Deprecated.

Description copied from interface: Player

Clears the playlist, adds the specified media items and resets the position to the default position.

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

Specified by:setMediaItems in interface PlayerParameters:mediaItems - The new media items.

- 

addMediaItem

public final void addMediaItem​(int index,[MediaItem](MediaItem.html "class in com.google.android.exoplayer2")mediaItem)

Deprecated.

Description copied from interface: Player

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

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

Specified by:addMediaItem in interface PlayerParameters: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.

- 

addMediaItem

public final void addMediaItem​([MediaItem](MediaItem.html "class in com.google.android.exoplayer2")mediaItem)

Deprecated.

Description copied from interface: Player

Adds a media item to the end of the playlist.

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

Specified by:addMediaItem in interface PlayerParameters:mediaItem - The MediaItem to add.

- 

addMediaItems

public final void addMediaItems​([List](https://developer.android.com/reference/java/util/List.html "class or interface in java.util")<[MediaItem](MediaItem.html "class in com.google.android.exoplayer2")> mediaItems)

Deprecated.

Description copied from interface: Player

Adds a list of media items to the end of the playlist.

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

Specified by:addMediaItems in interface PlayerParameters:mediaItems - The media items to add.

- 

moveMediaItem

public final void moveMediaItem​(int currentIndex,
                                int newIndex)

Deprecated.

Description copied from interface: Player

Moves the media item at the current index to the new index.

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

Specified by:moveMediaItem in interface PlayerParameters: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.

- 

replaceMediaItem

public final void replaceMediaItem​(int index,[MediaItem](MediaItem.html "class in com.google.android.exoplayer2")mediaItem)

Deprecated.

Description copied from interface: Player

Replaces the media item at the given index of the playlist.

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

Specified by:replaceMediaItem in interface PlayerParameters:index - The index at which to replace the media item. If the index is larger than the size of the playlist, the request is ignored.mediaItem - The new MediaItem.

- 

removeMediaItem

public final void removeMediaItem​(int index)

Deprecated.

Description copied from interface: Player

Removes the media item at the given index of the playlist.

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

Specified by:removeMediaItem in interface PlayerParameters: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.

- 

clearMediaItems

public final void clearMediaItems()

Deprecated.

Description copied from interface: Player

Clears the playlist.

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

Specified by:clearMediaItems in interface Player

- 

isCommandAvailable

public final boolean isCommandAvailable​([@Command](Player.Command.html "annotation in com.google.android.exoplayer2")@com.google.android.exoplayer2.Player.Command int command)

Deprecated.

Description copied from interface: Player

Returns whether the provided Player.Command is available.

This method does not execute the command.

Specified by:isCommandAvailable in interface PlayerParameters:command - A Player.Command.Returns:Whether the Player.Command is available.See Also:Player.Listener.onAvailableCommandsChanged(Commands)

- 

canAdvertiseSession

public final boolean canAdvertiseSession()

Deprecated.

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

BasePlayer and its descendants will return true.

Specified by:canAdvertiseSession in interface Player

- 

play

public final void play()

Deprecated.

Description copied from interface: Player

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

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

Specified by:play in interface Player

- 

pause

public final void pause()

Deprecated.

Description copied from interface: Player

Pauses playback. Equivalent to setPlayWhenReady(false).

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

Specified by:pause in interface Player

- 

isPlaying

public final boolean isPlaying()

Deprecated.

Description copied from interface: Player

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

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

  - The [`playback state`](Player.html#getPlaybackState()) is not [`ready`](Player.html#STATE_READY). 
  - There is no [`intention to play`](Player.html#getPlayWhenReady()). 
  - Playback is [`suppressed for other reasons`](Player.html#getPlaybackSuppressionReason()). 

Specified by:isPlaying in interface PlayerReturns:Whether the player is playing.See Also:Player.Listener.onIsPlayingChanged(boolean)

- 

seekToDefaultPosition

public final void seekToDefaultPosition()

Deprecated.

Description copied from interface: Player

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 Player.COMMAND_SEEK_TO_DEFAULT_POSITION is available.

Specified by:seekToDefaultPosition in interface Player

- 

seekToDefaultPosition

public final void seekToDefaultPosition​(int mediaItemIndex)

Deprecated.

Description copied from interface: Player

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 Player.COMMAND_SEEK_TO_MEDIA_ITEM is available.

Specified by:seekToDefaultPosition in interface PlayerParameters: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.

- 

seekBack

public final void seekBack()

Deprecated.

Description copied from interface: Player

Seeks back in the current MediaItem by Player.getSeekBackIncrement() milliseconds.

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

Specified by:seekBack in interface Player

- 

seekForward

public final void seekForward()

Deprecated.

Description copied from interface: Player

Seeks forward in the current MediaItem by Player.getSeekForwardIncrement() milliseconds.

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

Specified by:seekForward in interface Player

- 

hasPrevious

[@Deprecated](https://developer.android.com/reference/java/lang/Deprecated.html "class or interface in java.lang")public final boolean hasPrevious()

Deprecated. Use hasPreviousMediaItem() instead.

Specified by:hasPrevious in interface Player

- 

hasPreviousWindow

[@Deprecated](https://developer.android.com/reference/java/lang/Deprecated.html "class or interface in java.lang")public final boolean hasPreviousWindow()

Deprecated. Use hasPreviousMediaItem() instead.

Specified by:hasPreviousWindow in interface Player

- 

hasPreviousMediaItem

public final boolean hasPreviousMediaItem()

Deprecated.

Description copied from interface: Player

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 Player.REPEAT_MODE_ONE, this method behaves the same as when the current repeat mode is Player.REPEAT_MODE_OFF. See Player.REPEAT_MODE_ONE for more details.

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

Specified by:hasPreviousMediaItem in interface Player

- 

previous

[@Deprecated](https://developer.android.com/reference/java/lang/Deprecated.html "class or interface in java.lang")public final void previous()

Deprecated. Use seekToPreviousMediaItem() instead.

Specified by:previous in interface Player

- 

seekToPreviousWindow

[@Deprecated](https://developer.android.com/reference/java/lang/Deprecated.html "class or interface in java.lang")public final void seekToPreviousWindow()

Deprecated. Use seekToPreviousMediaItem() instead.

Specified by:seekToPreviousWindow in interface Player

- 

seekToPreviousMediaItem

public final void seekToPreviousMediaItem()

Deprecated.

Description copied from interface: Player

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 Player.hasPreviousMediaItem() is false.

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

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

Specified by:seekToPreviousMediaItem in interface Player

- 

seekToPrevious

public final void seekToPrevious()

Deprecated.

Description copied from interface: Player

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 Player.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`](Player.html#hasPreviousMediaItem()) and the [`current position`](Player.html#getCurrentPosition()) is less than [`Player.getMaxSeekToPreviousPosition()`](Player.html#getMaxSeekToPreviousPosition()), seeks to the default position of the previous [`MediaItem`](MediaItem.html "class in com.google.android.exoplayer2"). 
  - Otherwise, seeks to 0 in the current [`MediaItem`](MediaItem.html "class in com.google.android.exoplayer2"). 

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

Specified by:seekToPrevious in interface Player

- 

hasNext

[@Deprecated](https://developer.android.com/reference/java/lang/Deprecated.html "class or interface in java.lang")public final boolean hasNext()

Deprecated. Use hasNextMediaItem() instead.

Specified by:hasNext in interface Player

- 

hasNextWindow

[@Deprecated](https://developer.android.com/reference/java/lang/Deprecated.html "class or interface in java.lang")public final boolean hasNextWindow()

Deprecated. Use hasNextMediaItem() instead.

Specified by:hasNextWindow in interface Player

- 

hasNextMediaItem

public final boolean hasNextMediaItem()

Deprecated.

Description copied from interface: Player

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 Player.REPEAT_MODE_ONE, this method behaves the same as when the current repeat mode is Player.REPEAT_MODE_OFF. See Player.REPEAT_MODE_ONE for more details.

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

Specified by:hasNextMediaItem in interface Player

- 

next

[@Deprecated](https://developer.android.com/reference/java/lang/Deprecated.html "class or interface in java.lang")public final void next()

Deprecated. Use seekToNextMediaItem() instead.

Specified by:next in interface Player

- 

seekToNextWindow

[@Deprecated](https://developer.android.com/reference/java/lang/Deprecated.html "class or interface in java.lang")public final void seekToNextWindow()

Deprecated. Use seekToNextMediaItem() instead.

Specified by:seekToNextWindow in interface Player

- 

seekToNextMediaItem

public final void seekToNextMediaItem()

Deprecated.

Description copied from interface: Player

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 Player.hasNextMediaItem() is false.

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

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

Specified by:seekToNextMediaItem in interface Player

- 

seekToNext

public final void seekToNext()

Deprecated.

Description copied from interface: Player

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 Player.COMMAND_SEEK_TO_NEXT is available.

Specified by:seekToNext in interface Player

- 

seekTo

public final void seekTo​(long positionMs)

Deprecated.

Description copied from interface: Player

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

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

Specified by:seekTo in interface PlayerParameters:positionMs - The seek position in the current MediaItem, or C.TIME_UNSET to seek to the media item's default position.

- 

seekTo

public final void seekTo​(int mediaItemIndex,
                         long positionMs)

Deprecated.

Description copied from interface: Player

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

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

Specified by:seekTo in interface PlayerParameters: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.

- 

seekTo

public abstract void seekTo​(int mediaItemIndex,
                            long positionMs,[@Command](Player.Command.html "annotation in com.google.android.exoplayer2")@com.google.android.exoplayer2.Player.Command int seekCommand,
                            boolean isRepeatingCurrentItem)

Deprecated.

Seeks to a position in the specified MediaItem. Parameters:mediaItemIndex - The index of the MediaItem.positionMs - The seek position in the specified MediaItem in milliseconds, or C.TIME_UNSET to seek to the media item's default position.seekCommand - The Player.Command used to trigger the seek.isRepeatingCurrentItem - Whether this seeks repeats the current item.

- 

setPlaybackSpeed

public final void setPlaybackSpeed​(float speed)

Deprecated.

Description copied from interface: Player

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 Player.COMMAND_SET_SPEED_AND_PITCH is available.

Specified by:setPlaybackSpeed in interface PlayerParameters: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.

- 

getCurrentWindowIndex

[@Deprecated](https://developer.android.com/reference/java/lang/Deprecated.html "class or interface in java.lang")public final int getCurrentWindowIndex()

Deprecated. Use Player.getCurrentMediaItemIndex() instead.

Specified by:getCurrentWindowIndex in interface Player

- 

getNextWindowIndex

[@Deprecated](https://developer.android.com/reference/java/lang/Deprecated.html "class or interface in java.lang")public final int getNextWindowIndex()

Deprecated. Use getNextMediaItemIndex() instead.

Specified by:getNextWindowIndex in interface Player

- 

getNextMediaItemIndex

public final int getNextMediaItemIndex()

Deprecated.

Description copied from interface: Player

Returns the index of the MediaItem that will be played if Player.seekToNextMediaItem() is called, which may depend on the current repeat mode and whether shuffle mode is enabled. Returns C.INDEX_UNSET if Player.hasNextMediaItem() is false.

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

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

Specified by:getNextMediaItemIndex in interface Player

- 

getPreviousWindowIndex

[@Deprecated](https://developer.android.com/reference/java/lang/Deprecated.html "class or interface in java.lang")public final int getPreviousWindowIndex()

Deprecated. Use getPreviousMediaItemIndex() instead.

Specified by:getPreviousWindowIndex in interface Player

- 

getPreviousMediaItemIndex

public final int getPreviousMediaItemIndex()

Deprecated.

Description copied from interface: Player

Returns the index of the MediaItem that will be played if Player.seekToPreviousMediaItem() is called, which may depend on the current repeat mode and whether shuffle mode is enabled. Returns C.INDEX_UNSET if Player.hasPreviousMediaItem() is false.

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

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

Specified by:getPreviousMediaItemIndex in interface Player

- 

getCurrentMediaItem

@Nullable
public final[MediaItem](MediaItem.html "class in com.google.android.exoplayer2")getCurrentMediaItem()

Deprecated.

Description copied from interface: Player

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

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

Specified by:getCurrentMediaItem in interface PlayerSee Also:Player.Listener.onMediaItemTransition(MediaItem, int)

- 

getMediaItemCount

public final int getMediaItemCount()

Deprecated.

Description copied from interface: Player

Returns the number of media items in the playlist.

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

Specified by:getMediaItemCount in interface Player

- 

getMediaItemAt

public final[MediaItem](MediaItem.html "class in com.google.android.exoplayer2")getMediaItemAt​(int index)

Deprecated.

Description copied from interface: Player

Returns the MediaItem at the given index.

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

Specified by:getMediaItemAt in interface Player

- 

getCurrentManifest

@Nullable
public final[Object](https://developer.android.com/reference/java/lang/Object.html "class or interface in java.lang")getCurrentManifest()

Deprecated.

Description copied from interface: Player

Returns the current manifest. The type depends on the type of media being played. May be null. Specified by:getCurrentManifest in interface Player

- 

getBufferedPercentage

public final int getBufferedPercentage()

Deprecated.

Description copied from interface: Player

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. Specified by:getBufferedPercentage in interface Player

- 

isCurrentWindowDynamic

[@Deprecated](https://developer.android.com/reference/java/lang/Deprecated.html "class or interface in java.lang")public final boolean isCurrentWindowDynamic()

Deprecated. Use isCurrentMediaItemDynamic() instead.

Specified by:isCurrentWindowDynamic in interface Player

- 

isCurrentMediaItemDynamic

public final boolean isCurrentMediaItemDynamic()

Deprecated.

Description copied from interface: Player

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

Specified by:isCurrentMediaItemDynamic in interface PlayerSee Also:Timeline.Window.isDynamic

- 

isCurrentWindowLive

[@Deprecated](https://developer.android.com/reference/java/lang/Deprecated.html "class or interface in java.lang")public final boolean isCurrentWindowLive()

Deprecated. Use isCurrentMediaItemLive() instead.

Specified by:isCurrentWindowLive in interface Player

- 

isCurrentMediaItemLive

public final boolean isCurrentMediaItemLive()

Deprecated.

Description copied from interface: Player

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

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

Specified by:isCurrentMediaItemLive in interface PlayerSee Also:Timeline.Window.isLive()

- 

getCurrentLiveOffset

public final long getCurrentLiveOffset()

Deprecated.

Description copied from interface: Player

Returns the offset of the current playback position from the live edge in milliseconds, or C.TIME_UNSET if the current MediaItem Player.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 Player.COMMAND_GET_CURRENT_MEDIA_ITEM is available.

Specified by:getCurrentLiveOffset in interface Player

- 

isCurrentWindowSeekable

[@Deprecated](https://developer.android.com/reference/java/lang/Deprecated.html "class or interface in java.lang")public final boolean isCurrentWindowSeekable()

Deprecated. Use isCurrentMediaItemSeekable() instead.

Specified by:isCurrentWindowSeekable in interface Player

- 

isCurrentMediaItemSeekable

public final boolean isCurrentMediaItemSeekable()

Deprecated.

Description copied from interface: Player

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

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

Specified by:isCurrentMediaItemSeekable in interface PlayerSee Also:Timeline.Window.isSeekable

- 

getContentDuration

public final long getContentDuration()

Deprecated.

Description copied from interface: Player

If Player.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 Player.getDuration().

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

Specified by:getContentDuration in interface Player