Interface Player
- 
- All Known Subinterfaces:
 ExoPlayer
- All Known Implementing Classes:
 BasePlayer,CastPlayer,ForwardingPlayer,SimpleBasePlayer,SimpleExoPlayer,StubExoPlayer,StubPlayer
@Deprecated public interface 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.A media player interface defining high-level functionality, such as the ability to play, pause, seek and query properties of the currently playing media.Player features and usage
Some important properties of media players that implement this interface are:
- All methods must be called from a single application thread unless indicated otherwise. Callbacks in registered listeners are called on the same thread.
 - The available functionality can be limited. Player instances provide a set of 
availabe commandsto signal feature support and users of the interface must only call methods if the correspondingPlayer.Commandis available. - Users can register 
Player.Listenercallbacks that get informed about state changes. - Player instances need to update the visible state immediately after each method call, even if the actual changes are handled on background threads or even other devices. This simplifies the usage for callers of methods as no asynchronous handling needs to be considered.
 - Player instances can provide playlist operations, like 'set', 'add', 'remove', 'move' or
       'replace' of 
MediaIteminstances. The player can also support repeat modes and shuffling within this playlist. The player provides aTimelinerepresenting the structure of the playlist and all its items, which can be obtained by callinggetCurrentTimeline() - Player instances can provide seeking within the currently playing item and to other items,
       using the various 
seek...methods. - Player instances can provide 
Tracksdefining the currently available and selected tracks, which can be obtained by callinggetCurrentTracks(). Users can also modify track selection behavior by settingTrackSelectionParameterswithsetTrackSelectionParameters(com.google.android.exoplayer2.trackselection.TrackSelectionParameters). - Player instances can provide 
MediaMetadataabout the currently playing item, which can be obtained by callinggetMediaMetadata(). - Player instances can provide information about ads in its media structure, for example via
       
isPlayingAd(). - Player instances can accept different types of video outputs, like 
SurfaceVieworTextureViewfor video rendering. - Player instances can handle playback speed, audio attributes, and audio volume.
 - Player instances can provide information about the playback device, which may be remote, and allow to change the device's volume.
 
API stability guarantees
The majority of the Player interface and its related classes are part of the stable API that guarantees backwards-compatibility for users of the API. Only more advances use cases may need to rely on
UnstableApiclasses and methods that are subject to incompatible changes or even removal in a future release. Implementors of the Player interface are not covered by these API stability guarantees.Player state
Users can listen to state changes by adding a
Player.ListenerwithaddListener(com.google.android.exoplayer2.Player.Listener).The main elements of the overall player state are:
- Playlist
       
MediaIteminstances can be added with methods likesetMediaItem(com.google.android.exoplayer2.MediaItem)to define what the player will be playing.- The current playlist can be obtained via 
getCurrentTimeline()and convenience methods likegetMediaItemCount()orgetCurrentMediaItem(). - With an empty playlist, the player can only be in 
STATE_IDLEorSTATE_ENDED. 
 - Playback state
       
STATE_IDLE: This is the initial state, the state when the player is stopped, and when playback failed. The player will hold only limited resources in this state.prepare()must be called to transition away from this state.STATE_BUFFERING: The player is not able to immediately play from its current position. This mostly happens because more data needs to be loaded.STATE_READY: The player is able to immediately play from its current position.STATE_ENDED: The player finished playing all media, or there is no media to play.
 - Play/Pause, playback suppression and isPlaying
       
- playWhenReady: Indicates the user intention to play.
             It can be set with 
play()orpause(). - playback suppression: Defines a reason
             for which playback will be suppressed even if playWhenReady is 
true. isPlaying(): Whether the player is playing (that is, its position is advancing and media is being presented). This will only betrueif playback state isSTATE_READY, playWhenReady istrue, and playback is not suppressed.
 - playWhenReady: Indicates the user intention to play.
             It can be set with 
 - Playback position
       
- media item index: The index in the playlist.
 - ad insertion: Whether an inserted ad is playing and which ad group index and ad index in the group it belongs to
 - current position: The current position of the playback. This is the same as the content position unless an ad is playing, where this indicates the position in the inserted ad.
 
 
