docs/doc/reference/com/google/android/exoplayer2/ExoPlayer.html
Package com.google.android.exoplayer2
PlayerAll Known Implementing Classes:SimpleExoPlayer, StubExoPlayer[@Deprecated](https://developer.android.com/reference/java/lang/Deprecated.html "class or interface in java.lang")public interfaceExoPlayerextends[Player](Player.html "interface in com.google.android.exoplayer2")
Deprecated. com.google.android.exoplayer2 is deprecated. Please migrate to androidx.media3 (which contains the same ExoPlayer code). See the migration guide for more details, including a script to help with the migration.
An extensible media player that plays MediaSources. Instances can be obtained from ExoPlayer.Builder.
ExoPlayer is designed to make few assumptions about (and hence impose few restrictions on) the type of the media being played, how and where it is stored, and how it is rendered. Rather than implementing the loading and rendering of media directly, ExoPlayer implementations delegate this work to components that are injected when a player is created or when it's prepared for playback. Components common to all ExoPlayer implementations are:
MediaSources that define the media to be played, load the media, and from which the loaded media can be read. MediaSources are created from MediaItems by the MediaSource.Factory injected into the player Builder, or can be added directly by methods like setMediaSource(MediaSource). The library provides a DefaultMediaSourceFactory for progressive media files, DASH, SmoothStreaming and HLS, which also includes functionality for side-loading subtitle files and clipping media.Renderer**s that render individual components of the media. The library provides default implementations for common media types (MediaCodecVideoRenderer, MediaCodecAudioRenderer, TextRenderer and MetadataRenderer). A Renderer consumes media from the MediaSource being played. Renderers are injected when the player is created. The number of renderers and their respective track types can be obtained by calling getRendererCount() and getRendererType(int).TrackSelector that selects tracks provided by the MediaSource to be consumed by each of the available Renderers. The library provides a default implementation (DefaultTrackSelector) suitable for most use cases. A TrackSelector is injected when the player is created.LoadControl that controls when the MediaSource buffers more media, and how much media is buffered. The library provides a default implementation (DefaultLoadControl) suitable for most use cases. A LoadControl is injected when the player is created.An ExoPlayer can be built using the default components provided by the library, but may also be built using custom implementations if non-standard behaviors are required. For example a custom LoadControl could be injected to change the player's buffering strategy, or a custom Renderer could be injected to add support for a video codec not supported natively by Android.
The concept of injecting components that implement pieces of player functionality is present throughout the library. The default component implementations listed above delegate work to further injected components. This allows many sub-components to be individually replaced with custom implementations. For example the default MediaSource implementations require one or more DataSource factories to be injected via their constructors. By providing a custom factory it's possible to load data from a non-standard source, or through a different network stack.
The figure below shows ExoPlayer's threading model.
ExoPlayer instances must be accessed from a single application thread unless indicated otherwise. For the vast majority of cases this should be the application's main thread. Using the application's main thread is also a requirement when using ExoPlayer's UI components or the IMA extension. The thread on which an ExoPlayer instance must be accessed can be explicitly specified by passing a Looper when creating the player. If no Looper is specified, then the Looper of the thread that the player is created on is used, or if that thread does not have a Looper, the Looper of the application's main thread is used. In all cases the Looper of the thread from which the player must be accessed can be queried using Player.getApplicationLooper().
Registered listeners are called on the thread associated with Player.getApplicationLooper(). Note that this means registered listeners are called on the same thread which must be used to access the player.
An internal playback thread is responsible for playback. Injected player components such as Renderers, MediaSources, TrackSelectors and LoadControls are called by the player on this thread.
When the application performs an operation on the player, for example a seek, a message is delivered to the internal playback thread via a message queue. The internal playback thread consumes messages from the queue and performs the corresponding operations. Similarly, when a playback event occurs on the internal playback thread, a message is delivered to the application thread via a second message queue. The application thread consumes messages from the queue, updating the application visible state and calling corresponding listener methods.
Injected player components may use additional background threads. For example a MediaSource may use background threads to load data. These are implementation specific.
Nested Classes | Modifier and Type | Interface | Description |
| --- | --- | --- |
| static interface | ExoPlayer.AudioComponent |
Deprecated.
Use ExoPlayer, as the ExoPlayer.AudioComponent methods are defined by that interface.
|
| static interface | ExoPlayer.AudioOffloadListener |
Deprecated.
A listener for audio offload events.
|
| static class | ExoPlayer.Builder |
Deprecated.
A builder for ExoPlayer instances.
|
| static interface | ExoPlayer.DeviceComponent |
Deprecated.
Use Player, as the ExoPlayer.DeviceComponent methods are defined by that interface.
|
| static interface | ExoPlayer.TextComponent |
Deprecated.
Use Player, as the ExoPlayer.TextComponent methods are defined by that interface.
|
| static interface | ExoPlayer.VideoComponent |
Deprecated.
Use ExoPlayer, as the ExoPlayer.VideoComponent methods are defined by that interface.
|
-
Player.Command, Player.Commands, Player.DiscontinuityReason, Player.Event, Player.Events, Player.Listener, Player.MediaItemTransitionReason, Player.PlaybackSuppressionReason, Player.PlayWhenReadyChangeReason, Player.PositionInfo, Player.RepeatMode, Player.State, Player.TimelineChangeReason
Fields | Modifier and Type | Field | Description |
| --- | --- | --- |
| static long | DEFAULT_DETACH_SURFACE_TIMEOUT_MS |
Deprecated.
The default timeout for detaching a surface from the player, in milliseconds.
|
| static long | DEFAULT_RELEASE_TIMEOUT_MS |
Deprecated.
The default timeout for calls to Player.release() and setForegroundMode(boolean), in milliseconds.
|
-
COMMAND_ADJUST_DEVICE_VOLUME, COMMAND_ADJUST_DEVICE_VOLUME_WITH_FLAGS, COMMAND_CHANGE_MEDIA_ITEMS, COMMAND_GET_AUDIO_ATTRIBUTES, COMMAND_GET_CURRENT_MEDIA_ITEM, COMMAND_GET_DEVICE_VOLUME, COMMAND_GET_MEDIA_ITEMS_METADATA, COMMAND_GET_METADATA, COMMAND_GET_TEXT, COMMAND_GET_TIMELINE, COMMAND_GET_TRACKS, COMMAND_GET_VOLUME, COMMAND_INVALID, COMMAND_PLAY_PAUSE, COMMAND_PREPARE, COMMAND_RELEASE, COMMAND_SEEK_BACK, COMMAND_SEEK_FORWARD, COMMAND_SEEK_IN_CURRENT_MEDIA_ITEM, COMMAND_SEEK_IN_CURRENT_WINDOW, COMMAND_SEEK_TO_DEFAULT_POSITION, COMMAND_SEEK_TO_MEDIA_ITEM, COMMAND_SEEK_TO_NEXT, COMMAND_SEEK_TO_NEXT_MEDIA_ITEM, COMMAND_SEEK_TO_NEXT_WINDOW, COMMAND_SEEK_TO_PREVIOUS, COMMAND_SEEK_TO_PREVIOUS_MEDIA_ITEM, COMMAND_SEEK_TO_PREVIOUS_WINDOW, COMMAND_SEEK_TO_WINDOW, COMMAND_SET_DEVICE_VOLUME, COMMAND_SET_DEVICE_VOLUME_WITH_FLAGS, COMMAND_SET_MEDIA_ITEM, COMMAND_SET_MEDIA_ITEMS_METADATA, COMMAND_SET_PLAYLIST_METADATA, COMMAND_SET_REPEAT_MODE, COMMAND_SET_SHUFFLE_MODE, COMMAND_SET_SPEED_AND_PITCH, COMMAND_SET_TRACK_SELECTION_PARAMETERS, COMMAND_SET_VIDEO_SURFACE, COMMAND_SET_VOLUME, COMMAND_STOP, DISCONTINUITY_REASON_AUTO_TRANSITION, DISCONTINUITY_REASON_INTERNAL, DISCONTINUITY_REASON_REMOVE, DISCONTINUITY_REASON_SEEK, DISCONTINUITY_REASON_SEEK_ADJUSTMENT, DISCONTINUITY_REASON_SKIP, EVENT_AUDIO_ATTRIBUTES_CHANGED, EVENT_AUDIO_SESSION_ID, EVENT_AVAILABLE_COMMANDS_CHANGED, EVENT_CUES, EVENT_DEVICE_INFO_CHANGED, EVENT_DEVICE_VOLUME_CHANGED, EVENT_IS_LOADING_CHANGED, EVENT_IS_PLAYING_CHANGED, EVENT_MAX_SEEK_TO_PREVIOUS_POSITION_CHANGED, EVENT_MEDIA_ITEM_TRANSITION, EVENT_MEDIA_METADATA_CHANGED, EVENT_METADATA, EVENT_PLAY_WHEN_READY_CHANGED, EVENT_PLAYBACK_PARAMETERS_CHANGED, EVENT_PLAYBACK_STATE_CHANGED, EVENT_PLAYBACK_SUPPRESSION_REASON_CHANGED, EVENT_PLAYER_ERROR, EVENT_PLAYLIST_METADATA_CHANGED, EVENT_POSITION_DISCONTINUITY, EVENT_RENDERED_FIRST_FRAME, EVENT_REPEAT_MODE_CHANGED, EVENT_SEEK_BACK_INCREMENT_CHANGED, EVENT_SEEK_FORWARD_INCREMENT_CHANGED, EVENT_SHUFFLE_MODE_ENABLED_CHANGED, EVENT_SKIP_SILENCE_ENABLED_CHANGED, EVENT_SURFACE_SIZE_CHANGED, EVENT_TIMELINE_CHANGED, EVENT_TRACK_SELECTION_PARAMETERS_CHANGED, EVENT_TRACKS_CHANGED, EVENT_VIDEO_SIZE_CHANGED, EVENT_VOLUME_CHANGED, MEDIA_ITEM_TRANSITION_REASON_AUTO, MEDIA_ITEM_TRANSITION_REASON_PLAYLIST_CHANGED, MEDIA_ITEM_TRANSITION_REASON_REPEAT, MEDIA_ITEM_TRANSITION_REASON_SEEK, PLAY_WHEN_READY_CHANGE_REASON_AUDIO_BECOMING_NOISY, PLAY_WHEN_READY_CHANGE_REASON_AUDIO_FOCUS_LOSS, PLAY_WHEN_READY_CHANGE_REASON_END_OF_MEDIA_ITEM, PLAY_WHEN_READY_CHANGE_REASON_REMOTE, PLAY_WHEN_READY_CHANGE_REASON_SUPPRESSED_TOO_LONG, PLAY_WHEN_READY_CHANGE_REASON_USER_REQUEST, PLAYBACK_SUPPRESSION_REASON_NONE, PLAYBACK_SUPPRESSION_REASON_TRANSIENT_AUDIO_FOCUS_LOSS, PLAYBACK_SUPPRESSION_REASON_UNSUITABLE_AUDIO_ROUTE, REPEAT_MODE_ALL, REPEAT_MODE_OFF, REPEAT_MODE_ONE, STATE_BUFFERING, STATE_ENDED, STATE_IDLE, STATE_READY, TIMELINE_CHANGE_REASON_PLAYLIST_CHANGED, TIMELINE_CHANGE_REASON_SOURCE_UPDATE
All Methods Instance Methods Abstract Methods Deprecated Methods | Modifier and Type | Method | Description |
| --- | --- | --- |
| void | addAnalyticsListener(AnalyticsListener listener) |
Deprecated.
Adds an AnalyticsListener to receive analytics events.
|
| void | addAudioOffloadListener(ExoPlayer.AudioOffloadListener listener) |
Deprecated.
Adds a listener to receive audio offload events.
|
| void | addMediaSource(int index, MediaSource mediaSource) |
Deprecated.
Adds a media source at the given index of the playlist.
|
| void | addMediaSource(MediaSource mediaSource) |
Deprecated.
Adds a media source to the end of the playlist.
|
| void | addMediaSources(int index, List<MediaSource> mediaSources) |
Deprecated.
Adds a list of media sources at the given index of the playlist.
|
| void | addMediaSources(List<MediaSource> mediaSources) |
Deprecated.
Adds a list of media sources to the end of the playlist.
|
| void | clearAuxEffectInfo() |
Deprecated.
Detaches any previously attached auxiliary audio effect from the underlying audio track.
|
| void | clearCameraMotionListener(CameraMotionListener listener) |
Deprecated.
Clears the listener which receives camera motion events if it matches the one passed.
|
| void | clearVideoFrameMetadataListener(VideoFrameMetadataListener listener) |
Deprecated.
Clears the listener which receives video frame metadata events if it matches the one passed.
|
| PlayerMessage | createMessage(PlayerMessage.Target target) |
Deprecated.
Creates a message that can be sent to a PlayerMessage.Target.
|
| boolean | experimentalIsSleepingForOffload() |
Deprecated.
Returns whether the player has paused its main loop to save power in offload scheduling mode.
|
| void | experimentalSetOffloadSchedulingEnabled(boolean offloadSchedulingEnabled) |
Deprecated.
Sets whether audio offload scheduling is enabled.
|
| AnalyticsCollector | getAnalyticsCollector() |
Deprecated.
Returns the AnalyticsCollector used for collecting analytics events.
|
| ExoPlayer.AudioComponent | getAudioComponent() |
Deprecated.
Use ExoPlayer, as the ExoPlayer.AudioComponent methods are defined by that interface.
|
| DecoderCounters | getAudioDecoderCounters() |
Deprecated.
Returns DecoderCounters for audio, or null if no audio is being played.
|
| Format | getAudioFormat() |
Deprecated.
Returns the audio format currently being played, or null if no audio is being played.
|
| int | getAudioSessionId() |
Deprecated.
Returns the audio session identifier, or C.AUDIO_SESSION_ID_UNSET if not set.
|
| Clock | getClock() |
Deprecated.
Returns the Clock used for playback.
|
| TrackGroupArray | getCurrentTrackGroups() |
Deprecated.
Use Player.getCurrentTracks().
|
| TrackSelectionArray | getCurrentTrackSelections() |
Deprecated.
Use Player.getCurrentTracks().
|
| ExoPlayer.DeviceComponent | getDeviceComponent() |
Deprecated.
Use Player, as the ExoPlayer.DeviceComponent methods are defined by that interface.
|
| boolean | getPauseAtEndOfMediaItems() |
Deprecated.
Returns whether the player pauses playback at the end of each media item.
|
| Looper | getPlaybackLooper() |
Deprecated.
Returns the Looper associated with the playback thread.
|
| ExoPlaybackException | getPlayerError() |
Deprecated.
Equivalent to Player.getPlayerError(), except the exception is guaranteed to be an ExoPlaybackException.
|
| Renderer | getRenderer(int index) |
Deprecated.
Returns the renderer at the given index.
|
| int | getRendererCount() |
Deprecated.
Returns the number of renderers.
|
| @com.google.android.exoplayer2.C.TrackType int | getRendererType(int index) |
Deprecated.
Returns the track type that the renderer at a given index handles.
|
| SeekParameters | getSeekParameters() |
Deprecated.
Returns the currently active SeekParameters of the player.
|
| boolean | getSkipSilenceEnabled() |
Deprecated.
Returns whether skipping silences in the audio stream is enabled.
|
| ExoPlayer.TextComponent | getTextComponent() |
Deprecated.
Use Player, as the ExoPlayer.TextComponent methods are defined by that interface.
|
| TrackSelector | getTrackSelector() |
Deprecated.
Returns the track selector that this player uses, or null if track selection is not supported.
|
| @com.google.android.exoplayer2.C.VideoChangeFrameRateStrategy int | getVideoChangeFrameRateStrategy() |
Deprecated.
Returns the C.VideoChangeFrameRateStrategy.
|
| ExoPlayer.VideoComponent | getVideoComponent() |
Deprecated.
Use ExoPlayer, as the ExoPlayer.VideoComponent methods are defined by that interface.
|
| DecoderCounters | getVideoDecoderCounters() |
Deprecated.
Returns DecoderCounters for video, or null if no video is being played.
|
| Format | getVideoFormat() |
Deprecated.
Returns the video format currently being played, or null if no video is being played.
|
| @com.google.android.exoplayer2.C.VideoScalingMode int | getVideoScalingMode() |
Deprecated.
Returns the C.VideoScalingMode.
|
| boolean | isTunnelingEnabled() |
Deprecated.
Returns whether tunneling is enabled for the currently selected tracks.
|
| void | prepare(MediaSource mediaSource) |
Deprecated.
Use setMediaSource(MediaSource) and Player.prepare() instead.
|
| void | prepare(MediaSource mediaSource, boolean resetPosition, boolean resetState) |
Deprecated.
Use setMediaSource(MediaSource, boolean) and Player.prepare() instead.
|
| void | removeAnalyticsListener(AnalyticsListener listener) |
Deprecated.
Removes an AnalyticsListener.
|
| void | removeAudioOffloadListener(ExoPlayer.AudioOffloadListener listener) |
Deprecated.
Removes a listener of audio offload events.
|
| void | setAudioAttributes(AudioAttributes audioAttributes, boolean handleAudioFocus) |
Deprecated.
Sets the attributes for audio playback, used by the underlying audio track.
|
| void | setAudioSessionId(int audioSessionId) |
Deprecated.
Sets the ID of the audio session to attach to the underlying AudioTrack.
|
| void | setAuxEffectInfo(AuxEffectInfo auxEffectInfo) |
Deprecated.
Sets information on an auxiliary audio effect to attach to the underlying audio track.
|
| void | setCameraMotionListener(CameraMotionListener listener) |
Deprecated.
Sets a listener of camera motion events.
|
| void | setForegroundMode(boolean foregroundMode) |
Deprecated.
Sets whether the player is allowed to keep holding limited resources such as video decoders, even when in the idle state.
|
| void | setHandleAudioBecomingNoisy(boolean handleAudioBecomingNoisy) |
Deprecated.
Sets whether the player should pause automatically when audio is rerouted from a headset to device speakers.
|
| void | setMediaSource(MediaSource mediaSource) |
Deprecated.
Clears the playlist, adds the specified MediaSource and resets the position to the default position.
|
| void | setMediaSource(MediaSource mediaSource, boolean resetPosition) |
Deprecated.
Clears the playlist and adds the specified MediaSource.
|
| void | setMediaSource(MediaSource mediaSource, long startPositionMs) |
Deprecated.
Clears the playlist and adds the specified MediaSource.
|
| void | setMediaSources(List<MediaSource> mediaSources) |
Deprecated.
Clears the playlist, adds the specified MediaSources and resets the position to the default position.
|
| void | setMediaSources(List<MediaSource> mediaSources, boolean resetPosition) |
Deprecated.
Clears the playlist and adds the specified MediaSources.
|
| void | setMediaSources(List<MediaSource> mediaSources, int startMediaItemIndex, long startPositionMs) |
Deprecated.
Clears the playlist and adds the specified MediaSources.
|
| void | setPauseAtEndOfMediaItems(boolean pauseAtEndOfMediaItems) |
Deprecated.
Sets whether to pause playback at the end of each media item.
|
| void | setPreferredAudioDevice(AudioDeviceInfo audioDeviceInfo) |
Deprecated.
Sets the preferred audio device.
|
| void | setPriorityTaskManager(PriorityTaskManager priorityTaskManager) |
Deprecated.
Sets a PriorityTaskManager, or null to clear a previously set priority task manager.
|
| void | setSeekParameters(SeekParameters seekParameters) |
Deprecated.
Sets the parameters that control how seek operations are performed.
|
| void | setShuffleOrder(ShuffleOrder shuffleOrder) |
Deprecated.
Sets the shuffle order.
|
| void | setSkipSilenceEnabled(boolean skipSilenceEnabled) |
Deprecated.
Sets whether skipping silences in the audio stream is enabled.
|
| void | setVideoChangeFrameRateStrategy(@com.google.android.exoplayer2.C.VideoChangeFrameRateStrategy int videoChangeFrameRateStrategy) |
Deprecated.
Sets a C.VideoChangeFrameRateStrategy that will be used by the player when provided with a video output Surface.
|
| void | setVideoEffects(List<Effect> videoEffects) |
Deprecated.
Sets a List of video effects that will be applied to each video frame.
|
| void | setVideoFrameMetadataListener(VideoFrameMetadataListener listener) |
Deprecated.
Sets a listener to receive video frame metadata events.
|
| void | setVideoScalingMode(@com.google.android.exoplayer2.C.VideoScalingMode int videoScalingMode) |
Deprecated.
Sets the C.VideoScalingMode.
|
| void | setWakeMode(@com.google.android.exoplayer2.C.WakeMode int wakeMode) |
Deprecated.
Sets how the player should keep the device awake for playback when the screen is off. |
-
addListener, addMediaItem, addMediaItem, addMediaItems, addMediaItems, canAdvertiseSession, clearMediaItems, clearVideoSurface, clearVideoSurface, clearVideoSurfaceHolder, clearVideoSurfaceView, clearVideoTextureView, decreaseDeviceVolume, decreaseDeviceVolume, getApplicationLooper, getAudioAttributes, getAvailableCommands, getBufferedPercentage, getBufferedPosition, getContentBufferedPosition, getContentDuration, getContentPosition, getCurrentAdGroupIndex, getCurrentAdIndexInAdGroup, getCurrentCues, getCurrentLiveOffset, getCurrentManifest, getCurrentMediaItem, getCurrentMediaItemIndex, getCurrentPeriodIndex, getCurrentPosition, getCurrentTimeline, getCurrentTracks, getCurrentWindowIndex, getDeviceInfo, getDeviceVolume, getDuration, getMaxSeekToPreviousPosition, getMediaItemAt, getMediaItemCount, getMediaMetadata, getNextMediaItemIndex, getNextWindowIndex, getPlaybackParameters, getPlaybackState, getPlaybackSuppressionReason, getPlaylistMetadata, getPlayWhenReady, getPreviousMediaItemIndex, getPreviousWindowIndex, getRepeatMode, getSeekBackIncrement, getSeekForwardIncrement, getShuffleModeEnabled, getSurfaceSize, getTotalBufferedDuration, getTrackSelectionParameters, getVideoSize, getVolume, hasNext, hasNextMediaItem, hasNextWindow, hasPrevious, hasPreviousMediaItem, hasPreviousWindow, increaseDeviceVolume, increaseDeviceVolume, isCommandAvailable, isCurrentMediaItemDynamic, isCurrentMediaItemLive, isCurrentMediaItemSeekable, isCurrentWindowDynamic, isCurrentWindowLive, isCurrentWindowSeekable, isDeviceMuted, isLoading, isPlaying, isPlayingAd, moveMediaItem, moveMediaItems, next, pause, play, prepare, previous, release, removeListener, removeMediaItem, removeMediaItems, replaceMediaItem, replaceMediaItems, seekBack, seekForward, seekTo, seekTo, seekToDefaultPosition, seekToDefaultPosition, seekToNext, seekToNextMediaItem, seekToNextWindow, seekToPrevious, seekToPreviousMediaItem, seekToPreviousWindow, setDeviceMuted, setDeviceMuted, setDeviceVolume, setDeviceVolume, setMediaItem, setMediaItem, setMediaItem, setMediaItems, setMediaItems, setMediaItems, setPlaybackParameters, setPlaybackSpeed, setPlaylistMetadata, setPlayWhenReady, setRepeatMode, setShuffleModeEnabled, setTrackSelectionParameters, setVideoSurface, setVideoSurfaceHolder, setVideoSurfaceView, setVideoTextureView, setVolume, stop
-
static final long DEFAULT_RELEASE_TIMEOUT_MS
Deprecated.
The default timeout for calls to Player.release() and setForegroundMode(boolean), in milliseconds.
See Also:Constant Field Values
-
static final long DEFAULT_DETACH_SURFACE_TIMEOUT_MS
Deprecated.
The default timeout for detaching a surface from the player, in milliseconds. See Also:Constant Field Values
-
@Nullable[ExoPlaybackException](ExoPlaybackException.html "class in com.google.android.exoplayer2")getPlayerError()
Deprecated.
Equivalent to Player.getPlayerError(), except the exception is guaranteed to be an ExoPlaybackException.
Specified by:getPlayerError in interface PlayerReturns:The error, or null.See Also:Player.Listener.onPlayerError(PlaybackException)
-
@Nullable[@Deprecated](https://developer.android.com/reference/java/lang/Deprecated.html "class or interface in java.lang")[ExoPlayer.AudioComponent](ExoPlayer.AudioComponent.html "interface in com.google.android.exoplayer2")getAudioComponent()
Deprecated.
Use ExoPlayer, as the ExoPlayer.AudioComponent methods are defined by that interface.
-
@Nullable[@Deprecated](https://developer.android.com/reference/java/lang/Deprecated.html "class or interface in java.lang")[ExoPlayer.VideoComponent](ExoPlayer.VideoComponent.html "interface in com.google.android.exoplayer2")getVideoComponent()
Deprecated.
Use ExoPlayer, as the ExoPlayer.VideoComponent methods are defined by that interface.
-
@Nullable[@Deprecated](https://developer.android.com/reference/java/lang/Deprecated.html "class or interface in java.lang")[ExoPlayer.TextComponent](ExoPlayer.TextComponent.html "interface in com.google.android.exoplayer2")getTextComponent()
Deprecated.
Use Player, as the ExoPlayer.TextComponent methods are defined by that interface.
-
@Nullable[@Deprecated](https://developer.android.com/reference/java/lang/Deprecated.html "class or interface in java.lang")[ExoPlayer.DeviceComponent](ExoPlayer.DeviceComponent.html "interface in com.google.android.exoplayer2")getDeviceComponent()
Deprecated.
Use Player, as the ExoPlayer.DeviceComponent methods are defined by that interface.
-
void addAudioOffloadListener([ExoPlayer.AudioOffloadListener](ExoPlayer.AudioOffloadListener.html "interface in com.google.android.exoplayer2")listener)
Deprecated.
Adds a listener to receive audio offload events.
This method can be called from any thread.
Parameters:listener - The listener to register.
-
void removeAudioOffloadListener([ExoPlayer.AudioOffloadListener](ExoPlayer.AudioOffloadListener.html "interface in com.google.android.exoplayer2")listener)
Deprecated.
Removes a listener of audio offload events.
Parameters:listener - The listener to unregister.
-
[AnalyticsCollector](analytics/AnalyticsCollector.html "interface in com.google.android.exoplayer2.analytics")getAnalyticsCollector()
Deprecated.
Returns the AnalyticsCollector used for collecting analytics events.
-
void addAnalyticsListener([AnalyticsListener](analytics/AnalyticsListener.html "interface in com.google.android.exoplayer2.analytics")listener)
Deprecated.
Adds an AnalyticsListener to receive analytics events.
This method can be called from any thread.
Parameters:listener - The listener to be added.
-
void removeAnalyticsListener([AnalyticsListener](analytics/AnalyticsListener.html "interface in com.google.android.exoplayer2.analytics")listener)
Deprecated.
Removes an AnalyticsListener.
Parameters:listener - The listener to be removed.
-
int getRendererCount()
Deprecated.
Returns the number of renderers.
-
@com.google.android.exoplayer2.C.TrackType int getRendererType(int index)
Deprecated.
Returns the track type that the renderer at a given index handles.
For example, a video renderer will return C.TRACK_TYPE_VIDEO, an audio renderer will return C.TRACK_TYPE_AUDIO and a text renderer will return C.TRACK_TYPE_TEXT.
Parameters:index - The index of the renderer.Returns:The track type that the renderer handles.
-
[Renderer](Renderer.html "interface in com.google.android.exoplayer2")getRenderer(int index)
Deprecated.
Returns the renderer at the given index.
Parameters:index - The index of the renderer.Returns:The renderer at this index.
-
@Nullable[TrackSelector](trackselection/TrackSelector.html "class in com.google.android.exoplayer2.trackselection")getTrackSelector()
Deprecated.
Returns the track selector that this player uses, or null if track selection is not supported.
-
[@Deprecated](https://developer.android.com/reference/java/lang/Deprecated.html "class or interface in java.lang")[TrackGroupArray](source/TrackGroupArray.html "class in com.google.android.exoplayer2.source")getCurrentTrackGroups()
Deprecated.
Use Player.getCurrentTracks().
Returns the available track groups.
See Also:Player.Listener.onTracksChanged(Tracks)
-
[@Deprecated](https://developer.android.com/reference/java/lang/Deprecated.html "class or interface in java.lang")[TrackSelectionArray](trackselection/TrackSelectionArray.html "class in com.google.android.exoplayer2.trackselection")getCurrentTrackSelections()
Deprecated.
Use Player.getCurrentTracks().
Returns the current track selections for each renderer, which may include null elements if some renderers do not have any selected tracks.
See Also:Player.Listener.onTracksChanged(Tracks)
-
[Looper](https://developer.android.com/reference/android/os/Looper.html "class or interface in android.os")getPlaybackLooper()
Deprecated.
Returns the Looper associated with the playback thread.
This method may be called from any thread.
-
[Clock](util/Clock.html "interface in com.google.android.exoplayer2.util")getClock()
Deprecated.
Returns the Clock used for playback.
This method can be called from any thread.
-
[@Deprecated](https://developer.android.com/reference/java/lang/Deprecated.html "class or interface in java.lang")void prepare([MediaSource](source/MediaSource.html "interface in com.google.android.exoplayer2.source")mediaSource)
Deprecated.
Use setMediaSource(MediaSource) and Player.prepare() instead.
-
[@Deprecated](https://developer.android.com/reference/java/lang/Deprecated.html "class or interface in java.lang")void prepare([MediaSource](source/MediaSource.html "interface in com.google.android.exoplayer2.source")mediaSource,
boolean resetPosition,
boolean resetState)
Deprecated.
Use setMediaSource(MediaSource, boolean) and Player.prepare() instead.
-
void setMediaSources([List](https://developer.android.com/reference/java/util/List.html "class or interface in java.util")<[MediaSource](source/MediaSource.html "interface in com.google.android.exoplayer2.source")> mediaSources)
Deprecated.
Clears the playlist, adds the specified MediaSources and resets the position to the default position.
Parameters:mediaSources - The new MediaSources.
-
void setMediaSources([List](https://developer.android.com/reference/java/util/List.html "class or interface in java.util")<[MediaSource](source/MediaSource.html "interface in com.google.android.exoplayer2.source")> mediaSources,
boolean resetPosition)
Deprecated.
Clears the playlist and adds the specified MediaSources.
Parameters:mediaSources - The new MediaSources.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 Player.getCurrentMediaItemIndex() and Player.getCurrentPosition().
-
void setMediaSources([List](https://developer.android.com/reference/java/util/List.html "class or interface in java.util")<[MediaSource](source/MediaSource.html "interface in com.google.android.exoplayer2.source")> mediaSources,
int startMediaItemIndex,
long startPositionMs)
Deprecated.
Clears the playlist and adds the specified MediaSources.
Parameters:mediaSources - The new MediaSources.startMediaItemIndex - The media item 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 media item is used. In any case, if startMediaItemIndex is set to C.INDEX_UNSET, this parameter is ignored and the position is not reset at all.
-
void setMediaSource([MediaSource](source/MediaSource.html "interface in com.google.android.exoplayer2.source")mediaSource)
Deprecated.
Clears the playlist, adds the specified MediaSource and resets the position to the default position.
Parameters:mediaSource - The new MediaSource.
-
void setMediaSource([MediaSource](source/MediaSource.html "interface in com.google.android.exoplayer2.source")mediaSource,
long startPositionMs)
Deprecated.
Clears the playlist and adds the specified MediaSource.
Parameters:mediaSource - The new MediaSource.startPositionMs - The position in milliseconds to start playback from.
-
void setMediaSource([MediaSource](source/MediaSource.html "interface in com.google.android.exoplayer2.source")mediaSource,
boolean resetPosition)
Deprecated.
Clears the playlist and adds the specified MediaSource.
Parameters:mediaSource - The new MediaSource.resetPosition - Whether the playback position should be reset to the default position. If false, playback will start from the position defined by Player.getCurrentMediaItemIndex() and Player.getCurrentPosition().
-
void addMediaSource([MediaSource](source/MediaSource.html "interface in com.google.android.exoplayer2.source")mediaSource)
Deprecated.
Adds a media source to the end of the playlist.
Parameters:mediaSource - The MediaSource to add.
-
void addMediaSource(int index,[MediaSource](source/MediaSource.html "interface in com.google.android.exoplayer2.source")mediaSource)
Deprecated.
Adds a media source at the given index of the playlist.
Parameters:index - The index at which to add the source.mediaSource - The MediaSource to add.
-
void addMediaSources([List](https://developer.android.com/reference/java/util/List.html "class or interface in java.util")<[MediaSource](source/MediaSource.html "interface in com.google.android.exoplayer2.source")> mediaSources)
Deprecated.
Adds a list of media sources to the end of the playlist.
Parameters:mediaSources - The MediaSources to add.
-
void addMediaSources(int index,[List](https://developer.android.com/reference/java/util/List.html "class or interface in java.util")<[MediaSource](source/MediaSource.html "interface in com.google.android.exoplayer2.source")> mediaSources)
Deprecated.
Adds a list of media sources at the given index of the playlist.
Parameters:index - The index at which to add the media sources.mediaSources - The MediaSources to add.
-
void setShuffleOrder([ShuffleOrder](source/ShuffleOrder.html "interface in com.google.android.exoplayer2.source")shuffleOrder)
Deprecated.
Sets the shuffle order.
The ShuffleOrder passed must have the same length as the current playlist (Player.getMediaItemCount()).
Parameters:shuffleOrder - The shuffle order.
-
void setAudioAttributes([AudioAttributes](audio/AudioAttributes.html "class in com.google.android.exoplayer2.audio")audioAttributes,
boolean handleAudioFocus)
Deprecated.
Sets the attributes for audio playback, used by the underlying audio track. If not set, the default audio attributes will be used. They are suitable for general media playback.
Setting the audio attributes during playback may introduce a short gap in audio output as the audio track is recreated. A new audio session id will also be generated.
If tunneling is enabled by the track selector, the specified audio attributes will be ignored, but they will take effect if audio is later played without tunneling.
If the device is running a build before platform API version 21, audio attributes cannot be set directly on the underlying audio track. In this case, the usage will be mapped onto an equivalent stream type using Util.getStreamTypeForAudioUsage(int).
If audio focus should be handled, the AudioAttributes.usage must be C.USAGE_MEDIA or C.USAGE_GAME. Other usages will throw an IllegalArgumentException.
Parameters:audioAttributes - The attributes to use for audio playback.handleAudioFocus - True if the player should handle audio focus, false otherwise.
-
void setAudioSessionId(int audioSessionId)
Deprecated.
Sets the ID of the audio session to attach to the underlying AudioTrack.
The audio session ID can be generated using Util.generateAudioSessionIdV21(Context) for API 21+.
Parameters:audioSessionId - The audio session ID, or C.AUDIO_SESSION_ID_UNSET if it should be generated by the framework.
-
int getAudioSessionId()
Deprecated.
Returns the audio session identifier, or C.AUDIO_SESSION_ID_UNSET if not set.
-
void setAuxEffectInfo([AuxEffectInfo](audio/AuxEffectInfo.html "class in com.google.android.exoplayer2.audio")auxEffectInfo)
Deprecated.
Sets information on an auxiliary audio effect to attach to the underlying audio track.
-
void clearAuxEffectInfo()
Deprecated.
Detaches any previously attached auxiliary audio effect from the underlying audio track.
-
@RequiresApi(23)
void setPreferredAudioDevice(@Nullable[AudioDeviceInfo](https://developer.android.com/reference/android/media/AudioDeviceInfo.html "class or interface in android.media")audioDeviceInfo)
Deprecated.
Sets the preferred audio device.
Parameters:audioDeviceInfo - The preferred audio device, or null to restore the default.
-
void setSkipSilenceEnabled(boolean skipSilenceEnabled)
Deprecated.
Sets whether skipping silences in the audio stream is enabled.
Parameters:skipSilenceEnabled - Whether skipping silences in the audio stream is enabled.
-
boolean getSkipSilenceEnabled()
Deprecated.
Returns whether skipping silences in the audio stream is enabled.
-
@RequiresApi(18)
void setVideoEffects([List](https://developer.android.com/reference/java/util/List.html "class or interface in java.util")<[Effect](util/Effect.html "interface in com.google.android.exoplayer2.util")> videoEffects)
Deprecated.
Sets a List of video effects that will be applied to each video frame.
The following limitations exist for using video effects:
- This feature works only with the default [`MediaCodecVideoRenderer`](video/MediaCodecVideoRenderer.html "class in com.google.android.exoplayer2.video") and not custom or extension [video renderers](Renderer.html "interface in com.google.android.exoplayer2").
- This feature does not work with DRM-protected contents.
- This method should be called before calling [`prepare(com.google.android.exoplayer2.source.MediaSource)`](#prepare(com.google.android.exoplayer2.source.MediaSource)).
Parameters:videoEffects - The List of video effects to apply.
-
void setVideoScalingMode([@VideoScalingMode](C.VideoScalingMode.html "annotation in com.google.android.exoplayer2")@com.google.android.exoplayer2.C.VideoScalingMode int videoScalingMode)
Deprecated.
Sets the C.VideoScalingMode.
The scaling mode only applies if a MediaCodec-based video Renderer is enabled and if the output surface is owned by a SurfaceView.
Parameters:videoScalingMode - The C.VideoScalingMode.
-
[@VideoScalingMode](C.VideoScalingMode.html "annotation in com.google.android.exoplayer2")@com.google.android.exoplayer2.C.VideoScalingMode int getVideoScalingMode()
Deprecated.
Returns the C.VideoScalingMode.
-
void setVideoChangeFrameRateStrategy([@VideoChangeFrameRateStrategy](C.VideoChangeFrameRateStrategy.html "annotation in com.google.android.exoplayer2")@com.google.android.exoplayer2.C.VideoChangeFrameRateStrategy int videoChangeFrameRateStrategy)
Deprecated.
Sets a C.VideoChangeFrameRateStrategy that will be used by the player when provided with a video output Surface.
The strategy only applies if a MediaCodec-based video Renderer is enabled. Applications wishing to use Surface.CHANGE_FRAME_RATE_ALWAYS should set the mode to C.VIDEO_CHANGE_FRAME_RATE_STRATEGY_OFF to disable calls to Surface.setFrameRate(float, int, int) from ExoPlayer, and should then call Surface.setFrameRate(float, int, int) directly from application code.
Parameters:videoChangeFrameRateStrategy - A C.VideoChangeFrameRateStrategy.
-
[@VideoChangeFrameRateStrategy](C.VideoChangeFrameRateStrategy.html "annotation in com.google.android.exoplayer2")@com.google.android.exoplayer2.C.VideoChangeFrameRateStrategy int getVideoChangeFrameRateStrategy()
Deprecated.
Returns the C.VideoChangeFrameRateStrategy.
-
void setVideoFrameMetadataListener([VideoFrameMetadataListener](video/VideoFrameMetadataListener.html "interface in com.google.android.exoplayer2.video")listener)
Deprecated.
Sets a listener to receive video frame metadata events.
This method is intended to be called by the same component that sets the Surface onto which video will be rendered. If using ExoPlayer's standard UI components, this method should not be called directly from application code.
Parameters:listener - The listener.
-
void clearVideoFrameMetadataListener([VideoFrameMetadataListener](video/VideoFrameMetadataListener.html "interface in com.google.android.exoplayer2.video")listener)
Deprecated.
Clears the listener which receives video frame metadata events if it matches the one passed. Else does nothing.
Parameters:listener - The listener to clear.
-
void setCameraMotionListener([CameraMotionListener](video/spherical/CameraMotionListener.html "interface in com.google.android.exoplayer2.video.spherical")listener)
Deprecated.
Sets a listener of camera motion events.
Parameters:listener - The listener.
-
void clearCameraMotionListener([CameraMotionListener](video/spherical/CameraMotionListener.html "interface in com.google.android.exoplayer2.video.spherical")listener)
Deprecated.
Clears the listener which receives camera motion events if it matches the one passed. Else does nothing.
Parameters:listener - The listener to clear.
-
[PlayerMessage](PlayerMessage.html "class in com.google.android.exoplayer2")createMessage([PlayerMessage.Target](PlayerMessage.Target.html "interface in com.google.android.exoplayer2")target)
Deprecated.
Creates a message that can be sent to a PlayerMessage.Target. By default, the message will be delivered immediately without blocking on the playback thread. The default PlayerMessage.getType() is 0 and the default PlayerMessage.getPayload() is null. If a position is specified with PlayerMessage.setPosition(long), the message will be delivered at this position in the current media item defined by Player.getCurrentMediaItemIndex(). Alternatively, the message can be sent at a specific mediaItem using PlayerMessage.setPosition(int, long).
-
void setSeekParameters(@Nullable[SeekParameters](SeekParameters.html "class in com.google.android.exoplayer2")seekParameters)
Deprecated.
Sets the parameters that control how seek operations are performed.
Parameters:seekParameters - The seek parameters, or null to use the defaults.
-
[SeekParameters](SeekParameters.html "class in com.google.android.exoplayer2")getSeekParameters()
Deprecated.
Returns the currently active SeekParameters of the player.
-
void setForegroundMode(boolean foregroundMode)
Deprecated.
Sets whether the player is allowed to keep holding limited resources such as video decoders, even when in the idle state. By doing so, the player may be able to reduce latency when starting to play another piece of content for which the same resources are required.
This mode should be used with caution, since holding limited resources may prevent other players of media components from acquiring them. It should only be enabled when both of the following conditions are true:
- The application that owns the player is in the foreground.
- The player is used in a way that may benefit from foreground mode. For this to be true, the same player instance must be used to play multiple pieces of content, and there must be gaps between the playbacks (i.e. [`Player.stop()`](Player.html#stop()) is called to halt one playback, and [`prepare(com.google.android.exoplayer2.source.MediaSource)`](#prepare(com.google.android.exoplayer2.source.MediaSource)) is called some time later to start a new one).
Note that foreground mode is not useful for switching between content without gaps between the playbacks. For this use case Player.stop() does not need to be called, and simply calling prepare(com.google.android.exoplayer2.source.MediaSource) for the new media will cause limited resources to be retained even if foreground mode is not enabled.
If foreground mode is enabled, it's the application's responsibility to disable it when the conditions described above no longer hold.
Parameters:foregroundMode - Whether the player is allowed to keep limited resources even when in the idle state.
-
void setPauseAtEndOfMediaItems(boolean pauseAtEndOfMediaItems)
Deprecated.
Sets whether to pause playback at the end of each media item.
This means the player will pause at the end of each window in the current timeline. Listeners will be informed by a call to Player.Listener.onPlayWhenReadyChanged(boolean, int) with the reason Player.PLAY_WHEN_READY_CHANGE_REASON_END_OF_MEDIA_ITEM when this happens.
Parameters:pauseAtEndOfMediaItems - Whether to pause playback at the end of each media item.
-
boolean getPauseAtEndOfMediaItems()
Deprecated.
Returns whether the player pauses playback at the end of each media item.
See Also:setPauseAtEndOfMediaItems(boolean)
-
@Nullable[Format](Format.html "class in com.google.android.exoplayer2")getAudioFormat()
Deprecated.
Returns the audio format currently being played, or null if no audio is being played.
-
@Nullable[Format](Format.html "class in com.google.android.exoplayer2")getVideoFormat()
Deprecated.
Returns the video format currently being played, or null if no video is being played.
-
@Nullable[DecoderCounters](decoder/DecoderCounters.html "class in com.google.android.exoplayer2.decoder")getAudioDecoderCounters()
Deprecated.
Returns DecoderCounters for audio, or null if no audio is being played.
-
@Nullable[DecoderCounters](decoder/DecoderCounters.html "class in com.google.android.exoplayer2.decoder")getVideoDecoderCounters()
Deprecated.
Returns DecoderCounters for video, or null if no video is being played.
-
void setHandleAudioBecomingNoisy(boolean handleAudioBecomingNoisy)
Deprecated.
Sets whether the player should pause automatically when audio is rerouted from a headset to device speakers. See the audio becoming noisy documentation for more information.
Parameters:handleAudioBecomingNoisy - Whether the player should pause automatically when audio is rerouted from a headset to device speakers.
-
void setWakeMode([@WakeMode](C.WakeMode.html "annotation in com.google.android.exoplayer2")@com.google.android.exoplayer2.C.WakeMode int wakeMode)
Deprecated.
Sets how the player should keep the device awake for playback when the screen is off.
Enabling this feature requires the Manifest.permission.WAKE_LOCK permission. It should be used together with a foreground Service for use cases where playback occurs and the screen is off (e.g. background audio playback). It is not useful when the screen will be kept on during playback (e.g. foreground video playback).
When enabled, the locks (PowerManager.WakeLock / WifiManager.WifiLock) will be held whenever the player is in the Player.STATE_READY or Player.STATE_BUFFERING states with playWhenReady = true. The locks held depends on the specified C.WakeMode.
Parameters:wakeMode - The C.WakeMode option to keep the device awake during playback.
-
void setPriorityTaskManager(@Nullable[PriorityTaskManager](util/PriorityTaskManager.html "class in com.google.android.exoplayer2.util")priorityTaskManager)
Deprecated.
Sets a PriorityTaskManager, or null to clear a previously set priority task manager.
The priority C.PRIORITY_PLAYBACK will be set while the player is loading.
Parameters:priorityTaskManager - The PriorityTaskManager, or null to clear a previously set priority task manager.
-
void experimentalSetOffloadSchedulingEnabled(boolean offloadSchedulingEnabled)
Deprecated.
Sets whether audio offload scheduling is enabled. If enabled, ExoPlayer's main loop will run as rarely as possible when playing an audio stream using audio offload.
Only use this scheduling mode if the player is not displaying anything to the user. For example when the application is in the background, or the screen is off. The player state (including position) is rarely updated (roughly between every 10 seconds and 1 minute).
While offload scheduling is enabled, player events may be delivered severely delayed and apps should not interact with the player. When returning to the foreground, disable offload scheduling and wait for ExoPlayer.AudioOffloadListener.onExperimentalOffloadSchedulingEnabledChanged(boolean) to be called with offloadSchedulingEnabled = false before interacting with the player.
This mode should save significant power when the phone is playing offload audio with the screen off.
This mode only has an effect when playing an audio track in offload mode, which requires all the following:
- Audio offload rendering is enabled in [`DefaultRenderersFactory.setEnableAudioOffload(boolean)`](DefaultRenderersFactory.html#setEnableAudioOffload(boolean)) or the equivalent option passed to [`DefaultAudioSink.Builder.setOffloadMode(@com.google.android.exoplayer2.audio.DefaultAudioSink.OffloadMode int)`](audio/DefaultAudioSink.Builder.html#setOffloadMode(@com.google.android.exoplayer2.audio.DefaultAudioSink.OffloadModeint)).
- An audio track is playing in a format that the device supports offloading (for example, MP3 or AAC).
- The [`AudioSink`](audio/AudioSink.html "interface in com.google.android.exoplayer2.audio") is playing with an offload [`AudioTrack`](https://developer.android.com/reference/android/media/AudioTrack.html "class or interface in android.media").
The state where ExoPlayer main loop has been paused to save power during offload playback can be queried with experimentalIsSleepingForOffload().
This method is experimental, and will be renamed or removed in a future release.
Parameters:offloadSchedulingEnabled - Whether to enable offload scheduling.
-
boolean experimentalIsSleepingForOffload()
Deprecated.
Returns whether the player has paused its main loop to save power in offload scheduling mode.
See Also:experimentalSetOffloadSchedulingEnabled(boolean), ExoPlayer.AudioOffloadListener.onExperimentalSleepingForOffloadChanged(boolean)
-
boolean isTunnelingEnabled()
Deprecated.
Returns whether tunneling is enabled for the currently selected tracks.
See Also:Player.Listener.onTracksChanged(Tracks)