Back to Exoplayer

Player (ExoPlayer library)

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

latest158.7 KB
Original Source

Package com.google.android.exoplayer2

Interface Player

  • All Known Subinterfaces:ExoPlayerAll Known Implementing Classes:BasePlayer, CastPlayer, ForwardingPlayer, SimpleBasePlayer, SimpleExoPlayer, StubExoPlayer, StubPlayer

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

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 commands to signal feature support and users of the interface must only call methods if the corresponding Player.Command is available.
  • Users can register Player.Listener callbacks 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 MediaItem instances. The player can also support repeat modes and shuffling within this playlist. The player provides a Timeline representing the structure of the playlist and all its items, which can be obtained by calling getCurrentTimeline()
  • Player instances can provide seeking within the currently playing item and to other items, using the various seek... methods.
  • Player instances can provide Tracks defining the currently available and selected tracks, which can be obtained by calling getCurrentTracks(). Users can also modify track selection behavior by setting TrackSelectionParameters with setTrackSelectionParameters(com.google.android.exoplayer2.trackselection.TrackSelectionParameters).
  • Player instances can provide MediaMetadata about the currently playing item, which can be obtained by calling getMediaMetadata().
  • 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 SurfaceView or TextureView for 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 UnstableApi classes 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.Listener with addListener(com.google.android.exoplayer2.Player.Listener).

The main elements of the overall player state are:

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 SimpleBasePlayer that 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 interface | Player.Command | Deprecated.

Commands that indicate which method calls are currently permitted on a particular Player instance. | | static class | Player.Commands | Deprecated.

A set of commands. | | static interface | Player.DiscontinuityReason | Deprecated.

Reasons for position discontinuities. | | static interface | Player.Event | Deprecated.

Events that can be reported via Player.Listener.onEvents(Player, Events). | | static class | Player.Events | Deprecated.

A set of events. | | static interface | Player.Listener | Deprecated.

Listener for changes in a Player. | | static interface | Player.MediaItemTransitionReason | Deprecated.

Reasons for media item transitions. | | static interface | Player.PlaybackSuppressionReason | Deprecated.

Reason why playback is suppressed even though getPlayWhenReady() is true. | | static interface | Player.PlayWhenReadyChangeReason | Deprecated.

Reasons for playWhenReady changes. | | static class | Player.PositionInfo | Deprecated.

Position info describing a playback position involved in a discontinuity. | | static interface | Player.RepeatMode | Deprecated.

Repeat modes for playback. | | static interface | Player.State | Deprecated.

Playback state. | | static interface | Player.TimelineChangeReason | Deprecated.

Reasons for timeline changes. |

Field Summary

Fields | Modifier and Type | Field | Description | | --- | --- | --- | | static int | COMMAND_ADJUST_DEVICE_VOLUME | Deprecated. Use COMMAND_ADJUST_DEVICE_VOLUME_WITH_FLAGS instead.

| | static int | COMMAND_ADJUST_DEVICE_VOLUME_WITH_FLAGS | Deprecated.

Command to increase and decrease the device volume and mute it with volume flags. | | static int | COMMAND_CHANGE_MEDIA_ITEMS | Deprecated.

Command to change the media items in the playlist. | | static int | COMMAND_GET_AUDIO_ATTRIBUTES | Deprecated.

Command to get the player current AudioAttributes. | | static int | COMMAND_GET_CURRENT_MEDIA_ITEM | Deprecated.

Command to get information about the currently playing MediaItem. | | static int | COMMAND_GET_DEVICE_VOLUME | Deprecated.

Command to get the device volume and whether it is muted. | | static int | COMMAND_GET_MEDIA_ITEMS_METADATA | Deprecated. Use COMMAND_GET_METADATA instead.

| | static int | COMMAND_GET_METADATA | Deprecated.

Command to get metadata related to the playlist and current MediaItem. | | static int | COMMAND_GET_TEXT | Deprecated.

Command to get the text that should currently be displayed by the player. | | static int | COMMAND_GET_TIMELINE | Deprecated.

Command to get the information about the current timeline. | | static int | COMMAND_GET_TRACKS | Deprecated.

Command to get details of the current track selection. | | static int | COMMAND_GET_VOLUME | Deprecated.

Command to get the player volume. | | static int | COMMAND_INVALID | Deprecated.

Represents an invalid Player.Command. | | static int | COMMAND_PLAY_PAUSE | Deprecated.

Command to start, pause or resume playback. | | static int | COMMAND_PREPARE | Deprecated.

Command to prepare the player. | | static int | COMMAND_RELEASE | Deprecated.

Command to release the player. | | static int | COMMAND_SEEK_BACK | Deprecated.

Command to seek back by a fixed increment inside the current MediaItem. | | static int | COMMAND_SEEK_FORWARD | Deprecated.

Command to seek forward by a fixed increment inside the current MediaItem. | | static int | COMMAND_SEEK_IN_CURRENT_MEDIA_ITEM | Deprecated.

Command to seek anywhere inside the current MediaItem. | | static int | COMMAND_SEEK_IN_CURRENT_WINDOW | Deprecated. Use COMMAND_SEEK_IN_CURRENT_MEDIA_ITEM instead.

| | static int | COMMAND_SEEK_TO_DEFAULT_POSITION | Deprecated.

Command to seek to the default position of the current MediaItem. | | static int | COMMAND_SEEK_TO_MEDIA_ITEM | Deprecated.

Command to seek anywhere in any MediaItem. | | static int | COMMAND_SEEK_TO_NEXT | Deprecated.

Command to seek to a later position in the current MediaItem or the default position of the next MediaItem. | | static int | COMMAND_SEEK_TO_NEXT_MEDIA_ITEM | Deprecated.

Command to seek to the default position of the next MediaItem. | | static int | COMMAND_SEEK_TO_NEXT_WINDOW | Deprecated. Use COMMAND_SEEK_TO_NEXT_MEDIA_ITEM instead.

| | static int | COMMAND_SEEK_TO_PREVIOUS | Deprecated.

Command to seek to an earlier position in the current MediaItem or the default position of the previous MediaItem. | | static int | COMMAND_SEEK_TO_PREVIOUS_MEDIA_ITEM | Deprecated.

Command to seek to the default position of the previous MediaItem. | | static int | COMMAND_SEEK_TO_PREVIOUS_WINDOW | Deprecated. Use COMMAND_SEEK_TO_PREVIOUS_MEDIA_ITEM instead.

| | static int | COMMAND_SEEK_TO_WINDOW | Deprecated. Use COMMAND_SEEK_TO_MEDIA_ITEM instead.

| | static int | COMMAND_SET_DEVICE_VOLUME | Deprecated. Use COMMAND_SET_DEVICE_VOLUME_WITH_FLAGS instead.

| | static int | COMMAND_SET_DEVICE_VOLUME_WITH_FLAGS | Deprecated.

Command to set the device volume with volume flags. | | static int | COMMAND_SET_MEDIA_ITEM | Deprecated.

Command to set a MediaItem. | | static int | COMMAND_SET_MEDIA_ITEMS_METADATA | Deprecated. Use COMMAND_SET_PLAYLIST_METADATA instead.

| | static int | COMMAND_SET_PLAYLIST_METADATA | Deprecated.

Command to set the playlist metadata. | | static int | COMMAND_SET_REPEAT_MODE | Deprecated.

Command to set the repeat mode. | | static int | COMMAND_SET_SHUFFLE_MODE | Deprecated.

Command to enable shuffling. | | static int | COMMAND_SET_SPEED_AND_PITCH | Deprecated.

Command to set the playback speed and pitch. | | static int | COMMAND_SET_TRACK_SELECTION_PARAMETERS | Deprecated.

Command to set the player's track selection parameters. | | static int | COMMAND_SET_VIDEO_SURFACE | Deprecated.

Command to set and clear the surface on which to render the video. | | static int | COMMAND_SET_VOLUME | Deprecated.

Command to set the player volume. | | static int | COMMAND_STOP | Deprecated.

Command to stop playback. | | static int | DISCONTINUITY_REASON_AUTO_TRANSITION | Deprecated.