Note that there are no callbacks for normal playback progression, only for transitions between media items and other position discontinuities. Code that needs to monitor playback progress (for example, an UI progress bar) should query the current position in appropriate intervals.
Implementing the Player interface
Implementing the Player interface is complex, as the interface includes many convenience methods that need to provide a consistent state and behavior, requires correct handling of listeners and available commands, and expects immediate state changes even if methods are internally handled asynchronously. For this reason, implementations are advised to inherit
SimpleBasePlayerthat handles all of these complexities and provides a simpler integration point for implementors of the interface. 
- 
- 
Nested Class Summary
Nested Classes Modifier and Type Interface Description static interfacePlayer.CommandDeprecated.Commands that indicate which method calls are currently permitted on a particularPlayerinstance.static classPlayer.CommandsDeprecated.A set of commands.static interfacePlayer.DiscontinuityReasonDeprecated.Reasons for position discontinuities.static interfacePlayer.EventDeprecated.Events that can be reported viaPlayer.Listener.onEvents(Player, Events).static classPlayer.EventsDeprecated.A set of events.static interfacePlayer.ListenerDeprecated.Listener for changes in aPlayer.static interfacePlayer.MediaItemTransitionReasonDeprecated.Reasons for media item transitions.static interfacePlayer.PlaybackSuppressionReasonDeprecated.Reason why playback is suppressed even thoughgetPlayWhenReady()istrue.static interfacePlayer.PlayWhenReadyChangeReasonDeprecated.Reasons forplayWhenReadychanges.static classPlayer.PositionInfoDeprecated.Position info describing a playback position involved in a discontinuity.static interfacePlayer.RepeatModeDeprecated.Repeat modes for playback.static interfacePlayer.StateDeprecated.Playback state.static interfacePlayer.TimelineChangeReasonDeprecated.Reasons for timeline changes. 
- 
Field Summary
Fields Modifier and Type Field Description static intCOMMAND_ADJUST_DEVICE_VOLUMEDeprecated.UseCOMMAND_ADJUST_DEVICE_VOLUME_WITH_FLAGSinstead.static intCOMMAND_ADJUST_DEVICE_VOLUME_WITH_FLAGSDeprecated.Command to increase and decrease the device volume and mute it with volume flags.static intCOMMAND_CHANGE_MEDIA_ITEMSDeprecated.Command to change the media items in the playlist.static intCOMMAND_GET_AUDIO_ATTRIBUTESDeprecated.Command to get the player currentAudioAttributes.static intCOMMAND_GET_CURRENT_MEDIA_ITEMDeprecated.Command to get information about the currently playingMediaItem.static intCOMMAND_GET_DEVICE_VOLUMEDeprecated.Command to get the device volume and whether it is muted.static intCOMMAND_GET_MEDIA_ITEMS_METADATADeprecated.UseCOMMAND_GET_METADATAinstead.static intCOMMAND_GET_METADATADeprecated.Command to get metadata related to the playlist and currentMediaItem.static intCOMMAND_GET_TEXTDeprecated.Command to get the text that should currently be displayed by the player.static intCOMMAND_GET_TIMELINEDeprecated.Command to get the information about the current timeline.static intCOMMAND_GET_TRACKSDeprecated.Command to get details of the current track selection.static intCOMMAND_GET_VOLUMEDeprecated.Command to get the player volume.static intCOMMAND_INVALIDDeprecated.Represents an invalidPlayer.Command.static intCOMMAND_PLAY_PAUSEDeprecated.Command to start, pause or resume playback.static intCOMMAND_PREPAREDeprecated.Command to prepare the player.static intCOMMAND_RELEASEDeprecated.Command to release the player.static intCOMMAND_SEEK_BACKDeprecated.Command to seek back by a fixed increment inside the currentMediaItem.static intCOMMAND_SEEK_FORWARDDeprecated.Command to seek forward by a fixed increment inside the currentMediaItem.static intCOMMAND_SEEK_IN_CURRENT_MEDIA_ITEMDeprecated.Command to seek anywhere inside the currentMediaItem.static intCOMMAND_SEEK_IN_CURRENT_WINDOWDeprecated.UseCOMMAND_SEEK_IN_CURRENT_MEDIA_ITEMinstead.static intCOMMAND_SEEK_TO_DEFAULT_POSITIONDeprecated.Command to seek to the default position of the currentMediaItem.static intCOMMAND_SEEK_TO_MEDIA_ITEMDeprecated.Command to seek anywhere in anyMediaItem.static intCOMMAND_SEEK_TO_NEXTDeprecated.static intCOMMAND_SEEK_TO_NEXT_MEDIA_ITEMDeprecated.Command to seek to the default position of the nextMediaItem.static intCOMMAND_SEEK_TO_NEXT_WINDOWDeprecated.UseCOMMAND_SEEK_TO_NEXT_MEDIA_ITEMinstead.static intCOMMAND_SEEK_TO_PREVIOUSDeprecated.static intCOMMAND_SEEK_TO_PREVIOUS_MEDIA_ITEMDeprecated.Command to seek to the default position of the previousMediaItem.static intCOMMAND_SEEK_TO_PREVIOUS_WINDOWDeprecated.UseCOMMAND_SEEK_TO_PREVIOUS_MEDIA_ITEMinstead.static intCOMMAND_SEEK_TO_WINDOWDeprecated.UseCOMMAND_SEEK_TO_MEDIA_ITEMinstead.static intCOMMAND_SET_DEVICE_VOLUMEDeprecated.UseCOMMAND_SET_DEVICE_VOLUME_WITH_FLAGSinstead.static intCOMMAND_SET_DEVICE_VOLUME_WITH_FLAGSDeprecated.Command to set the device volume with volume flags.static intCOMMAND_SET_MEDIA_ITEMDeprecated.Command to set aMediaItem.static intCOMMAND_SET_MEDIA_ITEMS_METADATADeprecated.UseCOMMAND_SET_PLAYLIST_METADATAinstead.static intCOMMAND_SET_PLAYLIST_METADATADeprecated.Command to set the playlist metadata.static intCOMMAND_SET_REPEAT_MODEDeprecated.Command to set the repeat mode.static intCOMMAND_SET_SHUFFLE_MODEDeprecated.Command to enable shuffling.static intCOMMAND_SET_SPEED_AND_PITCHDeprecated.Command to set the playback speed and pitch.static intCOMMAND_SET_TRACK_SELECTION_PARAMETERSDeprecated.Command to set the player's track selection parameters.static intCOMMAND_SET_VIDEO_SURFACEDeprecated.Command to set and clear the surface on which to render the video.static intCOMMAND_SET_VOLUMEDeprecated.Command to set the player volume.static intCOMMAND_STOPDeprecated.Command to stop playback.static intDISCONTINUITY_REASON_AUTO_TRANSITIONDeprecated.Automatic playback transition from one period in the timeline to the next.static intDISCONTINUITY_REASON_INTERNALDeprecated.Discontinuity introduced internally (e.g.static intDISCONTINUITY_REASON_REMOVEDeprecated.Discontinuity caused by the removal of the current period from theTimeline.static intDISCONTINUITY_REASON_SEEKDeprecated.Seek within the current period or to another period.static intDISCONTINUITY_REASON_SEEK_ADJUSTMENTDeprecated.Seek adjustment due to being unable to seek to the requested position or because the seek was permitted to be inexact.static intDISCONTINUITY_REASON_SKIPDeprecated.Discontinuity introduced by a skipped period (for instance a skipped ad).static intEVENT_AUDIO_ATTRIBUTES_CHANGEDDeprecated.getAudioAttributes()changed.static intEVENT_AUDIO_SESSION_IDDeprecated.The audio session id was set.static intEVENT_AVAILABLE_COMMANDS_CHANGEDDeprecated.isCommandAvailable(int)changed for at least onePlayer.Command.static intEVENT_CUESDeprecated.getCurrentCues()changed.static intEVENT_DEVICE_INFO_CHANGEDDeprecated.getDeviceInfo()changed.static intEVENT_DEVICE_VOLUME_CHANGEDDeprecated.getDeviceVolume()changed.static intEVENT_IS_LOADING_CHANGEDDeprecated.isLoading()()} changed.static intEVENT_IS_PLAYING_CHANGEDDeprecated.isPlaying()changed.static intEVENT_MAX_SEEK_TO_PREVIOUS_POSITION_CHANGEDDeprecated.getMaxSeekToPreviousPosition()changed.static intEVENT_MEDIA_ITEM_TRANSITIONDeprecated.getCurrentMediaItem()changed or the player started repeating the current item.static intEVENT_MEDIA_METADATA_CHANGEDDeprecated.getMediaMetadata()changed.static intEVENT_METADATADeprecated.Metadata associated with the current playback time changed.static intEVENT_PLAY_WHEN_READY_CHANGEDDeprecated.getPlayWhenReady()changed.static intEVENT_PLAYBACK_PARAMETERS_CHANGEDDeprecated.getPlaybackParameters()changed.static intEVENT_PLAYBACK_STATE_CHANGEDDeprecated.getPlaybackState()changed.static intEVENT_PLAYBACK_SUPPRESSION_REASON_CHANGEDDeprecated.getPlaybackSuppressionReason()changed.static intEVENT_PLAYER_ERRORDeprecated.getPlayerError()changed.static intEVENT_PLAYLIST_METADATA_CHANGEDDeprecated.getPlaylistMetadata()changed.static intEVENT_POSITION_DISCONTINUITYDeprecated.A position discontinuity occurred.static intEVENT_RENDERED_FIRST_FRAMEDeprecated.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 intEVENT_REPEAT_MODE_CHANGEDDeprecated.getRepeatMode()changed.static intEVENT_SEEK_BACK_INCREMENT_CHANGEDDeprecated.getSeekBackIncrement()changed.static intEVENT_SEEK_FORWARD_INCREMENT_CHANGEDDeprecated.getSeekForwardIncrement()changed.static intEVENT_SHUFFLE_MODE_ENABLED_CHANGEDDeprecated.getShuffleModeEnabled()changed.static intEVENT_SKIP_SILENCE_ENABLED_CHANGEDDeprecated.Skipping silences in the audio stream is enabled or disabled.static intEVENT_SURFACE_SIZE_CHANGEDDeprecated.The size of the surface onto which the video is being rendered changed.static intEVENT_TIMELINE_CHANGEDDeprecated.getCurrentTimeline()changed.static intEVENT_TRACK_SELECTION_PARAMETERS_CHANGEDDeprecated.getTrackSelectionParameters()changed.static intEVENT_TRACKS_CHANGEDDeprecated.getCurrentTracks()changed.static intEVENT_VIDEO_SIZE_CHANGEDDeprecated.getVideoSize()changed.static intEVENT_VOLUME_CHANGEDDeprecated.getVolume()changed.static intMEDIA_ITEM_TRANSITION_REASON_AUTODeprecated.Playback has automatically transitioned to the next media item.static intMEDIA_ITEM_TRANSITION_REASON_PLAYLIST_CHANGEDDeprecated.The current media item has changed because of a change in the playlist.static intMEDIA_ITEM_TRANSITION_REASON_REPEATDeprecated.The media item has been repeated.static intMEDIA_ITEM_TRANSITION_REASON_SEEKDeprecated.A seek to another media item has occurred.static intPLAY_WHEN_READY_CHANGE_REASON_AUDIO_BECOMING_NOISYDeprecated.Playback has been paused to avoid becoming noisy.static intPLAY_WHEN_READY_CHANGE_REASON_AUDIO_FOCUS_LOSSDeprecated.Playback has been paused because of a loss of audio focus.static intPLAY_WHEN_READY_CHANGE_REASON_END_OF_MEDIA_ITEMDeprecated.Playback has been paused at the end of a media item.static intPLAY_WHEN_READY_CHANGE_REASON_REMOTEDeprecated.Playback has been started or paused because of a remote change.static intPLAY_WHEN_READY_CHANGE_REASON_SUPPRESSED_TOO_LONGDeprecated.Playback has been paused because playback has been suppressed too long.static intPLAY_WHEN_READY_CHANGE_REASON_USER_REQUESTDeprecated.Playback has been started or paused by a call tosetPlayWhenReady(boolean).static intPLAYBACK_SUPPRESSION_REASON_NONEDeprecated.Playback is not suppressed.static intPLAYBACK_SUPPRESSION_REASON_TRANSIENT_AUDIO_FOCUS_LOSSDeprecated.Playback is suppressed due to transient audio focus loss.static intPLAYBACK_SUPPRESSION_REASON_UNSUITABLE_AUDIO_ROUTEDeprecated.Playback is suppressed due to no suitable audio route, such as an attempt to use an internal speaker instead of bluetooth headphones on Wear OS.static intREPEAT_MODE_ALLDeprecated.Repeats the entire timeline infinitely.static intREPEAT_MODE_OFFDeprecated.Normal playback without repetition.static intREPEAT_MODE_ONEDeprecated.Repeats the currently playingMediaIteminfinitely during ongoing playback.static intSTATE_BUFFERINGDeprecated.The player is not able to immediately play the media, but is doing work toward being able to do so.static intSTATE_ENDEDDeprecated.The player has finished playing the media.static intSTATE_IDLEDeprecated.The player is idle, meaning it holds only limited resources.static intSTATE_READYDeprecated.The player is able to immediately play from its current position.static intTIMELINE_CHANGE_REASON_PLAYLIST_CHANGEDDeprecated.Timeline changed as a result of a change of the playlist items or the order of the items.static intTIMELINE_CHANGE_REASON_SOURCE_UPDATEDeprecated.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 voidaddListener(Player.Listener listener)Deprecated.Registers a listener to receive all events from the player.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(int index, List<MediaItem> mediaItems)Deprecated.Adds a list of media items at the given index 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.voidclearVideoSurface()Deprecated.voidclearVideoSurface(Surface surface)Deprecated.Clears theSurfaceonto which video is being rendered if it matches the one passed.voidclearVideoSurfaceHolder(SurfaceHolder surfaceHolder)Deprecated.Clears theSurfaceHolderthat holds theSurfaceonto which video is being rendered if it matches the one passed.voidclearVideoSurfaceView(SurfaceView surfaceView)Deprecated.Clears theSurfaceViewonto which video is being rendered if it matches the one passed.voidclearVideoTextureView(TextureView textureView)Deprecated.Clears theTextureViewonto which video is being rendered if it matches the one passed.voiddecreaseDeviceVolume()Deprecated.UsedecreaseDeviceVolume(int)instead.voiddecreaseDeviceVolume(@com.google.android.exoplayer2.C.VolumeFlags int flags)Deprecated.Decreases the volume of the device.LoopergetApplicationLooper()Deprecated.Returns theLooperassociated with the application thread that's used to access the player and on which player events are received.AudioAttributesgetAudioAttributes()Deprecated.Returns the attributes for audio playback.Player.CommandsgetAvailableCommands()Deprecated.Returns the player's currently availablePlayer.Commands.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.longgetBufferedPosition()Deprecated.Returns an estimate of the position in the current content or ad up to which data is buffered, in milliseconds.longgetContentBufferedPosition()Deprecated.IfisPlayingAd()returnstrue, returns an estimate of the content position in the current content up to which data is buffered, in milliseconds.longgetContentDuration()Deprecated.IfisPlayingAd()returnstrue, returns the duration of the current content in milliseconds, orC.TIME_UNSETif the duration is not known.longgetContentPosition()Deprecated.IfisPlayingAd()returnstrue, returns the content position that will be played once all ads in the ad group have finished playing, in milliseconds.intgetCurrentAdGroupIndex()Deprecated.IfisPlayingAd()returns true, returns the index of the ad group in the period currently being played.intgetCurrentAdIndexInAdGroup()Deprecated.IfisPlayingAd()returns true, returns the index of the ad in its ad group.CueGroupgetCurrentCues()Deprecated.Returns the currentCueGroup.longgetCurrentLiveOffset()Deprecated.Returns the offset of the current playback position from the live edge in milliseconds, orC.TIME_UNSETif the currentMediaItemisCurrentMediaItemLive()isn't live} or the offset is unknown.ObjectgetCurrentManifest()Deprecated.Returns the current manifest.MediaItemgetCurrentMediaItem()Deprecated.Returns the currently playingMediaItem.intgetCurrentMediaItemIndex()Deprecated.Returns the index of the currentMediaItemin thetimeline, or the prospective index if thecurrent timelineis empty.intgetCurrentPeriodIndex()Deprecated.Returns the index of the period currently being played.longgetCurrentPosition()Deprecated.Returns the playback position in the current content or ad, in milliseconds, or the prospective position in milliseconds if thecurrent timelineis empty.TimelinegetCurrentTimeline()Deprecated.Returns the currentTimeline.TracksgetCurrentTracks()Deprecated.Returns the current tracks.intgetCurrentWindowIndex()Deprecated.UsegetCurrentMediaItemIndex()instead.DeviceInfogetDeviceInfo()Deprecated.Gets the device information.intgetDeviceVolume()Deprecated.Gets the current volume of the device.longgetDuration()Deprecated.Returns the duration of the current content or ad in milliseconds, orC.TIME_UNSETif the duration is not known.longgetMaxSeekToPreviousPosition()Deprecated.Returns the maximum position for whichseekToPrevious()seeks to the previousMediaItem, in milliseconds.MediaItemgetMediaItemAt(int index)Deprecated.Returns theMediaItemat the given index.intgetMediaItemCount()Deprecated.Returns the number of media items in the playlist.MediaMetadatagetMediaMetadata()Deprecated.Returns the current combinedMediaMetadata, orMediaMetadata.EMPTYif not supported.intgetNextMediaItemIndex()Deprecated.Returns the index of theMediaItemthat will be played ifseekToNextMediaItem()is called, which may depend on the current repeat mode and whether shuffle mode is enabled.intgetNextWindowIndex()Deprecated.UsegetNextMediaItemIndex()instead.PlaybackParametersgetPlaybackParameters()Deprecated.Returns the currently active playback parameters.@com.google.android.exoplayer2.Player.State intgetPlaybackState()Deprecated.Returns the current playback state of the player.@com.google.android.exoplayer2.Player.PlaybackSuppressionReason intgetPlaybackSuppressionReason()Deprecated.Returns the reason why playback is suppressed even thoughgetPlayWhenReady()istrue, orPLAYBACK_SUPPRESSION_REASON_NONEif playback is not suppressed.PlaybackExceptiongetPlayerError()Deprecated.Returns the error that caused playback to fail.MediaMetadatagetPlaylistMetadata()Deprecated.Returns the playlistMediaMetadata, as set bysetPlaylistMetadata(MediaMetadata), orMediaMetadata.EMPTYif not supported.booleangetPlayWhenReady()Deprecated.Whether playback will proceed whengetPlaybackState()==STATE_READY.intgetPreviousMediaItemIndex()Deprecated.Returns the index of theMediaItemthat will be played ifseekToPreviousMediaItem()is called, which may depend on the current repeat mode and whether shuffle mode is enabled.intgetPreviousWindowIndex()Deprecated.UsegetPreviousMediaItemIndex()instead.@com.google.android.exoplayer2.Player.RepeatMode intgetRepeatMode()Deprecated.Returns the currentPlayer.RepeatModeused for playback.longgetSeekBackIncrement()Deprecated.Returns theseekBack()increment.longgetSeekForwardIncrement()Deprecated.Returns theseekForward()increment.booleangetShuffleModeEnabled()Deprecated.Returns whether shuffling of media items is enabled.SizegetSurfaceSize()Deprecated.Gets the size of the surface on which the video is rendered.longgetTotalBufferedDuration()Deprecated.Returns an estimate of the total buffered duration from the current position, in milliseconds.TrackSelectionParametersgetTrackSelectionParameters()Deprecated.Returns the parameters constraining the track selection.VideoSizegetVideoSize()Deprecated.Gets the size of the video.floatgetVolume()Deprecated.Returns the audio volume, with 0 being silence and 1 being unity gain (signal unchanged).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.voidincreaseDeviceVolume()Deprecated.UseincreaseDeviceVolume(int)instead.voidincreaseDeviceVolume(@com.google.android.exoplayer2.C.VolumeFlags int flags)Deprecated.Increases the volume of the device.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.booleanisDeviceMuted()Deprecated.Gets whether the device is muted or not.booleanisLoading()Deprecated.Whether the player is currently loading the source.booleanisPlaying()Deprecated.Returns whether the player is playing, i.e.booleanisPlayingAd()Deprecated.Returns whether the player is currently playing an ad.voidmoveMediaItem(int currentIndex, int newIndex)Deprecated.Moves the media item at the current index to the new index.voidmoveMediaItems(int fromIndex, int toIndex, int newIndex)Deprecated.Moves the media item range to the new index.voidnext()Deprecated.UseseekToNextMediaItem()instead.voidpause()Deprecated.Pauses playback.voidplay()Deprecated.Resumes playback as soon asgetPlaybackState()==STATE_READY.voidprepare()Deprecated.Prepares the player.voidprevious()Deprecated.UseseekToPreviousMediaItem()instead.voidrelease()Deprecated.Releases the player.voidremoveListener(Player.Listener listener)Deprecated.Unregister a listener registered throughaddListener(Listener).voidremoveMediaItem(int index)Deprecated.Removes the media item at the given index of the playlist.voidremoveMediaItems(int fromIndex, int toIndex)Deprecated.Removes a range of media items from the playlist.voidreplaceMediaItem(int index, MediaItem mediaItem)Deprecated.Replaces the media item at the given index of the playlist.voidreplaceMediaItems(int fromIndex, int toIndex, List<MediaItem> mediaItems)Deprecated.Replaces the media items at the given range of the playlist.voidseekBack()Deprecated.Seeks back in the currentMediaItembygetSeekBackIncrement()milliseconds.voidseekForward()Deprecated.Seeks forward in the currentMediaItembygetSeekForwardIncrement()milliseconds.voidseekTo(int mediaItemIndex, long positionMs)Deprecated.Seeks to a position specified in milliseconds 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.voidsetDeviceMuted(boolean muted)Deprecated.UsesetDeviceMuted(boolean, int)instead.voidsetDeviceMuted(boolean muted, @com.google.android.exoplayer2.C.VolumeFlags int flags)Deprecated.Sets the mute state of the device.voidsetDeviceVolume(int volume)Deprecated.UsesetDeviceVolume(int, int)instead.voidsetDeviceVolume(int volume, int flags)Deprecated.Sets the volume of the device with volume flags.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.voidsetMediaItems(List<MediaItem> mediaItems, boolean resetPosition)Deprecated.Clears the playlist and adds the specified media items.voidsetMediaItems(List<MediaItem> mediaItems, int startIndex, long startPositionMs)Deprecated.Clears the playlist and adds the specified media items.voidsetPlaybackParameters(PlaybackParameters playbackParameters)Deprecated.Attempts to set the playback parameters.voidsetPlaybackSpeed(float speed)Deprecated.Changes the rate at which playback occurs.voidsetPlaylistMetadata(MediaMetadata mediaMetadata)Deprecated.Sets the playlistMediaMetadata.voidsetPlayWhenReady(boolean playWhenReady)Deprecated.Sets whether playback should proceed whengetPlaybackState()==STATE_READY.voidsetRepeatMode(@com.google.android.exoplayer2.Player.RepeatMode int repeatMode)Deprecated.Sets thePlayer.RepeatModeto be used for playback.voidsetShuffleModeEnabled(boolean shuffleModeEnabled)Deprecated.Sets whether shuffling of media items is enabled.voidsetTrackSelectionParameters(TrackSelectionParameters parameters)Deprecated.Sets the parameters constraining the track selection.voidsetVideoSurface(Surface surface)Deprecated.Sets theSurfaceonto which video will be rendered.voidsetVideoSurfaceHolder(SurfaceHolder surfaceHolder)Deprecated.Sets theSurfaceHolderthat holds theSurfaceonto which video will be rendered.voidsetVideoSurfaceView(SurfaceView surfaceView)Deprecated.Sets theSurfaceViewonto which video will be rendered.voidsetVideoTextureView(TextureView textureView)Deprecated.Sets theTextureViewonto which video will be rendered.voidsetVolume(float volume)Deprecated.Sets the audio volume, valid values are between 0 (silence) and 1 (unity gain, signal unchanged), inclusive.voidstop()Deprecated.Stops playback without resetting the playlist. 
 - 
 
