Class BasePlayer
- java.lang.Object
-
- com.google.android.exoplayer2.BasePlayer
-
- All Implemented Interfaces:
Player
- Direct Known Subclasses:
CastPlayer,SimpleBasePlayer,SimpleExoPlayer,StubPlayer
@Deprecated public abstract class BasePlayer extends Object implements Player
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 basePlayerwhich 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.WindowwindowDeprecated.-
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 protectedBasePlayer()Deprecated.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Deprecated Methods Modifier and Type Method Description voidaddMediaItem(int index, MediaItem mediaItem)Deprecated.Adds a media item at the given index of the playlist.voidaddMediaItem(MediaItem mediaItem)Deprecated.Adds a media item to the end of the playlist.voidaddMediaItems(List<MediaItem> mediaItems)Deprecated.Adds a list of media items to the end of the playlist.booleancanAdvertiseSession()Deprecated.Returns whether the player can be used to advertise a media session.voidclearMediaItems()Deprecated.Clears the playlist.intgetBufferedPercentage()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.longgetContentDuration()Deprecated.IfPlayer.isPlayingAd()returnstrue, returns the duration of the current content in milliseconds, orC.TIME_UNSETif the duration is not known.longgetCurrentLiveOffset()Deprecated.Returns the offset of the current playback position from the live edge in milliseconds, orC.TIME_UNSETif the currentMediaItemPlayer.isCurrentMediaItemLive()isn't live} or the offset is unknown.ObjectgetCurrentManifest()Deprecated.Returns the current manifest.MediaItemgetCurrentMediaItem()Deprecated.Returns the currently playingMediaItem.intgetCurrentWindowIndex()Deprecated.UsePlayer.getCurrentMediaItemIndex()instead.MediaItemgetMediaItemAt(int index)Deprecated.Returns theMediaItemat the given index.intgetMediaItemCount()Deprecated.Returns the number of media items in the playlist.intgetNextMediaItemIndex()Deprecated.Returns the index of theMediaItemthat will be played ifPlayer.seekToNextMediaItem()is called, which may depend on the current repeat mode and whether shuffle mode is enabled.intgetNextWindowIndex()Deprecated.UsegetNextMediaItemIndex()instead.intgetPreviousMediaItemIndex()Deprecated.Returns the index of theMediaItemthat will be played ifPlayer.seekToPreviousMediaItem()is called, which may depend on the current repeat mode and whether shuffle mode is enabled.intgetPreviousWindowIndex()Deprecated.UsegetPreviousMediaItemIndex()instead.booleanhasNext()Deprecated.UsehasNextMediaItem()instead.booleanhasNextMediaItem()Deprecated.Returns whether a nextMediaItemexists, which may depend on the current repeat mode and whether shuffle mode is enabled.booleanhasNextWindow()Deprecated.UsehasNextMediaItem()instead.booleanhasPrevious()Deprecated.UsehasPreviousMediaItem()instead.booleanhasPreviousMediaItem()Deprecated.Returns whether a previous media item exists, which may depend on the current repeat mode and whether shuffle mode is enabled.booleanhasPreviousWindow()Deprecated.UsehasPreviousMediaItem()instead.booleanisCommandAvailable(@com.google.android.exoplayer2.Player.Command int command)Deprecated.Returns whether the providedPlayer.Commandis available.booleanisCurrentMediaItemDynamic()Deprecated.booleanisCurrentMediaItemLive()Deprecated.booleanisCurrentMediaItemSeekable()Deprecated.booleanisCurrentWindowDynamic()Deprecated.UseisCurrentMediaItemDynamic()instead.booleanisCurrentWindowLive()Deprecated.UseisCurrentMediaItemLive()instead.booleanisCurrentWindowSeekable()Deprecated.UseisCurrentMediaItemSeekable()instead.booleanisPlaying()Deprecated.Returns whether the player is playing, i.e.voidmoveMediaItem(int currentIndex, int newIndex)Deprecated.Moves the media item at the current index to the new index.voidnext()Deprecated.UseseekToNextMediaItem()instead.voidpause()Deprecated.Pauses playback.voidplay()Deprecated.Resumes playback as soon asPlayer.getPlaybackState()==Player.STATE_READY.voidprevious()Deprecated.UseseekToPreviousMediaItem()instead.voidremoveMediaItem(int index)Deprecated.Removes the media item at the given index of the playlist.voidreplaceMediaItem(int index, MediaItem mediaItem)Deprecated.Replaces the media item at the given index of the playlist.voidseekBack()Deprecated.Seeks back in the currentMediaItembyPlayer.getSeekBackIncrement()milliseconds.voidseekForward()Deprecated.Seeks forward in the currentMediaItembyPlayer.getSeekForwardIncrement()milliseconds.voidseekTo(int mediaItemIndex, long positionMs)Deprecated.Seeks to a position specified in milliseconds in the specifiedMediaItem.abstract voidseekTo(int mediaItemIndex, long positionMs, @com.google.android.exoplayer2.Player.Command int seekCommand, boolean isRepeatingCurrentItem)Deprecated.Seeks to a position in the specifiedMediaItem.voidseekTo(long positionMs)Deprecated.Seeks to a position specified in milliseconds in the currentMediaItem.voidseekToDefaultPosition()Deprecated.Seeks to the default position associated with the currentMediaItem.voidseekToDefaultPosition(int mediaItemIndex)Deprecated.Seeks to the default position associated with the specifiedMediaItem.voidseekToNext()Deprecated.Seeks to a later position in the current or nextMediaItem(if available).voidseekToNextMediaItem()Deprecated.Seeks to the default position of the nextMediaItem, which may depend on the current repeat mode and whether shuffle mode is enabled.voidseekToNextWindow()Deprecated.UseseekToNextMediaItem()instead.voidseekToPrevious()Deprecated.Seeks to an earlier position in the current or previousMediaItem(if available).voidseekToPreviousMediaItem()Deprecated.Seeks to the default position of the previousMediaItem, which may depend on the current repeat mode and whether shuffle mode is enabled.voidseekToPreviousWindow()Deprecated.UseseekToPreviousMediaItem()instead.voidsetMediaItem(MediaItem mediaItem)Deprecated.Clears the playlist, adds the specifiedMediaItemand resets the position to the default position.voidsetMediaItem(MediaItem mediaItem, boolean resetPosition)Deprecated.Clears the playlist and adds the specifiedMediaItem.voidsetMediaItem(MediaItem mediaItem, long startPositionMs)Deprecated.Clears the playlist and adds the specifiedMediaItem.voidsetMediaItems(List<MediaItem> mediaItems)Deprecated.Clears the playlist, adds the specified media items and resets the position to the default position.voidsetPlaybackSpeed(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 window
Deprecated.
-
-
Method Detail
-
setMediaItem
public final void setMediaItem(MediaItem mediaItem)
Deprecated.Description copied from interface:PlayerClears the playlist, adds the specifiedMediaItemand resets the position to the default position.This method must only be called if
Player.COMMAND_SET_MEDIA_ITEMis available.- Specified by:
setMediaItemin interfacePlayer- Parameters:
mediaItem- The newMediaItem.
-
setMediaItem
public final void setMediaItem(MediaItem mediaItem, long startPositionMs)
Deprecated.Description copied from interface:PlayerClears the playlist and adds the specifiedMediaItem.This method must only be called if
Player.COMMAND_SET_MEDIA_ITEMis available.- Specified by:
setMediaItemin interfacePlayer- Parameters:
mediaItem- The newMediaItem.startPositionMs- The position in milliseconds to start playback from.
-
setMediaItem
public final void setMediaItem(MediaItem mediaItem, boolean resetPosition)
Deprecated.Description copied from interface:PlayerClears the playlist and adds the specifiedMediaItem.This method must only be called if
Player.COMMAND_SET_MEDIA_ITEMis available.- Specified by:
setMediaItemin interfacePlayer- Parameters:
mediaItem- The newMediaItem.resetPosition- Whether the playback position should be reset to the default position. If false, playback will start from the position defined byPlayer.getCurrentMediaItemIndex()andPlayer.getCurrentPosition().
-
setMediaItems
public final void setMediaItems(List<MediaItem> mediaItems)
Deprecated.Description copied from interface:PlayerClears 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_ITEMSis available.- Specified by:
setMediaItemsin interfacePlayer- Parameters:
mediaItems- The new media items.
-
addMediaItem
public final void addMediaItem(int index, MediaItem mediaItem)Deprecated.Description copied from interface:PlayerAdds a media item at the given index of the playlist.This method must only be called if
Player.COMMAND_CHANGE_MEDIA_ITEMSis available.- Specified by:
addMediaItemin interfacePlayer- 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- TheMediaItemto add.
-
addMediaItem
public final void addMediaItem(MediaItem mediaItem)
Deprecated.Description copied from interface:PlayerAdds a media item to the end of the playlist.This method must only be called if
Player.COMMAND_CHANGE_MEDIA_ITEMSis available.- Specified by:
addMediaItemin interfacePlayer- Parameters:
mediaItem- TheMediaItemto add.
-
addMediaItems
public final void addMediaItems(List<MediaItem> mediaItems)
Deprecated.Description copied from interface:PlayerAdds a list of media items to the end of the playlist.This method must only be called if
Player.COMMAND_CHANGE_MEDIA_ITEMSis available.- Specified by:
addMediaItemsin interfacePlayer- Parameters:
mediaItems- The media items to add.
-
moveMediaItem
public final void moveMediaItem(int currentIndex, int newIndex)Deprecated.Description copied from interface:PlayerMoves the media item at the current index to the new index.This method must only be called if
Player.COMMAND_CHANGE_MEDIA_ITEMSis available.- Specified by:
moveMediaItemin interfacePlayer- 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.
-
replaceMediaItem
public final void replaceMediaItem(int index, MediaItem mediaItem)Deprecated.Description copied from interface:PlayerReplaces the media item at the given index of the playlist.This method must only be called if
Player.COMMAND_CHANGE_MEDIA_ITEMSis available.- Specified by:
replaceMediaItemin interfacePlayer- Parameters:
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 newMediaItem.
-
removeMediaItem
public final void removeMediaItem(int index)
Deprecated.Description copied from interface:PlayerRemoves the media item at the given index of the playlist.This method must only be called if
Player.COMMAND_CHANGE_MEDIA_ITEMSis available.- Specified by:
removeMediaItemin interfacePlayer- 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.
-
clearMediaItems
public final void clearMediaItems()
Deprecated.Description copied from interface:PlayerClears the playlist.This method must only be called if
Player.COMMAND_CHANGE_MEDIA_ITEMSis available.- Specified by:
clearMediaItemsin interfacePlayer
-
isCommandAvailable
public final boolean isCommandAvailable(@Command @com.google.android.exoplayer2.Player.Command int command)
Deprecated.Description copied from interface:PlayerReturns whether the providedPlayer.Commandis available.This method does not execute the command.
- Specified by:
isCommandAvailablein interfacePlayer- Parameters:
command- APlayer.Command.- Returns:
- Whether the
Player.Commandis 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:
canAdvertiseSessionin interfacePlayer
-
play
public final void play()
Deprecated.Description copied from interface:PlayerResumes playback as soon asPlayer.getPlaybackState()==Player.STATE_READY. Equivalent tosetPlayWhenReady(true).This method must only be called if
Player.COMMAND_PLAY_PAUSEis available.
-
pause
public final void pause()
Deprecated.Description copied from interface:PlayerPauses playback. Equivalent tosetPlayWhenReady(false).This method must only be called if
Player.COMMAND_PLAY_PAUSEis available.
-
isPlaying
public final boolean isPlaying()
Deprecated.Description copied from interface:PlayerReturns whether the player is playing, i.e.Player.getCurrentPosition()is advancing.If
false, then at least one of the following is true:- The
playback stateis notready. - There is no
intention to play. - Playback is
suppressed for other reasons.
- Specified by:
isPlayingin interfacePlayer- Returns:
- Whether the player is playing.
- See Also:
Player.Listener.onIsPlayingChanged(boolean)
- The
-
seekToDefaultPosition
public final void seekToDefaultPosition()
Deprecated.Description copied from interface:PlayerSeeks to the default position associated with the currentMediaItem. 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_POSITIONis available.- Specified by:
seekToDefaultPositionin interfacePlayer
-
seekToDefaultPosition
public final void seekToDefaultPosition(int mediaItemIndex)
Deprecated.Description copied from interface:PlayerSeeks to the default position associated with the specifiedMediaItem. 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_ITEMis available.- Specified by:
seekToDefaultPositionin interfacePlayer- Parameters:
mediaItemIndex- The index of theMediaItemwhose 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:PlayerSeeks back in the currentMediaItembyPlayer.getSeekBackIncrement()milliseconds.This method must only be called if
Player.COMMAND_SEEK_BACKis available.
-
seekForward
public final void seekForward()
Deprecated.Description copied from interface:PlayerSeeks forward in the currentMediaItembyPlayer.getSeekForwardIncrement()milliseconds.This method must only be called if
Player.COMMAND_SEEK_FORWARDis available.- Specified by:
seekForwardin interfacePlayer
-
hasPrevious
@Deprecated public final boolean hasPrevious()
Deprecated.UsehasPreviousMediaItem()instead.- Specified by:
hasPreviousin interfacePlayer
-
hasPreviousWindow
@Deprecated public final boolean hasPreviousWindow()
Deprecated.UsehasPreviousMediaItem()instead.- Specified by:
hasPreviousWindowin interfacePlayer
-
hasPreviousMediaItem
public final boolean hasPreviousMediaItem()
Deprecated.Description copied from interface:PlayerReturns 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 isPlayer.REPEAT_MODE_OFF. SeePlayer.REPEAT_MODE_ONEfor more details.This method must only be called if
Player.COMMAND_GET_TIMELINEis available.- Specified by:
hasPreviousMediaItemin interfacePlayer
-
previous
@Deprecated public final void previous()
Deprecated.UseseekToPreviousMediaItem()instead.
-
seekToPreviousWindow
@Deprecated public final void seekToPreviousWindow()
Deprecated.UseseekToPreviousMediaItem()instead.- Specified by:
seekToPreviousWindowin interfacePlayer
-
seekToPreviousMediaItem
public final void seekToPreviousMediaItem()
Deprecated.Description copied from interface:PlayerSeeks to the default position of the previousMediaItem, which may depend on the current repeat mode and whether shuffle mode is enabled. Does nothing ifPlayer.hasPreviousMediaItem()isfalse.Note: When the repeat mode is
Player.REPEAT_MODE_ONE, this method behaves the same as when the current repeat mode isPlayer.REPEAT_MODE_OFF. SeePlayer.REPEAT_MODE_ONEfor more details.This method must only be called if
Player.COMMAND_SEEK_TO_PREVIOUS_MEDIA_ITEMis available.- Specified by:
seekToPreviousMediaItemin interfacePlayer
-
seekToPrevious
public final void seekToPrevious()
Deprecated.Description copied from interface:PlayerSeeks to an earlier position in the current or previousMediaItem(if available). More precisely:- If the timeline is empty or seeking is not possible, does nothing.
- Otherwise, if the current
MediaItemisPlayer.isCurrentMediaItemLive()live} andunseekable, then:- If
a previous media item exists, seeks to the default position of the previous media item. - Otherwise, does nothing.
- If
- Otherwise, if
a previous media item existsand thecurrent positionis less thanPlayer.getMaxSeekToPreviousPosition(), seeks to the default position of the previousMediaItem. - Otherwise, seeks to 0 in the current
MediaItem.
This method must only be called if
Player.COMMAND_SEEK_TO_PREVIOUSis available.- Specified by:
seekToPreviousin interfacePlayer
-
hasNext
@Deprecated public final boolean hasNext()
Deprecated.UsehasNextMediaItem()instead.
-
hasNextWindow
@Deprecated public final boolean hasNextWindow()
Deprecated.UsehasNextMediaItem()instead.- Specified by:
hasNextWindowin interfacePlayer
-
hasNextMediaItem
public final boolean hasNextMediaItem()
Deprecated.Description copied from interface:PlayerReturns whether a nextMediaItemexists, 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 isPlayer.REPEAT_MODE_OFF. SeePlayer.REPEAT_MODE_ONEfor more details.This method must only be called if
Player.COMMAND_GET_TIMELINEis available.- Specified by:
hasNextMediaItemin interfacePlayer
-
next
@Deprecated public final void next()
Deprecated.UseseekToNextMediaItem()instead.
-
seekToNextWindow
@Deprecated public final void seekToNextWindow()
Deprecated.UseseekToNextMediaItem()instead.- Specified by:
seekToNextWindowin interfacePlayer
-
seekToNextMediaItem
public final void seekToNextMediaItem()
Deprecated.Description copied from interface:PlayerSeeks to the default position of the nextMediaItem, which may depend on the current repeat mode and whether shuffle mode is enabled. Does nothing ifPlayer.hasNextMediaItem()isfalse.Note: When the repeat mode is
Player.REPEAT_MODE_ONE, this method behaves the same as when the current repeat mode isPlayer.REPEAT_MODE_OFF. SeePlayer.REPEAT_MODE_ONEfor more details.This method must only be called if
Player.COMMAND_SEEK_TO_NEXT_MEDIA_ITEMis available.- Specified by:
seekToNextMediaItemin interfacePlayer
-
seekToNext
public final void seekToNext()
Deprecated.Description copied from interface:PlayerSeeks to a later position in the current or nextMediaItem(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 nextMediaItem. - Otherwise, if the current
MediaItemisliveand has not ended, seeks to the live edge of the currentMediaItem. - Otherwise, does nothing.
This method must only be called if
Player.COMMAND_SEEK_TO_NEXTis available.- Specified by:
seekToNextin interfacePlayer
-
seekTo
public final void seekTo(long positionMs)
Deprecated.Description copied from interface:PlayerSeeks to a position specified in milliseconds in the currentMediaItem.This method must only be called if
Player.COMMAND_SEEK_IN_CURRENT_MEDIA_ITEMis available.- Specified by:
seekToin interfacePlayer- Parameters:
positionMs- The seek position in the currentMediaItem, orC.TIME_UNSETto seek to the media item's default position.
-
seekTo
public final void seekTo(int mediaItemIndex, long positionMs)Deprecated.Description copied from interface:PlayerSeeks to a position specified in milliseconds in the specifiedMediaItem.This method must only be called if
Player.COMMAND_SEEK_TO_MEDIA_ITEMis available.- Specified by:
seekToin interfacePlayer- Parameters:
mediaItemIndex- The index of theMediaItem. If the index is larger than the size of the playlist, the request is ignored.positionMs- The seek position in the specifiedMediaItem, orC.TIME_UNSETto seek to the media item's default position.
-
seekTo
public abstract void seekTo(int mediaItemIndex, long positionMs, @Command @com.google.android.exoplayer2.Player.Command int seekCommand, boolean isRepeatingCurrentItem)Deprecated.Seeks to a position in the specifiedMediaItem.- Parameters:
mediaItemIndex- The index of theMediaItem.positionMs- The seek position in the specifiedMediaItemin milliseconds, orC.TIME_UNSETto seek to the media item's default position.seekCommand- ThePlayer.Commandused to trigger the seek.isRepeatingCurrentItem- Whether this seeks repeats the current item.
-
setPlaybackSpeed
public final void setPlaybackSpeed(float speed)
Deprecated.Description copied from interface:PlayerChanges 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_PITCHis available.- Specified by:
setPlaybackSpeedin interfacePlayer- 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.
-
getCurrentWindowIndex
@Deprecated public final int getCurrentWindowIndex()
Deprecated.UsePlayer.getCurrentMediaItemIndex()instead.- Specified by:
getCurrentWindowIndexin interfacePlayer
-
getNextWindowIndex
@Deprecated public final int getNextWindowIndex()
Deprecated.UsegetNextMediaItemIndex()instead.- Specified by:
getNextWindowIndexin interfacePlayer
-
getNextMediaItemIndex
public final int getNextMediaItemIndex()
Deprecated.Description copied from interface:PlayerReturns the index of theMediaItemthat will be played ifPlayer.seekToNextMediaItem()is called, which may depend on the current repeat mode and whether shuffle mode is enabled. ReturnsC.INDEX_UNSETifPlayer.hasNextMediaItem()isfalse.Note: When the repeat mode is
Player.REPEAT_MODE_ONE, this method behaves the same as when the current repeat mode isPlayer.REPEAT_MODE_OFF. SeePlayer.REPEAT_MODE_ONEfor more details.This method must only be called if
Player.COMMAND_GET_TIMELINEis available.- Specified by:
getNextMediaItemIndexin interfacePlayer
-
getPreviousWindowIndex
@Deprecated public final int getPreviousWindowIndex()
Deprecated.UsegetPreviousMediaItemIndex()instead.- Specified by:
getPreviousWindowIndexin interfacePlayer
-
getPreviousMediaItemIndex
public final int getPreviousMediaItemIndex()
Deprecated.Description copied from interface:PlayerReturns the index of theMediaItemthat will be played ifPlayer.seekToPreviousMediaItem()is called, which may depend on the current repeat mode and whether shuffle mode is enabled. ReturnsC.INDEX_UNSETifPlayer.hasPreviousMediaItem()isfalse.Note: When the repeat mode is
Player.REPEAT_MODE_ONE, this method behaves the same as when the current repeat mode isPlayer.REPEAT_MODE_OFF. SeePlayer.REPEAT_MODE_ONEfor more details.This method must only be called if
Player.COMMAND_GET_TIMELINEis available.- Specified by:
getPreviousMediaItemIndexin interfacePlayer
-
getCurrentMediaItem
@Nullable public final MediaItem getCurrentMediaItem()
Deprecated.Description copied from interface:PlayerReturns the currently playingMediaItem. May be null if the timeline is empty.This method must only be called if
Player.COMMAND_GET_CURRENT_MEDIA_ITEMis available.- Specified by:
getCurrentMediaItemin interfacePlayer- See Also:
Player.Listener.onMediaItemTransition(MediaItem, int)
-
getMediaItemCount
public final int getMediaItemCount()
Deprecated.Description copied from interface:PlayerReturns the number of media items in the playlist.This method must only be called if
Player.COMMAND_GET_TIMELINEis available.- Specified by:
getMediaItemCountin interfacePlayer
-
getMediaItemAt
public final MediaItem getMediaItemAt(int index)
Deprecated.Description copied from interface:PlayerReturns theMediaItemat the given index.This method must only be called if
Player.COMMAND_GET_TIMELINEis available.- Specified by:
getMediaItemAtin interfacePlayer
-
getCurrentManifest
@Nullable public final Object getCurrentManifest()
Deprecated.Description copied from interface:PlayerReturns the current manifest. The type depends on the type of media being played. May be null.- Specified by:
getCurrentManifestin interfacePlayer
-
getBufferedPercentage
public final int getBufferedPercentage()
Deprecated.Description copied from interface:PlayerReturns 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:
getBufferedPercentagein interfacePlayer
-
isCurrentWindowDynamic
@Deprecated public final boolean isCurrentWindowDynamic()
Deprecated.UseisCurrentMediaItemDynamic()instead.- Specified by:
isCurrentWindowDynamicin interfacePlayer
-
isCurrentMediaItemDynamic
public final boolean isCurrentMediaItemDynamic()
Deprecated.Description copied from interface:PlayerReturns whether the currentMediaItemis dynamic (may change when theTimelineis updated), orfalseif theTimelineis empty.This method must only be called if
Player.COMMAND_GET_CURRENT_MEDIA_ITEMis available.- Specified by:
isCurrentMediaItemDynamicin interfacePlayer- See Also:
Timeline.Window.isDynamic
-
isCurrentWindowLive
@Deprecated public final boolean isCurrentWindowLive()
Deprecated.UseisCurrentMediaItemLive()instead.- Specified by:
isCurrentWindowLivein interfacePlayer
-
isCurrentMediaItemLive
public final boolean isCurrentMediaItemLive()
Deprecated.Description copied from interface:PlayerReturns whether the currentMediaItemis live, orfalseif theTimelineis empty.This method must only be called if
Player.COMMAND_GET_CURRENT_MEDIA_ITEMis available.- Specified by:
isCurrentMediaItemLivein interfacePlayer- See Also:
Timeline.Window.isLive()
-
getCurrentLiveOffset
public final long getCurrentLiveOffset()
Deprecated.Description copied from interface:PlayerReturns the offset of the current playback position from the live edge in milliseconds, orC.TIME_UNSETif the currentMediaItemPlayer.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_ITEMis available.- Specified by:
getCurrentLiveOffsetin interfacePlayer
-
isCurrentWindowSeekable
@Deprecated public final boolean isCurrentWindowSeekable()
Deprecated.UseisCurrentMediaItemSeekable()instead.- Specified by:
isCurrentWindowSeekablein interfacePlayer
-
isCurrentMediaItemSeekable
public final boolean isCurrentMediaItemSeekable()
Deprecated.Description copied from interface:PlayerReturns whether the currentMediaItemis seekable, orfalseif theTimelineis empty.This method must only be called if
Player.COMMAND_GET_CURRENT_MEDIA_ITEMis available.- Specified by:
isCurrentMediaItemSeekablein interfacePlayer- See Also:
Timeline.Window.isSeekable
-
getContentDuration
public final long getContentDuration()
Deprecated.Description copied from interface:PlayerIfPlayer.isPlayingAd()returnstrue, returns the duration of the current content in milliseconds, orC.TIME_UNSETif the duration is not known. If there is no ad playing, the returned duration is the same as that returned byPlayer.getDuration().This method must only be called if
Player.COMMAND_GET_CURRENT_MEDIA_ITEMis available.- Specified by:
getContentDurationin interfacePlayer
-
-