Automatic playback transition from one period in the timeline to the next. | | static int | DISCONTINUITY_REASON_INTERNAL | Deprecated.

Discontinuity introduced internally (e.g. | | static int | DISCONTINUITY_REASON_REMOVE | Deprecated.

Discontinuity caused by the removal of the current period from the Timeline. | | static int | DISCONTINUITY_REASON_SEEK | Deprecated.

Seek within the current period or to another period. | | static 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. | | static int | DISCONTINUITY_REASON_SKIP | Deprecated.

Discontinuity introduced by a skipped period (for instance a skipped ad). | | static int | EVENT_AUDIO_ATTRIBUTES_CHANGED | Deprecated.

getAudioAttributes() changed. | | static int | EVENT_AUDIO_SESSION_ID | Deprecated.

The audio session id was set. | | static int | EVENT_AVAILABLE_COMMANDS_CHANGED | Deprecated.

isCommandAvailable(int) changed for at least one Player.Command. | | static int | EVENT_CUES | Deprecated.

getCurrentCues() changed. | | static int | EVENT_DEVICE_INFO_CHANGED | Deprecated.

getDeviceInfo() changed. | | static int | EVENT_DEVICE_VOLUME_CHANGED | Deprecated.

getDeviceVolume() changed. | | static int | EVENT_IS_LOADING_CHANGED | Deprecated.

isLoading() ()} changed. | | static int | EVENT_IS_PLAYING_CHANGED | Deprecated.

isPlaying() changed. | | static int | EVENT_MAX_SEEK_TO_PREVIOUS_POSITION_CHANGED | Deprecated.

getMaxSeekToPreviousPosition() changed. | | static int | EVENT_MEDIA_ITEM_TRANSITION | Deprecated.

getCurrentMediaItem() changed or the player started repeating the current item. | | static int | EVENT_MEDIA_METADATA_CHANGED | Deprecated.

getMediaMetadata() changed. | | static int | EVENT_METADATA | Deprecated.

Metadata associated with the current playback time changed. | | static int | EVENT_PLAY_WHEN_READY_CHANGED | Deprecated.

getPlayWhenReady() changed. | | static int | EVENT_PLAYBACK_PARAMETERS_CHANGED | Deprecated.

getPlaybackParameters() changed. | | static int | EVENT_PLAYBACK_STATE_CHANGED | Deprecated.

getPlaybackState() changed. | | static int | EVENT_PLAYBACK_SUPPRESSION_REASON_CHANGED | Deprecated.

getPlaybackSuppressionReason() changed. | | static int | EVENT_PLAYER_ERROR | Deprecated.

getPlayerError() changed. | | static int | EVENT_PLAYLIST_METADATA_CHANGED | Deprecated.

getPlaylistMetadata() changed. | | static int | EVENT_POSITION_DISCONTINUITY | Deprecated.

A position discontinuity occurred. | | static 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. | | static int | EVENT_REPEAT_MODE_CHANGED | Deprecated.

getRepeatMode() changed. | | static int | EVENT_SEEK_BACK_INCREMENT_CHANGED | Deprecated.

getSeekBackIncrement() changed. | | static int | EVENT_SEEK_FORWARD_INCREMENT_CHANGED | Deprecated.

getSeekForwardIncrement() changed. | | static int | EVENT_SHUFFLE_MODE_ENABLED_CHANGED | Deprecated.

getShuffleModeEnabled() changed. | | static int | EVENT_SKIP_SILENCE_ENABLED_CHANGED | Deprecated.

Skipping silences in the audio stream is enabled or disabled. | | static int | EVENT_SURFACE_SIZE_CHANGED | Deprecated.

The size of the surface onto which the video is being rendered changed. | | static int | EVENT_TIMELINE_CHANGED | Deprecated.

getCurrentTimeline() changed. | | static int | EVENT_TRACK_SELECTION_PARAMETERS_CHANGED | Deprecated.

getTrackSelectionParameters() changed. | | static int | EVENT_TRACKS_CHANGED | Deprecated.

getCurrentTracks() changed. | | static int | EVENT_VIDEO_SIZE_CHANGED | Deprecated.

getVideoSize() changed. | | static int | EVENT_VOLUME_CHANGED | Deprecated.

getVolume() changed. | | static int | MEDIA_ITEM_TRANSITION_REASON_AUTO | Deprecated.

Playback has automatically transitioned to the next media item. | | static int | MEDIA_ITEM_TRANSITION_REASON_PLAYLIST_CHANGED | Deprecated.

The current media item has changed because of a change in the playlist. | | static int | MEDIA_ITEM_TRANSITION_REASON_REPEAT | Deprecated.

The media item has been repeated. | | static int | MEDIA_ITEM_TRANSITION_REASON_SEEK | Deprecated.

A seek to another media item has occurred. | | static int | PLAY_WHEN_READY_CHANGE_REASON_AUDIO_BECOMING_NOISY | Deprecated.

Playback has been paused to avoid becoming noisy. | | static int | PLAY_WHEN_READY_CHANGE_REASON_AUDIO_FOCUS_LOSS | Deprecated.

Playback has been paused because of a loss of audio focus. | | static int | PLAY_WHEN_READY_CHANGE_REASON_END_OF_MEDIA_ITEM | Deprecated.

Playback has been paused at the end of a media item. | | static int | PLAY_WHEN_READY_CHANGE_REASON_REMOTE | Deprecated.

Playback has been started or paused because of a remote change. | | static int | PLAY_WHEN_READY_CHANGE_REASON_SUPPRESSED_TOO_LONG | Deprecated.

Playback has been paused because playback has been suppressed too long. | | static int | PLAY_WHEN_READY_CHANGE_REASON_USER_REQUEST | Deprecated.

Playback has been started or paused by a call to setPlayWhenReady(boolean). | | static int | PLAYBACK_SUPPRESSION_REASON_NONE | Deprecated.

Playback is not suppressed. | | static int | PLAYBACK_SUPPRESSION_REASON_TRANSIENT_AUDIO_FOCUS_LOSS | Deprecated.

Playback is suppressed due to transient audio focus loss. | | static 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. | | static int | REPEAT_MODE_ALL | Deprecated.

Repeats the entire timeline infinitely. | | static int | REPEAT_MODE_OFF | Deprecated.

Normal playback without repetition. | | static int | REPEAT_MODE_ONE | Deprecated.

Repeats the currently playing MediaItem infinitely during ongoing playback. | | static int | STATE_BUFFERING | Deprecated.

The player is not able to immediately play the media, but is doing work toward being able to do so. | | static int | STATE_ENDED | Deprecated.

The player has finished playing the media. | | static int | STATE_IDLE | Deprecated.

The player is idle, meaning it holds only limited resources. | | static int | STATE_READY | Deprecated.

The player is able to immediately play from its current position. | | static 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. | | static int | TIMELINE_CHANGE_REASON_SOURCE_UPDATE | Deprecated.