- 
- 
Field Detail
- 
STATE_IDLE
static final int STATE_IDLE
Deprecated.The player is idle, meaning it holds only limited resources. The player must bepreparedbefore it will play the media.- See Also:
 - Constant Field Values
 
 
- 
STATE_BUFFERING
static final int STATE_BUFFERING
Deprecated.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
Deprecated.The player is able to immediately play from its current position. The player will be playing ifgetPlayWhenReady()is true, and paused otherwise.- See Also:
 - Constant Field Values
 
 
- 
STATE_ENDED
static final int STATE_ENDED
Deprecated.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
Deprecated.Playback has been started or paused by a call tosetPlayWhenReady(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
Deprecated.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
Deprecated.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
Deprecated.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
Deprecated.Playback has been paused at the end of a media item.- See Also:
 - Constant Field Values
 
 
- 
PLAY_WHEN_READY_CHANGE_REASON_SUPPRESSED_TOO_LONG
static final int PLAY_WHEN_READY_CHANGE_REASON_SUPPRESSED_TOO_LONG
Deprecated.Playback has been paused because playback has been suppressed too long.- See Also:
 - Constant Field Values
 
 
- 
PLAYBACK_SUPPRESSION_REASON_NONE
static final int PLAYBACK_SUPPRESSION_REASON_NONE
Deprecated.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
Deprecated.Playback is suppressed due to transient audio focus loss.- See Also:
 - Constant Field Values
 
 
- 
PLAYBACK_SUPPRESSION_REASON_UNSUITABLE_AUDIO_ROUTE
static final int PLAYBACK_SUPPRESSION_REASON_UNSUITABLE_AUDIO_ROUTE
Deprecated.Playback is suppressed due to no suitable audio route, such as an attempt to use an internal speaker instead of bluetooth headphones on Wear OS.- See Also:
 - Constant Field Values
 
 
- 
REPEAT_MODE_OFF
static final int REPEAT_MODE_OFF
Deprecated.Normal playback without repetition. "Previous" and "Next" actions move to the previous and nextMediaItemrespectively, and do nothing when there is no previous or nextMediaItemto move to.- See Also:
 - Constant Field Values
 
 
- 
REPEAT_MODE_ONE
static final int REPEAT_MODE_ONE
Deprecated.Repeats the currently playingMediaIteminfinitely during ongoing playback. "Previous" and "Next" actions behave as they do inREPEAT_MODE_OFF, moving to the previous and nextMediaItemrespectively, and doing nothing when there is no previous or nextMediaItemto move to.- See Also:
 - Constant Field Values
 
 
- 
REPEAT_MODE_ALL
static final int REPEAT_MODE_ALL
Deprecated.Repeats the entire timeline infinitely. "Previous" and "Next" actions behave as they do inREPEAT_MODE_OFF, but with looping at the ends so that "Previous" when playing the firstMediaItemwill move to the lastMediaItem, and "Next" when playing the lastMediaItemwill move to the firstMediaItem.- See Also:
 - Constant Field Values
 
 
- 
DISCONTINUITY_REASON_AUTO_TRANSITION
static final int DISCONTINUITY_REASON_AUTO_TRANSITION
Deprecated.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
Deprecated.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
Deprecated.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
Deprecated.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
Deprecated.Discontinuity caused by the removal of the current period from theTimeline.- See Also:
 - Constant Field Values
 
 
- 
DISCONTINUITY_REASON_INTERNAL
static final int DISCONTINUITY_REASON_INTERNAL
Deprecated.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
Deprecated.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
Deprecated.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
Deprecated.The media item has been repeated.- See Also:
 - Constant Field Values
 
 
- 
MEDIA_ITEM_TRANSITION_REASON_AUTO
static final int MEDIA_ITEM_TRANSITION_REASON_AUTO
Deprecated.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
Deprecated.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
Deprecated.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
Deprecated.getCurrentTimeline()changed.- See Also:
 - Constant Field Values
 
 
- 
EVENT_MEDIA_ITEM_TRANSITION
static final int EVENT_MEDIA_ITEM_TRANSITION
Deprecated.getCurrentMediaItem()changed or the player started repeating the current item.- See Also:
 - Constant Field Values
 
 
- 
EVENT_TRACKS_CHANGED
static final int EVENT_TRACKS_CHANGED
Deprecated.getCurrentTracks()changed.- See Also:
 - Constant Field Values
 
 
- 
EVENT_IS_LOADING_CHANGED
static final int EVENT_IS_LOADING_CHANGED
Deprecated.isLoading()()} changed.- See Also:
 - Constant Field Values
 
 
- 
EVENT_PLAYBACK_STATE_CHANGED
static final int EVENT_PLAYBACK_STATE_CHANGED
Deprecated.getPlaybackState()changed.- See Also:
 - Constant Field Values
 
 
- 
EVENT_PLAY_WHEN_READY_CHANGED
static final int EVENT_PLAY_WHEN_READY_CHANGED
Deprecated.getPlayWhenReady()changed.- See Also:
 - Constant Field Values
 
 
- 
EVENT_PLAYBACK_SUPPRESSION_REASON_CHANGED
static final int EVENT_PLAYBACK_SUPPRESSION_REASON_CHANGED
Deprecated.getPlaybackSuppressionReason()changed.- See Also:
 - Constant Field Values
 
 
- 
EVENT_IS_PLAYING_CHANGED
static final int EVENT_IS_PLAYING_CHANGED
Deprecated.isPlaying()changed.- See Also:
 - Constant Field Values
 
 
- 
EVENT_REPEAT_MODE_CHANGED
static final int EVENT_REPEAT_MODE_CHANGED
Deprecated.getRepeatMode()changed.- See Also:
 - Constant Field Values
 
 
- 
EVENT_SHUFFLE_MODE_ENABLED_CHANGED
static final int EVENT_SHUFFLE_MODE_ENABLED_CHANGED
Deprecated.getShuffleModeEnabled()changed.- See Also:
 - Constant Field Values
 
 
- 
EVENT_PLAYER_ERROR
static final int EVENT_PLAYER_ERROR
Deprecated.getPlayerError()changed.- See Also:
 - Constant Field Values
 
 
- 
EVENT_POSITION_DISCONTINUITY
static final int EVENT_POSITION_DISCONTINUITY
Deprecated.A position discontinuity occurred. SeePlayer.Listener.onPositionDiscontinuity(PositionInfo, PositionInfo, int).- See Also:
 - Constant Field Values
 
 
- 
EVENT_PLAYBACK_PARAMETERS_CHANGED
static final int EVENT_PLAYBACK_PARAMETERS_CHANGED
Deprecated.getPlaybackParameters()changed.- See Also:
 - Constant Field Values
 
 
- 
EVENT_AVAILABLE_COMMANDS_CHANGED
static final int EVENT_AVAILABLE_COMMANDS_CHANGED
Deprecated.isCommandAvailable(int)changed for at least onePlayer.Command.- See Also:
 - Constant Field Values
 
 
- 
EVENT_MEDIA_METADATA_CHANGED
static final int EVENT_MEDIA_METADATA_CHANGED
Deprecated.getMediaMetadata()changed.- See Also:
 - Constant Field Values
 
 
- 
EVENT_PLAYLIST_METADATA_CHANGED
static final int EVENT_PLAYLIST_METADATA_CHANGED
Deprecated.getPlaylistMetadata()changed.- See Also:
 - Constant Field Values
 
 
- 
EVENT_SEEK_BACK_INCREMENT_CHANGED
static final int EVENT_SEEK_BACK_INCREMENT_CHANGED
Deprecated.getSeekBackIncrement()changed.- See Also:
 - Constant Field Values
 
 
- 
EVENT_SEEK_FORWARD_INCREMENT_CHANGED
static final int EVENT_SEEK_FORWARD_INCREMENT_CHANGED
Deprecated.getSeekForwardIncrement()changed.- See Also:
 - Constant Field Values
 
 
- 
EVENT_MAX_SEEK_TO_PREVIOUS_POSITION_CHANGED
static final int EVENT_MAX_SEEK_TO_PREVIOUS_POSITION_CHANGED
Deprecated.getMaxSeekToPreviousPosition()changed.- See Also:
 - Constant Field Values
 
 
- 
EVENT_TRACK_SELECTION_PARAMETERS_CHANGED
static final int EVENT_TRACK_SELECTION_PARAMETERS_CHANGED
Deprecated.getTrackSelectionParameters()changed.- See Also:
 - Constant Field Values
 
 
- 
EVENT_AUDIO_ATTRIBUTES_CHANGED
static final int EVENT_AUDIO_ATTRIBUTES_CHANGED
Deprecated.getAudioAttributes()changed.- See Also:
 - Constant Field Values
 
 
- 
EVENT_AUDIO_SESSION_ID
static final int EVENT_AUDIO_SESSION_ID
Deprecated.The audio session id was set.- See Also:
 - Constant Field Values
 
 
- 
EVENT_VOLUME_CHANGED
static final int EVENT_VOLUME_CHANGED
Deprecated.getVolume()changed.- See Also:
 - Constant Field Values
 
 
- 
EVENT_SKIP_SILENCE_ENABLED_CHANGED
static final int EVENT_SKIP_SILENCE_ENABLED_CHANGED
Deprecated.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
Deprecated.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
Deprecated.getVideoSize()changed.- See Also:
 - Constant Field Values
 
 
- 
EVENT_RENDERED_FIRST_FRAME
static final int EVENT_RENDERED_FIRST_FRAME
Deprecated.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
Deprecated.getCurrentCues()changed.- See Also:
 - Constant Field Values
 
 
- 
EVENT_METADATA
static final int EVENT_METADATA
Deprecated.Metadata associated with the current playback time changed.- See Also:
 - Constant Field Values
 
 
- 
EVENT_DEVICE_INFO_CHANGED
static final int EVENT_DEVICE_INFO_CHANGED
Deprecated.getDeviceInfo()changed.- See Also:
 - Constant Field Values
 
 
- 
EVENT_DEVICE_VOLUME_CHANGED
static final int EVENT_DEVICE_VOLUME_CHANGED
Deprecated.getDeviceVolume()changed.- See Also:
 - Constant Field Values
 
 