Timeline changed as a result of a source update (e.g. |

Method Summary

All Methods Instance Methods Abstract Methods Deprecated Methods | Modifier and Type | Method | Description | | --- | --- | --- | | void | addListener​(Player.Listener listener) | Deprecated.

Registers a listener to receive all events from the player. | | void | addMediaItem​(int index, MediaItem mediaItem) | Deprecated.

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

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

Adds a list of media items at the given index of the playlist. | | void | addMediaItems​(List<MediaItem> mediaItems) | Deprecated.

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

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

Clears the playlist. | | void | clearVideoSurface() | Deprecated.

Clears any Surface, SurfaceHolder, SurfaceView or TextureView currently set on the player. | | void | clearVideoSurface​(Surface surface) | Deprecated.

Clears the Surface onto which video is being rendered if it matches the one passed. | | void | clearVideoSurfaceHolder​(SurfaceHolder surfaceHolder) | Deprecated.

Clears the SurfaceHolder that holds the Surface onto which video is being rendered if it matches the one passed. | | void | clearVideoSurfaceView​(SurfaceView surfaceView) | Deprecated.

Clears the SurfaceView onto which video is being rendered if it matches the one passed. | | void | clearVideoTextureView​(TextureView textureView) | Deprecated.

Clears the TextureView onto which video is being rendered if it matches the one passed. | | void | decreaseDeviceVolume() | Deprecated. Use decreaseDeviceVolume(int) instead.

| | void | decreaseDeviceVolume​(@com.google.android.exoplayer2.C.VolumeFlags int flags) | Deprecated.

Decreases the volume of the device. | | Looper | getApplicationLooper() | Deprecated.

Returns the Looper associated with the application thread that's used to access the player and on which player events are received. | | AudioAttributes | getAudioAttributes() | Deprecated.

Returns the attributes for audio playback. | | Player.Commands | getAvailableCommands() | Deprecated.

Returns the player's currently available Player.Commands. | | int | getBufferedPercentage() | Deprecated.

Returns an estimate of the percentage in the current content or ad up to which data is buffered, or 0 if no estimate is available. | | long | getBufferedPosition() | Deprecated.

Returns an estimate of the position in the current content or ad up to which data is buffered, in milliseconds. | | long | getContentBufferedPosition() | Deprecated.

If isPlayingAd() returns true, returns an estimate of the content position in the current content up to which data is buffered, in milliseconds. | | long | getContentDuration() | Deprecated.

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

If isPlayingAd() returns true, returns the content position that will be played once all ads in the ad group have finished playing, in milliseconds. | | int | getCurrentAdGroupIndex() | Deprecated.

If isPlayingAd() returns true, returns the index of the ad group in the period currently being played. | | int | getCurrentAdIndexInAdGroup() | Deprecated.

If isPlayingAd() returns true, returns the index of the ad in its ad group. | | CueGroup | getCurrentCues() | Deprecated.

Returns the current CueGroup. | | long | getCurrentLiveOffset() | Deprecated.

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

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

Returns the currently playing MediaItem. | | int | getCurrentMediaItemIndex() | Deprecated.

Returns the index of the current MediaItem in the timeline, or the prospective index if the current timeline is empty. | | int | getCurrentPeriodIndex() | Deprecated.

Returns the index of the period currently being played. | | long | getCurrentPosition() | Deprecated.

Returns the playback position in the current content or ad, in milliseconds, or the prospective position in milliseconds if the current timeline is empty. | | Timeline | getCurrentTimeline() | Deprecated.

Returns the current Timeline. | | Tracks | getCurrentTracks() | Deprecated.

Returns the current tracks. | | int | getCurrentWindowIndex() | Deprecated. Use getCurrentMediaItemIndex() instead.

| | DeviceInfo | getDeviceInfo() | Deprecated.

Gets the device information. | | int | getDeviceVolume() | Deprecated.

Gets the current volume of the device. | | long | getDuration() | Deprecated.

Returns the duration of the current content or ad in milliseconds, or C.TIME_UNSET if the duration is not known. | | long | getMaxSeekToPreviousPosition() | Deprecated.

Returns the maximum position for which seekToPrevious() seeks to the previous MediaItem, in milliseconds. | | MediaItem | getMediaItemAt​(int index) | Deprecated.

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

Returns the number of media items in the playlist. | | MediaMetadata | getMediaMetadata() | Deprecated.

Returns the current combined MediaMetadata, or MediaMetadata.EMPTY if not supported. | | int | getNextMediaItemIndex() | Deprecated.

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

| | PlaybackParameters | getPlaybackParameters() | Deprecated.

Returns the currently active playback parameters. | | @com.google.android.exoplayer2.Player.State int | getPlaybackState() | Deprecated.

Returns the current playback state of the player. | | @com.google.android.exoplayer2.Player.PlaybackSuppressionReason int | getPlaybackSuppressionReason() | Deprecated.

Returns the reason why playback is suppressed even though getPlayWhenReady() is true, or PLAYBACK_SUPPRESSION_REASON_NONE if playback is not suppressed. | | PlaybackException | getPlayerError() | Deprecated.

Returns the error that caused playback to fail. | | MediaMetadata | getPlaylistMetadata() | Deprecated.

Returns the playlist MediaMetadata, as set by setPlaylistMetadata(MediaMetadata), or MediaMetadata.EMPTY if not supported. | | boolean | getPlayWhenReady() | Deprecated.

Whether playback will proceed when getPlaybackState() == STATE_READY. | | int | getPreviousMediaItemIndex() | Deprecated.

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

| | @com.google.android.exoplayer2.Player.RepeatMode int | getRepeatMode() | Deprecated.

Returns the current Player.RepeatMode used for playback. | | long | getSeekBackIncrement() | Deprecated.

Returns the seekBack() increment. | | long | getSeekForwardIncrement() | Deprecated.

Returns the seekForward() increment. | | boolean | getShuffleModeEnabled() | Deprecated.

Returns whether shuffling of media items is enabled. | | Size | getSurfaceSize() | Deprecated.

Gets the size of the surface on which the video is rendered. | | long | getTotalBufferedDuration() | Deprecated.

Returns an estimate of the total buffered duration from the current position, in milliseconds. | | TrackSelectionParameters | getTrackSelectionParameters() | Deprecated.

Returns the parameters constraining the track selection. | | VideoSize | getVideoSize() | Deprecated.

Gets the size of the video. | | float | getVolume() | Deprecated.

Returns the audio volume, with 0 being silence and 1 being unity gain (signal unchanged). | | boolean | hasNext() | Deprecated. Use hasNextMediaItem() instead.

| | boolean | hasNextMediaItem() | Deprecated.

Returns whether a next MediaItem exists, which may depend on the current repeat mode and whether shuffle mode is enabled. | | boolean | hasNextWindow() | Deprecated. Use hasNextMediaItem() instead.

| | boolean | hasPrevious() | Deprecated. Use hasPreviousMediaItem() instead.

| | boolean | hasPreviousMediaItem() | Deprecated.

Returns whether a previous media item exists, which may depend on the current repeat mode and whether shuffle mode is enabled. | | boolean | hasPreviousWindow() | Deprecated. Use hasPreviousMediaItem() instead.

| | void | increaseDeviceVolume() | Deprecated. Use increaseDeviceVolume(int) instead.

| | void | increaseDeviceVolume​(@com.google.android.exoplayer2.C.VolumeFlags int flags) | Deprecated.

Increases the volume of the device. | | boolean | isCommandAvailable​(@com.google.android.exoplayer2.Player.Command int command) | Deprecated.

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

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

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

Returns whether the current MediaItem is seekable, or false if the Timeline is empty. | | boolean | isCurrentWindowDynamic() | Deprecated. Use isCurrentMediaItemDynamic() instead.

| | boolean | isCurrentWindowLive() | Deprecated. Use isCurrentMediaItemLive() instead.

| | boolean | isCurrentWindowSeekable() | Deprecated. Use isCurrentMediaItemSeekable() instead.

| | boolean | isDeviceMuted() | Deprecated.

Gets whether the device is muted or not. | | boolean | isLoading() | Deprecated.

Whether the player is currently loading the source. | | boolean | isPlaying() | Deprecated.

Returns whether the player is playing, i.e. | | boolean | isPlayingAd() | Deprecated.

Returns whether the player is currently playing an ad. | | void | moveMediaItem​(int currentIndex, int newIndex) | Deprecated.

Moves the media item at the current index to the new index. | | void | moveMediaItems​(int fromIndex, int toIndex, int newIndex) | Deprecated.

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

| | void | pause() | Deprecated.

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

Resumes playback as soon as getPlaybackState() == STATE_READY. | | void | prepare() | Deprecated.

Prepares the player. | | void | previous() | Deprecated. Use seekToPreviousMediaItem() instead.

| | void | release() | Deprecated.

Releases the player. | | void | removeListener​(Player.Listener listener) | Deprecated.

Unregister a listener registered through addListener(Listener). | | void | removeMediaItem​(int index) | Deprecated.

Removes the media item at the given index of the playlist. | | void | removeMediaItems​(int fromIndex, int toIndex) | Deprecated.

Removes a range of media items from the playlist. | | void | replaceMediaItem​(int index, MediaItem mediaItem) | Deprecated.

Replaces the media item at the given index of the playlist. | | void | replaceMediaItems​(int fromIndex, int toIndex, List<MediaItem> mediaItems) | Deprecated.

Replaces the media items at the given range of the playlist. | | void | seekBack() | Deprecated.

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

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

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

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

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

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

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

Seeks to the default position of the next MediaItem, which may depend on the current repeat mode and whether shuffle mode is enabled. | | void | seekToNextWindow() | Deprecated. Use seekToNextMediaItem() instead.

| | void | seekToPrevious() | Deprecated.

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

Seeks to the default position of the previous MediaItem, which may depend on the current repeat mode and whether shuffle mode is enabled. | | void | seekToPreviousWindow() | Deprecated. Use seekToPreviousMediaItem() instead.

| | void | setDeviceMuted​(boolean muted) | Deprecated. Use setDeviceMuted(boolean, int) instead.

| | void | setDeviceMuted​(boolean muted, @com.google.android.exoplayer2.C.VolumeFlags int flags) | Deprecated.

Sets the mute state of the device. | | void | setDeviceVolume​(int volume) | Deprecated. Use setDeviceVolume(int, int) instead.

| | void | setDeviceVolume​(int volume, int flags) | Deprecated.

Sets the volume of the device with volume flags. | | void | setMediaItem​(MediaItem mediaItem) | Deprecated.

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

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

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

Clears the playlist, adds the specified media items and resets the position to the default position. | | void | setMediaItems​(List<MediaItem> mediaItems, boolean resetPosition) | Deprecated.

Clears the playlist and adds the specified media items. | | void | setMediaItems​(List<MediaItem> mediaItems, int startIndex, long startPositionMs) | Deprecated.

Clears the playlist and adds the specified media items. | | void | setPlaybackParameters​(PlaybackParameters playbackParameters) | Deprecated.

Attempts to set the playback parameters. | | void | setPlaybackSpeed​(float speed) | Deprecated.

Changes the rate at which playback occurs. | | void | setPlaylistMetadata​(MediaMetadata mediaMetadata) | Deprecated.

Sets the playlist MediaMetadata. | | void | setPlayWhenReady​(boolean playWhenReady) | Deprecated.

Sets whether playback should proceed when getPlaybackState() == STATE_READY. | | void | setRepeatMode​(@com.google.android.exoplayer2.Player.RepeatMode int repeatMode) | Deprecated.

Sets the Player.RepeatMode to be used for playback. | | void | setShuffleModeEnabled​(boolean shuffleModeEnabled) | Deprecated.

Sets whether shuffling of media items is enabled. | | void | setTrackSelectionParameters​(TrackSelectionParameters parameters) | Deprecated.

Sets the parameters constraining the track selection. | | void | setVideoSurface​(Surface surface) | Deprecated.

Sets the Surface onto which video will be rendered. | | void | setVideoSurfaceHolder​(SurfaceHolder surfaceHolder) | Deprecated.

Sets the SurfaceHolder that holds the Surface onto which video will be rendered. | | void | setVideoSurfaceView​(SurfaceView surfaceView) | Deprecated.

Sets the SurfaceView onto which video will be rendered. | | void | setVideoTextureView​(TextureView textureView) | Deprecated.

Sets the TextureView onto which video will be rendered. | | void | setVolume​(float volume) | Deprecated.

Sets the audio volume, valid values are between 0 (silence) and 1 (unity gain, signal unchanged), inclusive. | | void | stop() | 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 be prepared before 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 if getPlayWhenReady() 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 to setPlayWhenReady(boolean). See Also:Constant Field Values

- 

PLAY_WHEN_READY_CHANGE_REASON_AUDIO_FOCUS_LOSS

static final int PLAY_WHEN_READY_CHANGE_REASON_AUDIO_FOCUS_LOSS

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 next MediaItem respectively, and do nothing when there is no previous or next MediaItem to move to. See Also:Constant Field Values

- 

REPEAT_MODE_ONE

static final int REPEAT_MODE_ONE

Deprecated.

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

- 

REPEAT_MODE_ALL

static final int REPEAT_MODE_ALL

Deprecated.

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

- 

DISCONTINUITY_REASON_AUTO_TRANSITION

static final int DISCONTINUITY_REASON_AUTO_TRANSITION

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 the Timeline. 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. See Player.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 one Player.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:

  - [`play()`](#play())
  - [`pause()`](#pause())
  - [`setPlayWhenReady(boolean)`](#setPlayWhenReady(boolean))

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.

Command to stop playback.

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

See Also:Constant Field Values

- 

COMMAND_SEEK_TO_DEFAULT_POSITION

static final int COMMAND_SEEK_TO_DEFAULT_POSITION

Deprecated.

Command to seek to the default position of the current MediaItem.

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

See Also:Constant Field Values

- 

COMMAND_SEEK_IN_CURRENT_MEDIA_ITEM

static final int COMMAND_SEEK_IN_CURRENT_MEDIA_ITEM

Deprecated.

Command to seek anywhere inside the current MediaItem.

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

See Also:Constant Field Values

- 

COMMAND_SEEK_IN_CURRENT_WINDOW

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

Deprecated. Use COMMAND_SEEK_IN_CURRENT_MEDIA_ITEM instead.

See Also:Constant Field Values

- 

COMMAND_SEEK_TO_PREVIOUS_MEDIA_ITEM

static final int COMMAND_SEEK_TO_PREVIOUS_MEDIA_ITEM

Deprecated.

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

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

See Also:Constant Field Values

- 

COMMAND_SEEK_TO_PREVIOUS_WINDOW

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

Deprecated. Use COMMAND_SEEK_TO_PREVIOUS_MEDIA_ITEM instead.

See Also:Constant Field Values

- 

COMMAND_SEEK_TO_PREVIOUS

static final int COMMAND_SEEK_TO_PREVIOUS

Deprecated.

Command to seek to an earlier position in the current MediaItem or the default position of the previous MediaItem.

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

See Also:Constant Field Values

- 

COMMAND_SEEK_TO_NEXT_MEDIA_ITEM

static final int COMMAND_SEEK_TO_NEXT_MEDIA_ITEM

Deprecated.

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

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

See Also:Constant Field Values

- 

COMMAND_SEEK_TO_NEXT_WINDOW

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

Deprecated. Use COMMAND_SEEK_TO_NEXT_MEDIA_ITEM instead.

See Also:Constant Field Values

- 

COMMAND_SEEK_TO_NEXT

static final int COMMAND_SEEK_TO_NEXT

Deprecated.

Command to seek to a later position in the current MediaItem or the default position of the next MediaItem.

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

See Also:Constant Field Values

- 

COMMAND_SEEK_TO_MEDIA_ITEM

static final int COMMAND_SEEK_TO_MEDIA_ITEM

Deprecated.

Command to seek anywhere in any MediaItem.

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

  - [`seekTo(int, long)`](#seekTo(int,long))
  - [`seekToDefaultPosition(int)`](#seekToDefaultPosition(int))

See Also:Constant Field Values

- 

COMMAND_SEEK_TO_WINDOW

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

Deprecated. Use COMMAND_SEEK_TO_MEDIA_ITEM instead.

See Also:Constant Field Values

- 

COMMAND_SEEK_BACK

static final int COMMAND_SEEK_BACK

Deprecated.

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

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

See Also:Constant Field Values

- 

COMMAND_SEEK_FORWARD

static final int COMMAND_SEEK_FORWARD

Deprecated.

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

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

See Also:Constant Field Values

- 

COMMAND_SET_SPEED_AND_PITCH

static final int COMMAND_SET_SPEED_AND_PITCH

Deprecated.

Command to set the playback speed and pitch.

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

  - [`setPlaybackParameters(PlaybackParameters)`](#setPlaybackParameters(com.google.android.exoplayer2.PlaybackParameters))
  - [`setPlaybackSpeed(float)`](#setPlaybackSpeed(float))

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

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

  - [`getCurrentMediaItem()`](#getCurrentMediaItem())
  - [`isCurrentMediaItemDynamic()`](#isCurrentMediaItemDynamic())
  - [`isCurrentMediaItemLive()`](#isCurrentMediaItemLive())
  - [`isCurrentMediaItemSeekable()`](#isCurrentMediaItemSeekable())
  - [`getCurrentLiveOffset()`](#getCurrentLiveOffset())
  - [`getDuration()`](#getDuration())
  - [`getCurrentPosition()`](#getCurrentPosition())
  - [`getBufferedPosition()`](#getBufferedPosition())
  - [`getContentDuration()`](#getContentDuration())
  - [`getContentPosition()`](#getContentPosition())
  - [`getContentBufferedPosition()`](#getContentBufferedPosition())
  - [`getTotalBufferedDuration()`](#getTotalBufferedDuration())
  - [`isPlayingAd()`](#isPlayingAd())
  - [`getCurrentAdGroupIndex()`](#getCurrentAdGroupIndex())
  - [`getCurrentAdIndexInAdGroup()`](#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:

  - [`getCurrentTimeline()`](#getCurrentTimeline())
  - [`getCurrentMediaItemIndex()`](#getCurrentMediaItemIndex())
  - [`getCurrentPeriodIndex()`](#getCurrentPeriodIndex())
  - [`getMediaItemCount()`](#getMediaItemCount())
  - [`getMediaItemAt(int)`](#getMediaItemAt(int))
  - [`getNextMediaItemIndex()`](#getNextMediaItemIndex())
  - [`getPreviousMediaItemIndex()`](#getPreviousMediaItemIndex())
  - [`hasPreviousMediaItem()`](#hasPreviousMediaItem())
  - [`hasNextMediaItem()`](#hasNextMediaItem())

See Also:Constant Field Values

- 

COMMAND_GET_MEDIA_ITEMS_METADATA

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

Deprecated. Use COMMAND_GET_METADATA instead.

See Also:Constant Field Values

- 

COMMAND_GET_METADATA

static final int COMMAND_GET_METADATA

Deprecated.

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

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

  - [`getMediaMetadata()`](#getMediaMetadata())
  - [`getPlaylistMetadata()`](#getPlaylistMetadata())

See Also:Constant Field Values

- 

COMMAND_SET_MEDIA_ITEMS_METADATA

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

Deprecated. Use COMMAND_SET_PLAYLIST_METADATA instead.

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.

Command to set a MediaItem.

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

  - [`setMediaItem(MediaItem)`](#setMediaItem(com.google.android.exoplayer2.MediaItem))
  - [`setMediaItem(MediaItem, boolean)`](#setMediaItem(com.google.android.exoplayer2.MediaItem,boolean))
  - [`setMediaItem(MediaItem, long)`](#setMediaItem(com.google.android.exoplayer2.MediaItem,long))

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(com.google.android.exoplayer2.MediaItem))
  - [`addMediaItem(int, MediaItem)`](#addMediaItem(int,com.google.android.exoplayer2.MediaItem))
  - [`addMediaItems(List)`](#addMediaItems(java.util.List))
  - [`addMediaItems(int, List)`](#addMediaItems(int,java.util.List))
  - [`clearMediaItems()`](#clearMediaItems())
  - [`moveMediaItem(int, int)`](#moveMediaItem(int,int))
  - [`moveMediaItems(int, int, int)`](#moveMediaItems(int,int,int))
  - [`removeMediaItem(int)`](#removeMediaItem(int))
  - [`removeMediaItems(int, int)`](#removeMediaItems(int,int))
  - [`setMediaItems(List)`](#setMediaItems(java.util.List))
  - [`setMediaItems(List, boolean)`](#setMediaItems(java.util.List,boolean))
  - [`setMediaItems(List, int, long)`](#setMediaItems(java.util.List,int,long))
  - [`replaceMediaItem(int, MediaItem)`](#replaceMediaItem(int,com.google.android.exoplayer2.MediaItem))
  - [`replaceMediaItems(int, int, List)`](#replaceMediaItems(int,int,java.util.List))

See Also:Constant Field Values

- 

COMMAND_GET_AUDIO_ATTRIBUTES

static final int COMMAND_GET_AUDIO_ATTRIBUTES

Deprecated.

Command to get the player current AudioAttributes.

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

See Also:Constant Field Values

- 

COMMAND_GET_VOLUME

static final int COMMAND_GET_VOLUME

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:

  - [`getDeviceVolume()`](#getDeviceVolume())
  - [`isDeviceMuted()`](#isDeviceMuted())

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](https://developer.android.com/reference/java/lang/Deprecated.html "class or interface in java.lang")static final int COMMAND_SET_DEVICE_VOLUME

Deprecated. Use COMMAND_SET_DEVICE_VOLUME_WITH_FLAGS instead.

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](https://developer.android.com/reference/java/lang/Deprecated.html "class or interface in java.lang")static final int COMMAND_ADJUST_DEVICE_VOLUME

Deprecated. Use COMMAND_ADJUST_DEVICE_VOLUME_WITH_FLAGS instead.

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:

  - [`increaseDeviceVolume(int)`](#increaseDeviceVolume(@com.google.android.exoplayer2.C.VolumeFlagsint))
  - [`decreaseDeviceVolume(int)`](#decreaseDeviceVolume(@com.google.android.exoplayer2.C.VolumeFlagsint))
  - [`setDeviceMuted(boolean, int)`](#setDeviceMuted(boolean,@com.google.android.exoplayer2.C.VolumeFlagsint))

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:

  - [`setVideoSurface(Surface)`](#setVideoSurface(android.view.Surface))
  - [`clearVideoSurface()`](#clearVideoSurface())
  - [`clearVideoSurface(Surface)`](#clearVideoSurface(android.view.Surface))
  - [`setVideoSurfaceHolder(SurfaceHolder)`](#setVideoSurfaceHolder(android.view.SurfaceHolder))
  - [`clearVideoSurfaceHolder(SurfaceHolder)`](#clearVideoSurfaceHolder(android.view.SurfaceHolder))
  - [`setVideoSurfaceView(SurfaceView)`](#setVideoSurfaceView(android.view.SurfaceView))
  - [`clearVideoSurfaceView(SurfaceView)`](#clearVideoSurfaceView(android.view.SurfaceView))

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

Method Detail

- 

getApplicationLooper

[Looper](https://developer.android.com/reference/android/os/Looper.html "class or interface in android.os")getApplicationLooper()

Deprecated.

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

This method can be called from any thread.

- 

addListener

void addListener​([Player.Listener](Player.Listener.html "interface in com.google.android.exoplayer2")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](Player.Listener.html "interface in com.google.android.exoplayer2")listener)

Deprecated.

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

- 

setMediaItems

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

Deprecated.

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

This method must only be called if COMMAND_CHANGE_MEDIA_ITEMS is available.

Parameters:mediaItems - The new media items.

- 

setMediaItems

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

Deprecated.

Clears the playlist and adds the specified media items.

This method must only be called if COMMAND_CHANGE_MEDIA_ITEMS is available.

Parameters:mediaItems - The new media items.resetPosition - Whether the playback position should be reset to the default position in the first Timeline.Window. If false, playback will start from the position defined by getCurrentMediaItemIndex() and getCurrentPosition().

- 

setMediaItems

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

Deprecated.

Clears the playlist and adds the specified media items.

This method must only be called if COMMAND_CHANGE_MEDIA_ITEMS is available.

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

- 

setMediaItem

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

Deprecated.

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

This method must only be called if COMMAND_SET_MEDIA_ITEM is available.

Parameters:mediaItem - The new MediaItem.

- 

setMediaItem

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

Deprecated.

Clears the playlist and adds the specified MediaItem.

This method must only be called if COMMAND_SET_MEDIA_ITEM is available.

Parameters:mediaItem - The new MediaItem.startPositionMs - The position in milliseconds to start playback from.

- 

setMediaItem

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

Deprecated.

Clears the playlist and adds the specified MediaItem.

This method must only be called if COMMAND_SET_MEDIA_ITEM is available.

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

- 

addMediaItem

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

Deprecated.

Adds a media item to the end of the playlist.

This method must only be called if COMMAND_CHANGE_MEDIA_ITEMS is available.

Parameters:mediaItem - The MediaItem to add.

- 

addMediaItem

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

Deprecated.

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

This method must only be called if COMMAND_CHANGE_MEDIA_ITEMS is available.

Parameters:index - The index at which to add the media item. If the index is larger than the size of the playlist, the media item is added to the end of the playlist.mediaItem - The MediaItem to add.

- 

addMediaItems

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

Deprecated.

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

This method must only be called if COMMAND_CHANGE_MEDIA_ITEMS is available.

Parameters:mediaItems - The media items to add.

- 

addMediaItems

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

Deprecated.

Adds a list of media items at the given index of the playlist.

This method must only be called if COMMAND_CHANGE_MEDIA_ITEMS is available.

Parameters:index - The index at which to add the media items. If the index is larger than the size of the playlist, the media items are added to the end of the playlist.mediaItems - The media items to add.

- 

moveMediaItem

void moveMediaItem​(int currentIndex,
                   int newIndex)

Deprecated.

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

This method must only be called if COMMAND_CHANGE_MEDIA_ITEMS is available.

Parameters:currentIndex - The current index of the media item to move. If the index is larger than the size of the playlist, the request is ignored.newIndex - The new index of the media item. If the new index is larger than the size of the playlist the item is moved to the end of the playlist.

- 

moveMediaItems

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

Deprecated.

Moves the media item range to the new index.

This method must only be called if COMMAND_CHANGE_MEDIA_ITEMS is available.

Parameters:fromIndex - The start of the range to move. If the index is larger than the size of the playlist, the request is ignored.toIndex - The first item not to be included in the range (exclusive). If the index is larger than the size of the playlist, items up to the end of the playlist are moved.newIndex - The new index of the first media item of the range. If the new index is larger than the size of the remaining playlist after removing the range, the range is moved to the end of the playlist.

- 

replaceMediaItem

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

Deprecated.

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

This method must only be called if COMMAND_CHANGE_MEDIA_ITEMS is available.

Parameters:index - The index at which to replace the media item. If the index is larger than the size of the playlist, the request is ignored.mediaItem - The new MediaItem.

- 

replaceMediaItems

void replaceMediaItems​(int fromIndex,
                       int toIndex,[List](https://developer.android.com/reference/java/util/List.html "class or interface in java.util")<[MediaItem](MediaItem.html "class in com.google.android.exoplayer2")> mediaItems)

Deprecated.

Replaces the media items at the given range of the playlist.

This method must only be called if COMMAND_CHANGE_MEDIA_ITEMS is 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 fromIndex and toIndex does not have to match the number of added items defined by mediaItems. 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_ITEMS is available.

Parameters:index - The index at which to remove the media item. If the index is larger than the size of the playlist, the request is ignored.

- 

removeMediaItems

void removeMediaItems​(int fromIndex,
                      int toIndex)

Deprecated.

Removes a range of media items from the playlist.

This method must only be called if COMMAND_CHANGE_MEDIA_ITEMS is available.

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

- 

clearMediaItems

void clearMediaItems()

Deprecated.

Clears the playlist.

This method must only be called if COMMAND_CHANGE_MEDIA_ITEMS is available.

- 

isCommandAvailable

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

Deprecated.

Returns whether the provided Player.Command is available.

This method does not execute the command.

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

- 

canAdvertiseSession

boolean canAdvertiseSession()

Deprecated.

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

- 

getAvailableCommands

[Player.Commands](Player.Commands.html "class in com.google.android.exoplayer2")getAvailableCommands()

Deprecated.

Returns the player's currently available Player.Commands.

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

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

- 

prepare

void prepare()

Deprecated.

Prepares the player.

This method must only be called if COMMAND_PREPARE is available.

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

- 

getPlaybackState

[@State](Player.State.html "annotation in com.google.android.exoplayer2")@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](Player.PlaybackSuppressionReason.html "annotation in com.google.android.exoplayer2")@com.google.android.exoplayer2.Player.PlaybackSuppressionReason int getPlaybackSuppressionReason()

Deprecated.

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

- 

isPlaying

boolean isPlaying()

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 state`](#getPlaybackState()) is not [`ready`](#STATE_READY). 
  - There is no [`intention to play`](#getPlayWhenReady()). 
  - Playback is [`suppressed for other reasons`](#getPlaybackSuppressionReason()). 

Returns:Whether the player is playing.See Also:Player.Listener.onIsPlayingChanged(boolean)

- 

getPlayerError

@Nullable[PlaybackException](PlaybackException.html "class in com.google.android.exoplayer2")getPlayerError()

Deprecated.

Returns the error that caused playback to fail. This is the same error that will have been reported via Player.Listener.onPlayerError(PlaybackException) at the time of failure. It can be queried using this method until the player is re-prepared.

Note that this method will always return null if getPlaybackState() is not STATE_IDLE.

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

- 

play

void play()

Deprecated.

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

This method must only be called if COMMAND_PLAY_PAUSE is available.

- 

pause

void pause()

Deprecated.

Pauses playback. Equivalent to setPlayWhenReady(false).

This method must only be called if COMMAND_PLAY_PAUSE is available.

- 

setPlayWhenReady

void setPlayWhenReady​(boolean playWhenReady)

Deprecated.

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

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

This method must only be called if COMMAND_PLAY_PAUSE is available.

Parameters:playWhenReady - Whether playback should proceed when ready.

- 

getPlayWhenReady

boolean getPlayWhenReady()

Deprecated.

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

- 

setRepeatMode

void setRepeatMode​([@RepeatMode](Player.RepeatMode.html "annotation in com.google.android.exoplayer2")@com.google.android.exoplayer2.Player.RepeatMode int repeatMode)

Deprecated.

Sets the Player.RepeatMode to be used for playback.

This method must only be called if COMMAND_SET_REPEAT_MODE is available.

Parameters:repeatMode - The repeat mode.

- 

getRepeatMode

[@RepeatMode](Player.RepeatMode.html "annotation in com.google.android.exoplayer2")@com.google.android.exoplayer2.Player.RepeatMode int getRepeatMode()

Deprecated.

Returns the current Player.RepeatMode used 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_MODE is available.

Parameters:shuffleModeEnabled - Whether shuffling is enabled.

- 

getShuffleModeEnabled

boolean getShuffleModeEnabled()

Deprecated.

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

- 

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 current MediaItem. The position can depend on the type of media being played. For live streams it will typically be the live edge. For other streams it will typically be the start.

This method must only be called if COMMAND_SEEK_TO_DEFAULT_POSITION is available.

- 

seekToDefaultPosition

void seekToDefaultPosition​(int mediaItemIndex)

Deprecated.

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

This method must only be called if COMMAND_SEEK_TO_MEDIA_ITEM is available.

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

- 

seekTo

void seekTo​(long positionMs)

Deprecated.

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

This method must only be called if COMMAND_SEEK_IN_CURRENT_MEDIA_ITEM is available.

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

- 

seekTo

void seekTo​(int mediaItemIndex,
            long positionMs)

Deprecated.

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

This method must only be called if COMMAND_SEEK_TO_MEDIA_ITEM is available.

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

- 

getSeekBackIncrement

long getSeekBackIncrement()

Deprecated.

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

- 

seekBack

void seekBack()

Deprecated.

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

This method must only be called if COMMAND_SEEK_BACK is available.

- 

getSeekForwardIncrement

long getSeekForwardIncrement()

Deprecated.

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

- 

seekForward

void seekForward()

Deprecated.

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

This method must only be called if COMMAND_SEEK_FORWARD is available.

- 

hasPrevious

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

Deprecated. Use hasPreviousMediaItem() instead.

- 

hasPreviousWindow

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

Deprecated. Use hasPreviousMediaItem() 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 is REPEAT_MODE_OFF. See REPEAT_MODE_ONE for more details.

This method must only be called if COMMAND_GET_TIMELINE is available.

- 

previous

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

Deprecated. Use seekToPreviousMediaItem() instead.

- 

seekToPreviousWindow

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

Deprecated. Use seekToPreviousMediaItem() instead.

- 

seekToPreviousMediaItem

void seekToPreviousMediaItem()

Deprecated.

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

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

This method must only be called if COMMAND_SEEK_TO_PREVIOUS_MEDIA_ITEM is available.

- 

getMaxSeekToPreviousPosition

long getMaxSeekToPreviousPosition()

Deprecated.

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

- 

seekToPrevious

void seekToPrevious()

Deprecated.

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

  - Otherwise, if [`a previous media item exists`](#hasPreviousMediaItem()) and the [`current position`](#getCurrentPosition()) is less than [`getMaxSeekToPreviousPosition()`](#getMaxSeekToPreviousPosition()), seeks to the default position of the previous [`MediaItem`](MediaItem.html "class in com.google.android.exoplayer2"). 
  - Otherwise, seeks to 0 in the current [`MediaItem`](MediaItem.html "class in com.google.android.exoplayer2"). 

This method must only be called if COMMAND_SEEK_TO_PREVIOUS is available.

- 

hasNext

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

Deprecated. Use hasNextMediaItem() instead.

- 

hasNextWindow

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

Deprecated. Use hasNextMediaItem() instead.

- 

hasNextMediaItem

boolean hasNextMediaItem()

Deprecated.

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

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

This method must only be called if COMMAND_GET_TIMELINE is available.

- 

next

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

Deprecated. Use seekToNextMediaItem() instead.

- 

seekToNextWindow

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

Deprecated. Use seekToNextMediaItem() instead.

- 

seekToNextMediaItem

void seekToNextMediaItem()

Deprecated.

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

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

This method must only be called if COMMAND_SEEK_TO_NEXT_MEDIA_ITEM is available.

- 

seekToNext

void seekToNext()

Deprecated.

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

This method must only be called if COMMAND_SEEK_TO_NEXT is available.

- 

setPlaybackParameters

void setPlaybackParameters​([PlaybackParameters](PlaybackParameters.html "class in com.google.android.exoplayer2")playbackParameters)

Deprecated.

Attempts to set the playback parameters. Passing PlaybackParameters.DEFAULT resets the player to the default, which means there is no speed or pitch adjustment.

Playback parameters changes may cause the player to buffer. Player.Listener.onPlaybackParametersChanged(PlaybackParameters) will be called whenever the currently active playback parameters change.

This method must only be called if COMMAND_SET_SPEED_AND_PITCH is available.

Parameters:playbackParameters - The playback parameters.

- 

setPlaybackSpeed

void setPlaybackSpeed​(@FloatRange(from=0.0,fromInclusive=false)
                      float speed)

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_PITCH is available.

Parameters:speed - The linear factor by which playback will be sped up. Must be higher than 0. 1 is normal speed, 2 is twice as fast, 0.5 is half normal speed.

- 

getPlaybackParameters

[PlaybackParameters](PlaybackParameters.html "class in com.google.android.exoplayer2")getPlaybackParameters()

Deprecated.

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

- 

stop

void stop()

Deprecated.

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

Calling this method will cause the playback state to transition to STATE_IDLE and the player will release the loaded media and resources required for playback. The player instance can still be used by calling prepare() again, and release() must still be called on the player if it's no longer required.

Calling this method does not clear the playlist, reset the playback position or the playback error.

This method must only be called if COMMAND_STOP is available.

- 

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_RELEASE is available.

- 

getCurrentTracks

[Tracks](Tracks.html "class in com.google.android.exoplayer2")getCurrentTracks()

Deprecated.

Returns the current tracks.

This method must only be called if COMMAND_GET_TRACKS is available.

See Also:Player.Listener.onTracksChanged(Tracks)

- 

getTrackSelectionParameters

[TrackSelectionParameters](trackselection/TrackSelectionParameters.html "class in com.google.android.exoplayer2.trackselection")getTrackSelectionParameters()

Deprecated.

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

- 

setTrackSelectionParameters

void setTrackSelectionParameters​([TrackSelectionParameters](trackselection/TrackSelectionParameters.html "class in com.google.android.exoplayer2.trackselection")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_PARAMETERS is available.

- 

getMediaMetadata

[MediaMetadata](MediaMetadata.html "class in com.google.android.exoplayer2")getMediaMetadata()

Deprecated.

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

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

This method must only be called if COMMAND_GET_METADATA is available.

- 

getPlaylistMetadata

[MediaMetadata](MediaMetadata.html "class in com.google.android.exoplayer2")getPlaylistMetadata()

Deprecated.

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

This method must only be called if COMMAND_GET_METADATA is available.

- 

setPlaylistMetadata

void setPlaylistMetadata​([MediaMetadata](MediaMetadata.html "class in com.google.android.exoplayer2")mediaMetadata)

Deprecated.

Sets the playlist MediaMetadata.

This method must only be called if COMMAND_SET_PLAYLIST_METADATA is available.

- 

getCurrentManifest

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

Deprecated.

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

- 

getCurrentTimeline

[Timeline](Timeline.html "class in com.google.android.exoplayer2")getCurrentTimeline()

Deprecated.

Returns the current Timeline. Never null, but may be empty.

This method must only be called if COMMAND_GET_TIMELINE is available.

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

- 

getCurrentPeriodIndex

int getCurrentPeriodIndex()

Deprecated.

Returns the index of the period currently being played.

This method must only be called if COMMAND_GET_TIMELINE is available.

- 

getCurrentWindowIndex

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

Deprecated. Use getCurrentMediaItemIndex() instead.

- 

getCurrentMediaItemIndex

int getCurrentMediaItemIndex()

Deprecated.

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

This method must only be called if COMMAND_GET_TIMELINE is available.

- 

getNextWindowIndex

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

Deprecated. Use getNextMediaItemIndex() instead.

- 

getNextMediaItemIndex

int getNextMediaItemIndex()

Deprecated.

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

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

This method must only be called if COMMAND_GET_TIMELINE is available.

- 

getPreviousWindowIndex

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

Deprecated. Use getPreviousMediaItemIndex() instead.

- 

getPreviousMediaItemIndex

int getPreviousMediaItemIndex()

Deprecated.

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

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

This method must only be called if COMMAND_GET_TIMELINE is available.

- 

getCurrentMediaItem

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

Deprecated.

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

This method must only be called if COMMAND_GET_CURRENT_MEDIA_ITEM is available.

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

- 

getMediaItemCount

int getMediaItemCount()

Deprecated.

Returns the number of media items in the playlist.

This method must only be called if COMMAND_GET_TIMELINE is available.

- 

getMediaItemAt

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

Deprecated.

Returns the MediaItem at the given index.

This method must only be called if COMMAND_GET_TIMELINE is available.

- 

getDuration

long getDuration()

Deprecated.

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

This method must only be called if COMMAND_GET_CURRENT_MEDIA_ITEM is available.

- 

getCurrentPosition

long getCurrentPosition()

Deprecated.

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

This method must only be called if COMMAND_GET_CURRENT_MEDIA_ITEM is available.

- 

getBufferedPosition

long getBufferedPosition()

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_ITEM is 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_ITEM is available.

- 

isCurrentWindowDynamic

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

Deprecated. Use isCurrentMediaItemDynamic() instead.

- 

isCurrentMediaItemDynamic

boolean isCurrentMediaItemDynamic()

Deprecated.

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

This method must only be called if COMMAND_GET_CURRENT_MEDIA_ITEM is available.

See Also:Timeline.Window.isDynamic

- 

isCurrentWindowLive

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

Deprecated. Use isCurrentMediaItemLive() instead.

- 

isCurrentMediaItemLive

boolean isCurrentMediaItemLive()

Deprecated.

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

This method must only be called if COMMAND_GET_CURRENT_MEDIA_ITEM is available.

See Also:Timeline.Window.isLive()

- 

getCurrentLiveOffset

long getCurrentLiveOffset()

Deprecated.

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

The offset is calculated as currentTime - playbackPosition, so should usually be positive.

Note that this offset may rely on an accurate local time, so this method may return an incorrect value if the difference between system clock and server clock is unknown.

This method must only be called if COMMAND_GET_CURRENT_MEDIA_ITEM is available.

- 

isCurrentWindowSeekable

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

Deprecated. Use isCurrentMediaItemSeekable() instead.

- 

isCurrentMediaItemSeekable

boolean isCurrentMediaItemSeekable()

Deprecated.

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

This method must only be called if COMMAND_GET_CURRENT_MEDIA_ITEM is available.

See Also:Timeline.Window.isSeekable

- 

isPlayingAd

boolean isPlayingAd()

Deprecated.

Returns whether the player is currently playing an ad.

This method must only be called if COMMAND_GET_CURRENT_MEDIA_ITEM is available.

- 

getCurrentAdGroupIndex

int getCurrentAdGroupIndex()

Deprecated.

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

This method must only be called if COMMAND_GET_CURRENT_MEDIA_ITEM is available.

- 

getCurrentAdIndexInAdGroup

int getCurrentAdIndexInAdGroup()

Deprecated.

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

This method must only be called if COMMAND_GET_CURRENT_MEDIA_ITEM is available.

- 

getContentDuration

long getContentDuration()

Deprecated.

If isPlayingAd() returns true, returns the duration of the current content in milliseconds, or C.TIME_UNSET if the duration is not known. If there is no ad playing, the returned duration is the same as that returned by getDuration().

This method must only be called if COMMAND_GET_CURRENT_MEDIA_ITEM is available.

- 

getContentPosition

long getContentPosition()

Deprecated.

If isPlayingAd() returns true, returns the content position that will be played once all ads in the ad group have finished playing, in milliseconds. If there is no ad playing, the returned position is the same as that returned by getCurrentPosition().

This method must only be called if COMMAND_GET_CURRENT_MEDIA_ITEM is available.

- 

getContentBufferedPosition

long getContentBufferedPosition()

Deprecated.

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

This method must only be called if COMMAND_GET_CURRENT_MEDIA_ITEM is available.

- 

getAudioAttributes

[AudioAttributes](audio/AudioAttributes.html "class in com.google.android.exoplayer2.audio")getAudioAttributes()

Deprecated.

Returns the attributes for audio playback.

This method must only be called if COMMAND_GET_AUDIO_ATTRIBUTES is available.

- 

setVolume

void setVolume​(@FloatRange(from=0.0,to=1.0)
               float volume)

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_VOLUME is 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_VOLUME is available.

Returns:The linear gain applied to all audio channels.

- 

clearVideoSurface

void clearVideoSurface()

Deprecated.

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

This method must only be called if COMMAND_SET_VIDEO_SURFACE is available.

- 

clearVideoSurface

void clearVideoSurface​(@Nullable[Surface](https://developer.android.com/reference/android/view/Surface.html "class or interface in android.view")surface)

Deprecated.

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

This method must only be called if COMMAND_SET_VIDEO_SURFACE is available.

Parameters:surface - The surface to clear.

- 

setVideoSurface

void setVideoSurface​(@Nullable[Surface](https://developer.android.com/reference/android/view/Surface.html "class or interface in android.view")surface)

Deprecated.

Sets the Surface onto which video will be rendered. The caller is responsible for tracking the lifecycle of the surface, and must clear the surface by calling setVideoSurface(null) if the surface is destroyed.

If the surface is held by a SurfaceView, TextureView or SurfaceHolder then it's recommended to use setVideoSurfaceView(SurfaceView), setVideoTextureView(TextureView) or setVideoSurfaceHolder(SurfaceHolder) rather than this method, since passing the holder allows the player to track the lifecycle of the surface automatically.

This method must only be called if COMMAND_SET_VIDEO_SURFACE is available.

Parameters:surface - The Surface.

- 

setVideoSurfaceHolder

void setVideoSurfaceHolder​(@Nullable[SurfaceHolder](https://developer.android.com/reference/android/view/SurfaceHolder.html "class or interface in android.view")surfaceHolder)

Deprecated.

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

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

This method must only be called if COMMAND_SET_VIDEO_SURFACE is available.

Parameters:surfaceHolder - The surface holder.

- 

clearVideoSurfaceHolder

void clearVideoSurfaceHolder​(@Nullable[SurfaceHolder](https://developer.android.com/reference/android/view/SurfaceHolder.html "class or interface in android.view")surfaceHolder)

Deprecated.

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

This method must only be called if COMMAND_SET_VIDEO_SURFACE is available.

Parameters:surfaceHolder - The surface holder to clear.

- 

setVideoSurfaceView

void setVideoSurfaceView​(@Nullable[SurfaceView](https://developer.android.com/reference/android/view/SurfaceView.html "class or interface in android.view")surfaceView)

Deprecated.

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

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

This method must only be called if COMMAND_SET_VIDEO_SURFACE is available.

Parameters:surfaceView - The surface view.

- 

clearVideoSurfaceView

void clearVideoSurfaceView​(@Nullable[SurfaceView](https://developer.android.com/reference/android/view/SurfaceView.html "class or interface in android.view")surfaceView)

Deprecated.

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

This method must only be called if COMMAND_SET_VIDEO_SURFACE is available.

Parameters:surfaceView - The texture view to clear.

- 

setVideoTextureView

void setVideoTextureView​(@Nullable[TextureView](https://developer.android.com/reference/android/view/TextureView.html "class or interface in android.view")textureView)

Deprecated.

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

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

This method must only be called if COMMAND_SET_VIDEO_SURFACE is available.

Parameters:textureView - The texture view.

- 

clearVideoTextureView

void clearVideoTextureView​(@Nullable[TextureView](https://developer.android.com/reference/android/view/TextureView.html "class or interface in android.view")textureView)

Deprecated.

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

This method must only be called if COMMAND_SET_VIDEO_SURFACE is available.

Parameters:textureView - The texture view to clear.

- 

getVideoSize

[VideoSize](video/VideoSize.html "class in com.google.android.exoplayer2.video")getVideoSize()

Deprecated.

Gets the size of the video.

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

See Also:Player.Listener.onVideoSizeChanged(VideoSize)

- 

getSurfaceSize

[Size](util/Size.html "class in com.google.android.exoplayer2.util")getSurfaceSize()

Deprecated.

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

- 

getCurrentCues

[CueGroup](text/CueGroup.html "class in com.google.android.exoplayer2.text")getCurrentCues()

Deprecated.

Returns the current CueGroup.

This method must only be called if COMMAND_GET_TEXT is available.

- 

getDeviceInfo

[DeviceInfo](DeviceInfo.html "class in com.google.android.exoplayer2")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 current stream type. The stream type is determined by AudioAttributes.usage which can be converted to stream type with Util.getStreamTypeForAudioUsage(int).

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

This method must only be called if COMMAND_GET_DEVICE_VOLUME is available.

- 

isDeviceMuted

boolean isDeviceMuted()

Deprecated.

Gets whether the device is muted or not.

This method must only be called if COMMAND_GET_DEVICE_VOLUME is available.

- 

setDeviceVolume

[@Deprecated](https://developer.android.com/reference/java/lang/Deprecated.html "class or interface in java.lang")void setDeviceVolume​(@IntRange(from=0L)
                     int volume)

Deprecated. Use setDeviceVolume(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_FLAGS is available.

Parameters:volume - The volume to set.flags - Either 0 or a bitwise combination of one or more C.VolumeFlags.

- 

increaseDeviceVolume

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

Deprecated. Use increaseDeviceVolume(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 above DeviceInfo.maxVolume, if defined.

This method must only be called if COMMAND_ADJUST_DEVICE_VOLUME_WITH_FLAGS is available.

Parameters:flags - Either 0 or a bitwise combination of one or more C.VolumeFlags.

- 

decreaseDeviceVolume

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

Deprecated. Use decreaseDeviceVolume(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 below DeviceInfo.minVolume.

This method must only be called if COMMAND_ADJUST_DEVICE_VOLUME_WITH_FLAGS is available.

Parameters:flags - Either 0 or a bitwise combination of one or more C.VolumeFlags.

- 

setDeviceMuted

[@Deprecated](https://developer.android.com/reference/java/lang/Deprecated.html "class or interface in java.lang")void setDeviceMuted​(boolean muted)

Deprecated. Use setDeviceMuted(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_FLAGS is available.

Parameters:muted - Whether to set the device to be muted or notflags - Either 0 or a bitwise combination of one or more C.VolumeFlags.