- 
COMMAND_PLAY_PAUSE
static final int COMMAND_PLAY_PAUSE
Deprecated.Command to start, pause or resume playback.The following methods must only be called if this command is available:
- See Also:
 - Constant Field Values
 
 
- 
COMMAND_PREPARE
static final int COMMAND_PREPARE
Deprecated.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
Deprecated.- See Also:
 - Constant Field Values
 
 
- 
COMMAND_SEEK_TO_DEFAULT_POSITION
static final int COMMAND_SEEK_TO_DEFAULT_POSITION
Deprecated.Command to seek to the default position of the currentMediaItem.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
Deprecated.Command to seek anywhere inside the currentMediaItem.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.UseCOMMAND_SEEK_IN_CURRENT_MEDIA_ITEMinstead.- See Also:
 - Constant Field Values
 
 
- 
COMMAND_SEEK_TO_PREVIOUS_MEDIA_ITEM
static final int COMMAND_SEEK_TO_PREVIOUS_MEDIA_ITEM
Deprecated.Command to seek to the default position of the previousMediaItem.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.UseCOMMAND_SEEK_TO_PREVIOUS_MEDIA_ITEMinstead.- See Also:
 - Constant Field Values
 
 
- 
COMMAND_SEEK_TO_PREVIOUS
static final int COMMAND_SEEK_TO_PREVIOUS
Deprecated.Command to seek to an earlier position in the currentMediaItemor the default position of the previousMediaItem.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
Deprecated.Command to seek to the default position of the nextMediaItem.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.UseCOMMAND_SEEK_TO_NEXT_MEDIA_ITEMinstead.- See Also:
 - Constant Field Values
 
 
- 
COMMAND_SEEK_TO_NEXT
static final int COMMAND_SEEK_TO_NEXT
Deprecated.Command to seek to a later position in the currentMediaItemor the default position of the nextMediaItem.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
Deprecated.Command to seek anywhere in anyMediaItem.The following methods must only be called if this command is available:
- See Also:
 - Constant Field Values
 
 
- 
COMMAND_SEEK_TO_WINDOW
@Deprecated static final int COMMAND_SEEK_TO_WINDOW
Deprecated.UseCOMMAND_SEEK_TO_MEDIA_ITEMinstead.- See Also:
 - Constant Field Values
 
 
- 
COMMAND_SEEK_BACK
static final int COMMAND_SEEK_BACK
Deprecated.Command to seek back by a fixed increment inside the currentMediaItem.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
Deprecated.Command to seek forward by a fixed increment inside the currentMediaItem.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
Deprecated.Command to set the playback speed and pitch.The following methods must only be called if this command is available:
- See Also:
 - Constant Field Values
 
 
- 
COMMAND_SET_SHUFFLE_MODE
static final int COMMAND_SET_SHUFFLE_MODE
Deprecated.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
Deprecated.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
Deprecated.Command to get information about the currently playingMediaItem.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
Deprecated.Command to get the information about the current timeline.The following methods must only be called if this command is available:
- See Also:
 - Constant Field Values
 
 
- 
COMMAND_GET_MEDIA_ITEMS_METADATA
@Deprecated static final int COMMAND_GET_MEDIA_ITEMS_METADATA
Deprecated.UseCOMMAND_GET_METADATAinstead.- See Also:
 - Constant Field Values
 
 
- 
COMMAND_GET_METADATA
static final int COMMAND_GET_METADATA
Deprecated.Command to get metadata related to the playlist and currentMediaItem.The following methods must only be called if this command is available:
- See Also:
 - Constant Field Values
 
 
- 
COMMAND_SET_MEDIA_ITEMS_METADATA
@Deprecated static final int COMMAND_SET_MEDIA_ITEMS_METADATA
Deprecated.UseCOMMAND_SET_PLAYLIST_METADATAinstead.- See Also:
 - Constant Field Values
 
 
- 
COMMAND_SET_PLAYLIST_METADATA
static final int COMMAND_SET_PLAYLIST_METADATA
Deprecated.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
Deprecated.- See Also:
 - Constant Field Values
 
 
- 
COMMAND_CHANGE_MEDIA_ITEMS
static final int COMMAND_CHANGE_MEDIA_ITEMS
Deprecated.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)replaceMediaItem(int, MediaItem)replaceMediaItems(int, int, List)
- See Also:
 - Constant Field Values
 
 
- 
COMMAND_GET_AUDIO_ATTRIBUTES
static final int COMMAND_GET_AUDIO_ATTRIBUTES
Deprecated.Command to get the player currentAudioAttributes.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
Deprecated.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
Deprecated.Command to get the device volume and whether it is muted.The following methods must only be called if this command is available:
- See Also:
 - Constant Field Values
 
 
- 
COMMAND_SET_VOLUME
static final int COMMAND_SET_VOLUME
Deprecated.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
@Deprecated static final int COMMAND_SET_DEVICE_VOLUME
Deprecated.UseCOMMAND_SET_DEVICE_VOLUME_WITH_FLAGSinstead.- See Also:
 - Constant Field Values
 
 
- 
COMMAND_SET_DEVICE_VOLUME_WITH_FLAGS
static final int COMMAND_SET_DEVICE_VOLUME_WITH_FLAGS
Deprecated.Command to set the device volume with volume flags.The
setDeviceVolume(int, int)method must only be called if this command is available.- See Also:
 - Constant Field Values
 
 
- 
COMMAND_ADJUST_DEVICE_VOLUME
@Deprecated static final int COMMAND_ADJUST_DEVICE_VOLUME
Deprecated.UseCOMMAND_ADJUST_DEVICE_VOLUME_WITH_FLAGSinstead.- See Also:
 - Constant Field Values
 
 
- 
COMMAND_ADJUST_DEVICE_VOLUME_WITH_FLAGS
static final int COMMAND_ADJUST_DEVICE_VOLUME_WITH_FLAGS
Deprecated.Command to increase and decrease the device volume and mute it with volume flags.The following methods must only be called if this command is available:
- See Also:
 - Constant Field Values
 
 
- 
COMMAND_SET_VIDEO_SURFACE
static final int COMMAND_SET_VIDEO_SURFACE
Deprecated.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:
- See Also:
 - Constant Field Values
 
 
- 
COMMAND_GET_TEXT
static final int COMMAND_GET_TEXT
Deprecated.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
Deprecated.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
Deprecated.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_RELEASE
static final int COMMAND_RELEASE
Deprecated.Command to release the player.The
release()method must only be called if this command is available.- See Also:
 - Constant Field Values
 
 
- 
COMMAND_INVALID
static final int COMMAND_INVALID
Deprecated.Represents an invalidPlayer.Command.- See Also:
 - Constant Field Values
 
 
 - 
 
- 
Method Detail
- 
getApplicationLooper
Looper getApplicationLooper()
Deprecated.Returns theLooperassociated 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)
Deprecated.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)
Deprecated.Unregister a listener registered throughaddListener(Listener). The listener will no longer receive events.- Parameters:
 listener- The listener to unregister.
 
- 
setMediaItems
void setMediaItems(List<MediaItem> mediaItems)
Deprecated.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_ITEMSis available.- Parameters:
 mediaItems- The new media items.
 
- 
setMediaItems
void setMediaItems(List<MediaItem> mediaItems, boolean resetPosition)
Deprecated.Clears the playlist and adds the specified media items.This method must only be called if
COMMAND_CHANGE_MEDIA_ITEMSis available.- Parameters:
 mediaItems- The new media items.resetPosition- Whether the playback position should be reset to the default position in the firstTimeline.Window. If false, playback will start from the position defined bygetCurrentMediaItemIndex()andgetCurrentPosition().
 
- 
setMediaItems
void setMediaItems(List<MediaItem> mediaItems, int startIndex, long startPositionMs)
Deprecated.Clears the playlist and adds the specified media items.This method must only be called if
COMMAND_CHANGE_MEDIA_ITEMSis available.- Parameters:
 mediaItems- The new media items.startIndex- TheMediaItemindex to start playback from. IfC.INDEX_UNSETis passed, the current position is not reset.startPositionMs- The position in milliseconds to start playback from. IfC.TIME_UNSETis passed, the default position of the givenMediaItemis used. In any case, ifstartIndexis set toC.INDEX_UNSET, this parameter is ignored and the position is not reset at all.- Throws:
 IllegalSeekPositionException- If the providedstartIndexis not within the bounds of the list of media items.
 
- 
setMediaItem
void setMediaItem(MediaItem mediaItem)
Deprecated.Clears the playlist, adds the specifiedMediaItemand resets the position to the default position.This method must only be called if
COMMAND_SET_MEDIA_ITEMis available.- Parameters:
 mediaItem- The newMediaItem.
 
- 
setMediaItem
void setMediaItem(MediaItem mediaItem, long startPositionMs)
Deprecated.Clears the playlist and adds the specifiedMediaItem.This method must only be called if
COMMAND_SET_MEDIA_ITEMis available.- Parameters:
 mediaItem- The newMediaItem.startPositionMs- The position in milliseconds to start playback from.
 
- 
setMediaItem
void setMediaItem(MediaItem mediaItem, boolean resetPosition)
Deprecated.Clears the playlist and adds the specifiedMediaItem.This method must only be called if
COMMAND_SET_MEDIA_ITEMis available.- 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 bygetCurrentMediaItemIndex()andgetCurrentPosition().
 
- 
addMediaItem
void addMediaItem(MediaItem mediaItem)
Deprecated.Adds a media item to the end of the playlist.This method must only be called if
COMMAND_CHANGE_MEDIA_ITEMSis available.- Parameters:
 mediaItem- TheMediaItemto add.
 
- 
addMediaItem
void addMediaItem(int index, MediaItem mediaItem)Deprecated.Adds a media item at the given index of the playlist.This method must only be called if
COMMAND_CHANGE_MEDIA_ITEMSis 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- TheMediaItemto add.
 
- 
addMediaItems
void addMediaItems(List<MediaItem> mediaItems)
Deprecated.Adds a list of media items to the end of the playlist.This method must only be called if
COMMAND_CHANGE_MEDIA_ITEMSis available.- Parameters:
 mediaItems- The media items to add.
 
- 
addMediaItems
void addMediaItems(int index, List<MediaItem> mediaItems)Deprecated.Adds a list of media items at the given index of the playlist.This method must only be called if
COMMAND_CHANGE_MEDIA_ITEMSis 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)Deprecated.Moves the media item at the current index to the new index.This method must only be called if
COMMAND_CHANGE_MEDIA_ITEMSis 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)Deprecated.Moves the media item range to the new index.This method must only be called if
COMMAND_CHANGE_MEDIA_ITEMSis 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.
 
- 
replaceMediaItem
void replaceMediaItem(int index, MediaItem mediaItem)Deprecated.Replaces the media item at the given index of the playlist.This method must only be called if
COMMAND_CHANGE_MEDIA_ITEMSis available.- 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.
 
- 
replaceMediaItems
void replaceMediaItems(int fromIndex, int toIndex, List<MediaItem> mediaItems)Deprecated.Replaces the media items at the given range of the playlist.This method must only be called if
COMMAND_CHANGE_MEDIA_ITEMSis available.Note that it is possible to replace a range with an arbitrary number of new items, so that the number of removed items defined by
fromIndexandtoIndexdoes not have to match the number of added items defined bymediaItems. As result, it may also change the index of subsequent items not touched by this operation.- Parameters:
 fromIndex- The start of the range. 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 replaced.mediaItems- The media items to replace the range with.
 
- 
removeMediaItem
void removeMediaItem(int index)
Deprecated.Removes the media item at the given index of the playlist.This method must only be called if
COMMAND_CHANGE_MEDIA_ITEMSis 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)Deprecated.Removes a range of media items from the playlist.This method must only be called if
COMMAND_CHANGE_MEDIA_ITEMSis 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()
Deprecated.Clears the playlist.This method must only be called if
COMMAND_CHANGE_MEDIA_ITEMSis available. 
- 
isCommandAvailable
boolean isCommandAvailable(@Command @com.google.android.exoplayer2.Player.Command int command)
Deprecated.Returns whether the providedPlayer.Commandis available.This method does not execute the command.
- Parameters:
 command- APlayer.Command.- Returns:
 - Whether the 
Player.Commandis available. - See Also:
 Player.Listener.onAvailableCommandsChanged(Commands)
 
- 
canAdvertiseSession
boolean canAdvertiseSession()
Deprecated.Returns whether the player can be used to advertise a media session. 
- 
getAvailableCommands
Player.Commands getAvailableCommands()
Deprecated.Returns the player's currently availablePlayer.Commands.The returned
Player.Commandsare not updated when available commands change. UsePlayer.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()
Deprecated.Prepares the player.This method must only be called if
COMMAND_PREPAREis available.This will move the player out of
idle stateand the player will start loading media and acquire resources needed for playback. 
- 
getPlaybackState
@State @com.google.android.exoplayer2.Player.State int getPlaybackState()
Deprecated.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()
Deprecated.Returns the reason why playback is suppressed even thoughgetPlayWhenReady()istrue, orPLAYBACK_SUPPRESSION_REASON_NONEif playback is not suppressed.- Returns:
 - The current 
Player.PlaybackSuppressionReason. - See Also:
 Player.Listener.onPlaybackSuppressionReasonChanged(int)
 
- 
isPlaying
boolean isPlaying()
Deprecated.Returns whether the player is playing, i.e.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. 
- Returns:
 - Whether the player is playing.
 - See Also:
 Player.Listener.onIsPlayingChanged(boolean)
 - The 
 
- 
getPlayerError
@Nullable PlaybackException getPlayerError()
Deprecated.Returns the error that caused playback to fail. This is the same error that will have been reported viaPlayer.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
nullifgetPlaybackState()is notSTATE_IDLE.- Returns:
 - The error, or 
null. - See Also:
 Player.Listener.onPlayerError(PlaybackException)
 
- 
play
void play()
Deprecated.Resumes playback as soon asgetPlaybackState()==STATE_READY. Equivalent tosetPlayWhenReady(true).This method must only be called if
COMMAND_PLAY_PAUSEis available. 
- 
pause
void pause()
Deprecated.Pauses playback. Equivalent tosetPlayWhenReady(false).This method must only be called if
COMMAND_PLAY_PAUSEis available. 
- 
setPlayWhenReady
void setPlayWhenReady(boolean playWhenReady)
Deprecated.Sets whether playback should proceed whengetPlaybackState()==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_PAUSEis available.- Parameters:
 playWhenReady- Whether playback should proceed when ready.
 
- 
getPlayWhenReady
boolean getPlayWhenReady()
Deprecated.Whether playback will proceed whengetPlaybackState()==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)
Deprecated.Sets thePlayer.RepeatModeto be used for playback.This method must only be called if
COMMAND_SET_REPEAT_MODEis available.- Parameters:
 repeatMode- The repeat mode.
 
- 
getRepeatMode
@RepeatMode @com.google.android.exoplayer2.Player.RepeatMode int getRepeatMode()
Deprecated.Returns the currentPlayer.RepeatModeused for playback.- Returns:
 - The current repeat mode.
 - See Also:
 Player.Listener.onRepeatModeChanged(int)
 
- 
setShuffleModeEnabled
void setShuffleModeEnabled(boolean shuffleModeEnabled)
Deprecated.Sets whether shuffling of media items is enabled.This method must only be called if
COMMAND_SET_SHUFFLE_MODEis available.- Parameters:
 shuffleModeEnabled- Whether shuffling is enabled.
 
- 
getShuffleModeEnabled
boolean getShuffleModeEnabled()
Deprecated.Returns whether shuffling of media items is enabled. 
- 
isLoading
boolean isLoading()
Deprecated.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()
Deprecated.Seeks 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
COMMAND_SEEK_TO_DEFAULT_POSITIONis available. 
- 
seekToDefaultPosition
void seekToDefaultPosition(int mediaItemIndex)
Deprecated.Seeks 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
COMMAND_SEEK_TO_MEDIA_ITEMis available.- 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.
 
- 
seekTo
void seekTo(long positionMs)
Deprecated.Seeks to a position specified in milliseconds in the currentMediaItem.This method must only be called if
COMMAND_SEEK_IN_CURRENT_MEDIA_ITEMis available.- Parameters:
 positionMs- The seek position in the currentMediaItem, orC.TIME_UNSETto seek to the media item's default position.
 
- 
seekTo
void seekTo(int mediaItemIndex, long positionMs)Deprecated.Seeks to a position specified in milliseconds in the specifiedMediaItem.This method must only be called if
COMMAND_SEEK_TO_MEDIA_ITEMis available.- 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.
 
- 
getSeekBackIncrement
long getSeekBackIncrement()
Deprecated.Returns theseekBack()increment.- Returns:
 - The seek back increment, in milliseconds.
 - See Also:
 Player.Listener.onSeekBackIncrementChanged(long)
 
- 
seekBack
void seekBack()
Deprecated.Seeks back in the currentMediaItembygetSeekBackIncrement()milliseconds.This method must only be called if
COMMAND_SEEK_BACKis available. 
- 
getSeekForwardIncrement
long getSeekForwardIncrement()
Deprecated.Returns theseekForward()increment.- Returns:
 - The seek forward increment, in milliseconds.
 - See Also:
 Player.Listener.onSeekForwardIncrementChanged(long)
 
- 
seekForward
void seekForward()
Deprecated.Seeks forward in the currentMediaItembygetSeekForwardIncrement()milliseconds.This method must only be called if
COMMAND_SEEK_FORWARDis available. 
- 
hasPrevious
@Deprecated boolean hasPrevious()
Deprecated.UsehasPreviousMediaItem()instead. 
- 
hasPreviousWindow
@Deprecated boolean hasPreviousWindow()
Deprecated.UsehasPreviousMediaItem()instead. 
- 
hasPreviousMediaItem
boolean hasPreviousMediaItem()
Deprecated.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 isREPEAT_MODE_OFF. SeeREPEAT_MODE_ONEfor more details.This method must only be called if
COMMAND_GET_TIMELINEis available. 
- 
previous
@Deprecated void previous()
Deprecated.UseseekToPreviousMediaItem()instead. 
- 
seekToPreviousWindow
@Deprecated void seekToPreviousWindow()
Deprecated.UseseekToPreviousMediaItem()instead. 
- 
seekToPreviousMediaItem
void seekToPreviousMediaItem()
Deprecated.Seeks to the default position of the previousMediaItem, which may depend on the current repeat mode and whether shuffle mode is enabled. Does nothing ifhasPreviousMediaItem()isfalse.Note: When the repeat mode is
REPEAT_MODE_ONE, this method behaves the same as when the current repeat mode isREPEAT_MODE_OFF. SeeREPEAT_MODE_ONEfor more details.This method must only be called if
COMMAND_SEEK_TO_PREVIOUS_MEDIA_ITEMis available. 
- 
getMaxSeekToPreviousPosition
long getMaxSeekToPreviousPosition()
Deprecated.Returns the maximum position for whichseekToPrevious()seeks to the previousMediaItem, in milliseconds.- Returns:
 - The maximum seek to previous position, in milliseconds.
 - See Also:
 Player.Listener.onMaxSeekToPreviousPositionChanged(long)
 
- 
seekToPrevious
void seekToPrevious()
Deprecated.Seeks 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 
MediaItemisisCurrentMediaItemLive()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 thangetMaxSeekToPreviousPosition(), seeks to the default position of the previousMediaItem. - Otherwise, seeks to 0 in the current 
MediaItem. 
This method must only be called if
COMMAND_SEEK_TO_PREVIOUSis available. 
- 
hasNext
@Deprecated boolean hasNext()
Deprecated.UsehasNextMediaItem()instead. 
- 
hasNextWindow
@Deprecated boolean hasNextWindow()
Deprecated.UsehasNextMediaItem()instead. 
- 
hasNextMediaItem
boolean hasNextMediaItem()
Deprecated.Returns whether a nextMediaItemexists, 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 isREPEAT_MODE_OFF. SeeREPEAT_MODE_ONEfor more details.This method must only be called if
COMMAND_GET_TIMELINEis available. 
- 
next
@Deprecated void next()
Deprecated.UseseekToNextMediaItem()instead. 
- 
seekToNextWindow
@Deprecated void seekToNextWindow()
Deprecated.UseseekToNextMediaItem()instead. 
- 
seekToNextMediaItem
void seekToNextMediaItem()
Deprecated.Seeks to the default position of the nextMediaItem, which may depend on the current repeat mode and whether shuffle mode is enabled. Does nothing ifhasNextMediaItem()isfalse.Note: When the repeat mode is
REPEAT_MODE_ONE, this method behaves the same as when the current repeat mode isREPEAT_MODE_OFF. SeeREPEAT_MODE_ONEfor more details.This method must only be called if
COMMAND_SEEK_TO_NEXT_MEDIA_ITEMis available. 
- 
seekToNext
void seekToNext()
Deprecated.Seeks 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
COMMAND_SEEK_TO_NEXTis available. 
- 
setPlaybackParameters
void setPlaybackParameters(PlaybackParameters playbackParameters)
Deprecated.Attempts to set the playback parameters. PassingPlaybackParameters.DEFAULTresets 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_PITCHis available.- Parameters:
 playbackParameters- The playback parameters.
 
- 
setPlaybackSpeed
void setPlaybackSpeed(@FloatRange(from=0.0,fromInclusive=false) float speed)Deprecated.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_PITCHis 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()
Deprecated.Returns the currently active playback parameters. 
- 
stop
void stop()
Deprecated.Stops playback without resetting the playlist. Usepause()rather than this method if the intention is to pause playback.Calling this method will cause the playback state to transition to
STATE_IDLEand the player will release the loaded media and resources required for playback. The player instance can still be used by callingprepare()again, andrelease()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_STOPis available. 
- 
release
void release()
Deprecated.Releases the player. This method must be called when the player is no longer required. The player must not be used after calling this method.This method must only be called if
COMMAND_RELEASEis available. 
- 
getCurrentTracks
Tracks getCurrentTracks()
Deprecated.Returns the current tracks.This method must only be called if
COMMAND_GET_TRACKSis available.- See Also:
 Player.Listener.onTracksChanged(Tracks)
 
- 
getTrackSelectionParameters
TrackSelectionParameters getTrackSelectionParameters()
Deprecated.Returns the parameters constraining the track selection.- See Also:
 }
 
- 
setTrackSelectionParameters
void setTrackSelectionParameters(TrackSelectionParameters parameters)
Deprecated.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_PARAMETERSis available. 
- 
getMediaMetadata
MediaMetadata getMediaMetadata()
Deprecated.Returns the current combinedMediaMetadata, orMediaMetadata.EMPTYif not supported.This
MediaMetadatais a combination of theMediaItem metadata, the static metadata in the media'sFormat, and any timed metadata that has been parsed from the media and output viaPlayer.Listener.onMetadata(Metadata). If a field is populated in theMediaItem.mediaMetadata, it will be prioritised above the same field coming from static or timed metadata.This method must only be called if
COMMAND_GET_METADATAis available. 
- 
getPlaylistMetadata
MediaMetadata getPlaylistMetadata()
Deprecated.Returns the playlistMediaMetadata, as set bysetPlaylistMetadata(MediaMetadata), orMediaMetadata.EMPTYif not supported.This method must only be called if
COMMAND_GET_METADATAis available. 
- 
setPlaylistMetadata
void setPlaylistMetadata(MediaMetadata mediaMetadata)
Deprecated.Sets the playlistMediaMetadata.This method must only be called if
COMMAND_SET_PLAYLIST_METADATAis available. 
- 
getCurrentManifest
@Nullable Object getCurrentManifest()
Deprecated.Returns the current manifest. The type depends on the type of media being played. May be null. 
- 
getCurrentTimeline
Timeline getCurrentTimeline()
Deprecated.Returns the currentTimeline. Never null, but may be empty.This method must only be called if
COMMAND_GET_TIMELINEis available. 
- 
getCurrentPeriodIndex
int getCurrentPeriodIndex()
Deprecated.Returns the index of the period currently being played.This method must only be called if
COMMAND_GET_TIMELINEis available. 
- 
getCurrentWindowIndex
@Deprecated int getCurrentWindowIndex()
Deprecated.UsegetCurrentMediaItemIndex()instead. 
- 
getCurrentMediaItemIndex
int getCurrentMediaItemIndex()
Deprecated.Returns the index of the currentMediaItemin thetimeline, or the prospective index if thecurrent timelineis empty.This method must only be called if
COMMAND_GET_TIMELINEis available. 
- 
getNextWindowIndex
@Deprecated int getNextWindowIndex()
Deprecated.UsegetNextMediaItemIndex()instead. 
- 
getNextMediaItemIndex
int getNextMediaItemIndex()
Deprecated.Returns the index of theMediaItemthat will be played ifseekToNextMediaItem()is called, which may depend on the current repeat mode and whether shuffle mode is enabled. ReturnsC.INDEX_UNSETifhasNextMediaItem()isfalse.Note: When the repeat mode is
REPEAT_MODE_ONE, this method behaves the same as when the current repeat mode isREPEAT_MODE_OFF. SeeREPEAT_MODE_ONEfor more details.This method must only be called if
COMMAND_GET_TIMELINEis available. 
- 
getPreviousWindowIndex
@Deprecated int getPreviousWindowIndex()
Deprecated.UsegetPreviousMediaItemIndex()instead. 
- 
getPreviousMediaItemIndex
int getPreviousMediaItemIndex()
Deprecated.Returns the index of theMediaItemthat will be played ifseekToPreviousMediaItem()is called, which may depend on the current repeat mode and whether shuffle mode is enabled. ReturnsC.INDEX_UNSETifhasPreviousMediaItem()isfalse.Note: When the repeat mode is
REPEAT_MODE_ONE, this method behaves the same as when the current repeat mode isREPEAT_MODE_OFF. SeeREPEAT_MODE_ONEfor more details.This method must only be called if
COMMAND_GET_TIMELINEis available. 
- 
getCurrentMediaItem
@Nullable MediaItem getCurrentMediaItem()
Deprecated.Returns the currently playingMediaItem. May be null if the timeline is empty.This method must only be called if
COMMAND_GET_CURRENT_MEDIA_ITEMis available. 
- 
getMediaItemCount
int getMediaItemCount()
Deprecated.Returns the number of media items in the playlist.This method must only be called if
COMMAND_GET_TIMELINEis available. 
- 
getMediaItemAt
MediaItem getMediaItemAt(int index)
Deprecated.Returns theMediaItemat the given index.This method must only be called if
COMMAND_GET_TIMELINEis available. 
- 
getDuration
long getDuration()
Deprecated.Returns the duration of the current content or ad in milliseconds, orC.TIME_UNSETif the duration is not known.This method must only be called if
COMMAND_GET_CURRENT_MEDIA_ITEMis available. 
- 
getCurrentPosition
long getCurrentPosition()
Deprecated.Returns the playback position in the current content or ad, in milliseconds, or the prospective position in milliseconds if thecurrent timelineis empty.This method must only be called if
COMMAND_GET_CURRENT_MEDIA_ITEMis available. 
- 
getBufferedPosition
long getBufferedPosition()
Deprecated.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_ITEMis available. 
- 
getBufferedPercentage
@IntRange(from=0L, to=100L) 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. 
- 
getTotalBufferedDuration
long getTotalBufferedDuration()
Deprecated.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_ITEMis available. 
- 
isCurrentWindowDynamic
@Deprecated boolean isCurrentWindowDynamic()
Deprecated.UseisCurrentMediaItemDynamic()instead. 
- 
isCurrentMediaItemDynamic
boolean isCurrentMediaItemDynamic()
Deprecated.Returns whether the currentMediaItemis dynamic (may change when theTimelineis updated), orfalseif theTimelineis empty.This method must only be called if
COMMAND_GET_CURRENT_MEDIA_ITEMis available.- See Also:
 Timeline.Window.isDynamic
 
- 
isCurrentWindowLive
@Deprecated boolean isCurrentWindowLive()
Deprecated.UseisCurrentMediaItemLive()instead. 
- 
isCurrentMediaItemLive
boolean isCurrentMediaItemLive()
Deprecated.Returns whether the currentMediaItemis live, orfalseif theTimelineis empty.This method must only be called if
COMMAND_GET_CURRENT_MEDIA_ITEMis available.- See Also:
 Timeline.Window.isLive()
 
- 
getCurrentLiveOffset
long getCurrentLiveOffset()
Deprecated.Returns the offset of the current playback position from the live edge in milliseconds, orC.TIME_UNSETif the currentMediaItemisCurrentMediaItemLive()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_ITEMis available. 
- 
isCurrentWindowSeekable
@Deprecated boolean isCurrentWindowSeekable()
Deprecated.UseisCurrentMediaItemSeekable()instead. 
- 
isCurrentMediaItemSeekable
boolean isCurrentMediaItemSeekable()
Deprecated.Returns whether the currentMediaItemis seekable, orfalseif theTimelineis empty.This method must only be called if
COMMAND_GET_CURRENT_MEDIA_ITEMis available.- See Also:
 Timeline.Window.isSeekable
 
- 
isPlayingAd
boolean isPlayingAd()
Deprecated.Returns whether the player is currently playing an ad.This method must only be called if
COMMAND_GET_CURRENT_MEDIA_ITEMis available. 
- 
getCurrentAdGroupIndex
int getCurrentAdGroupIndex()
Deprecated.IfisPlayingAd()returns true, returns the index of the ad group in the period currently being played. ReturnsC.INDEX_UNSETotherwise.This method must only be called if
COMMAND_GET_CURRENT_MEDIA_ITEMis available. 
- 
getCurrentAdIndexInAdGroup
int getCurrentAdIndexInAdGroup()
Deprecated.IfisPlayingAd()returns true, returns the index of the ad in its ad group. ReturnsC.INDEX_UNSETotherwise.This method must only be called if
COMMAND_GET_CURRENT_MEDIA_ITEMis available. 
- 
getContentDuration
long getContentDuration()
Deprecated.IfisPlayingAd()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 bygetDuration().This method must only be called if
COMMAND_GET_CURRENT_MEDIA_ITEMis available. 
- 
getContentPosition
long getContentPosition()
Deprecated.IfisPlayingAd()returnstrue, 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 bygetCurrentPosition().This method must only be called if
COMMAND_GET_CURRENT_MEDIA_ITEMis available. 
- 
getContentBufferedPosition
long getContentBufferedPosition()
Deprecated.IfisPlayingAd()returnstrue, 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 bygetBufferedPosition().This method must only be called if
COMMAND_GET_CURRENT_MEDIA_ITEMis available. 
- 
getAudioAttributes
AudioAttributes getAudioAttributes()
Deprecated.Returns the attributes for audio playback.This method must only be called if
COMMAND_GET_AUDIO_ATTRIBUTESis available. 
- 
setVolume
void setVolume(@FloatRange(from=0.0,to=1.0) float volume)Deprecated.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_VOLUMEis available.- Parameters:
 volume- Linear output gain to apply to all audio channels.
 
- 
getVolume
@FloatRange(from=0.0, to=1.0) float getVolume()Deprecated.Returns the audio volume, with 0 being silence and 1 being unity gain (signal unchanged).This method must only be called if
COMMAND_GET_VOLUMEis available.- Returns:
 - The linear gain applied to all audio channels.
 
 
- 
clearVideoSurface
void clearVideoSurface()
Deprecated.Clears anySurface,SurfaceHolder,SurfaceVieworTextureViewcurrently set on the player.This method must only be called if
COMMAND_SET_VIDEO_SURFACEis available. 
- 
clearVideoSurface
void clearVideoSurface(@Nullable Surface surface)Deprecated.Clears theSurfaceonto which video is being rendered if it matches the one passed. Else does nothing.This method must only be called if
COMMAND_SET_VIDEO_SURFACEis available.- Parameters:
 surface- The surface to clear.
 
- 
setVideoSurface
void setVideoSurface(@Nullable Surface surface)Deprecated.Sets theSurfaceonto which video will be rendered. The caller is responsible for tracking the lifecycle of the surface, and must clear the surface by callingsetVideoSurface(null)if the surface is destroyed.If the surface is held by a
SurfaceView,TextureVieworSurfaceHolderthen it's recommended to usesetVideoSurfaceView(SurfaceView),setVideoTextureView(TextureView)orsetVideoSurfaceHolder(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_SURFACEis available.- Parameters:
 surface- TheSurface.
 
- 
setVideoSurfaceHolder
void setVideoSurfaceHolder(@Nullable SurfaceHolder surfaceHolder)Deprecated.Sets theSurfaceHolderthat holds theSurfaceonto which video will be rendered. The player will track the lifecycle of the surface automatically.The thread that calls the
SurfaceHolder.Callbackmethods must be the thread associated withgetApplicationLooper().This method must only be called if
COMMAND_SET_VIDEO_SURFACEis available.- Parameters:
 surfaceHolder- The surface holder.
 
- 
clearVideoSurfaceHolder
void clearVideoSurfaceHolder(@Nullable SurfaceHolder surfaceHolder)Deprecated.Clears theSurfaceHolderthat holds theSurfaceonto which video is being rendered if it matches the one passed. Else does nothing.This method must only be called if
COMMAND_SET_VIDEO_SURFACEis available.- Parameters:
 surfaceHolder- The surface holder to clear.
 
- 
setVideoSurfaceView
void setVideoSurfaceView(@Nullable SurfaceView surfaceView)Deprecated.Sets theSurfaceViewonto which video will be rendered. The player will track the lifecycle of the surface automatically.The thread that calls the
SurfaceHolder.Callbackmethods must be the thread associated withgetApplicationLooper().This method must only be called if
COMMAND_SET_VIDEO_SURFACEis available.- Parameters:
 surfaceView- The surface view.
 
- 
clearVideoSurfaceView
void clearVideoSurfaceView(@Nullable SurfaceView surfaceView)Deprecated.Clears theSurfaceViewonto which video is being rendered if it matches the one passed. Else does nothing.This method must only be called if
COMMAND_SET_VIDEO_SURFACEis available.- Parameters:
 surfaceView- The texture view to clear.
 
- 
setVideoTextureView
void setVideoTextureView(@Nullable TextureView textureView)Deprecated.Sets theTextureViewonto which video will be rendered. The player will track the lifecycle of the surface automatically.The thread that calls the
TextureView.SurfaceTextureListenermethods must be the thread associated withgetApplicationLooper().This method must only be called if
COMMAND_SET_VIDEO_SURFACEis available.- Parameters:
 textureView- The texture view.
 
- 
clearVideoTextureView
void clearVideoTextureView(@Nullable TextureView textureView)Deprecated.Clears theTextureViewonto which video is being rendered if it matches the one passed. Else does nothing.This method must only be called if
COMMAND_SET_VIDEO_SURFACEis available.- Parameters:
 textureView- The texture view to clear.
 
- 
getVideoSize
VideoSize getVideoSize()
Deprecated.Gets the size of the video.The video's width and height are
0if there is no supported video track or its size has not been determined yet. 
- 
getSurfaceSize
Size getSurfaceSize()
Deprecated.Gets the size of the surface on which the video is rendered. 
- 
getCurrentCues
CueGroup getCurrentCues()
Deprecated.Returns the currentCueGroup.This method must only be called if
COMMAND_GET_TEXTis available. 
- 
getDeviceInfo
DeviceInfo getDeviceInfo()
Deprecated.Gets the device information. 
- 
getDeviceVolume
@IntRange(from=0L) int getDeviceVolume()
Deprecated.Gets the current volume of the device.For devices with
local playback, the volume returned by this method varies according to the currentstream type. The stream type is determined byAudioAttributes.usagewhich can be converted to stream type withUtil.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_VOLUMEis available. 
- 
isDeviceMuted
boolean isDeviceMuted()
Deprecated.Gets whether the device is muted or not.This method must only be called if
COMMAND_GET_DEVICE_VOLUMEis available. 
- 
setDeviceVolume
@Deprecated void setDeviceVolume(@IntRange(from=0L) int volume)
Deprecated.UsesetDeviceVolume(int, int)instead. 
- 
setDeviceVolume
void setDeviceVolume(@IntRange(from=0L) int volume, int flags)Deprecated.Sets the volume of the device with volume flags.This method must only be called if
COMMAND_SET_DEVICE_VOLUME_WITH_FLAGSis available.- Parameters:
 volume- The volume to set.flags- Either 0 or a bitwise combination of one or moreC.VolumeFlags.
 
- 
increaseDeviceVolume
@Deprecated void increaseDeviceVolume()
Deprecated.UseincreaseDeviceVolume(int)instead. 
- 
increaseDeviceVolume
void increaseDeviceVolume(@com.google.android.exoplayer2.C.VolumeFlags int flags)
Deprecated.Increases the volume of the device.The
getDeviceVolume()device volume cannot be increased aboveDeviceInfo.maxVolume, if defined.This method must only be called if
COMMAND_ADJUST_DEVICE_VOLUME_WITH_FLAGSis available.- Parameters:
 flags- Either 0 or a bitwise combination of one or moreC.VolumeFlags.
 
- 
decreaseDeviceVolume
@Deprecated void decreaseDeviceVolume()
Deprecated.UsedecreaseDeviceVolume(int)instead. 
- 
decreaseDeviceVolume
void decreaseDeviceVolume(@com.google.android.exoplayer2.C.VolumeFlags int flags)
Deprecated.Decreases the volume of the device.The
getDeviceVolume()device volume cannot be decreased belowDeviceInfo.minVolume.This method must only be called if
COMMAND_ADJUST_DEVICE_VOLUME_WITH_FLAGSis available.- Parameters:
 flags- Either 0 or a bitwise combination of one or moreC.VolumeFlags.
 
- 
setDeviceMuted
@Deprecated void setDeviceMuted(boolean muted)
Deprecated.UsesetDeviceMuted(boolean, int)instead. 
- 
setDeviceMuted
void setDeviceMuted(boolean muted, @com.google.android.exoplayer2.C.VolumeFlags int flags)Deprecated.Sets the mute state of the device.This method must only be called if
COMMAND_ADJUST_DEVICE_VOLUME_WITH_FLAGSis available.- Parameters:
 muted- Whether to set the device to be muted or notflags- Either 0 or a bitwise combination of one or moreC.VolumeFlags.
 
 - 
 
 -