public class SimpleExoPlayer extends java.lang.Object implements ExoPlayer, Player.VideoComponent, Player.TextComponent
ExoPlayer implementation that uses default Renderer components. Instances can
be obtained from ExoPlayerFactory.| Modifier and Type | Class and Description |
|---|---|
static interface |
SimpleExoPlayer.VideoListener
Deprecated.
Use
VideoListener. |
ExoPlayer.EventListener, ExoPlayer.ExoPlayerComponent, ExoPlayer.ExoPlayerMessagePlayer.DefaultEventListener, Player.DiscontinuityReason, Player.RepeatMode, Player.TextComponent, Player.TimelineChangeReason, Player.VideoComponent| Modifier and Type | Field and Description |
|---|---|
protected Renderer[] |
renderers |
REPEAT_MODE_ALL, REPEAT_MODE_OFF, REPEAT_MODE_ONE, STATE_BUFFERING, STATE_ENDED, STATE_IDLE, STATE_READYDISCONTINUITY_REASON_AD_INSERTION, DISCONTINUITY_REASON_INTERNAL, DISCONTINUITY_REASON_PERIOD_TRANSITION, DISCONTINUITY_REASON_SEEK, DISCONTINUITY_REASON_SEEK_ADJUSTMENT, TIMELINE_CHANGE_REASON_DYNAMIC, TIMELINE_CHANGE_REASON_PREPARED, TIMELINE_CHANGE_REASON_RESET| Modifier | Constructor and Description |
|---|---|
protected |
SimpleExoPlayer(RenderersFactory renderersFactory,
TrackSelector trackSelector,
LoadControl loadControl) |
protected |
SimpleExoPlayer(RenderersFactory renderersFactory,
TrackSelector trackSelector,
LoadControl loadControl,
Clock clock) |
| Modifier and Type | Method and Description |
|---|---|
void |
addAudioDebugListener(AudioRendererEventListener listener)
Adds a listener to receive debug events from the audio renderer.
|
void |
addListener(Player.EventListener listener)
Register a listener to receive events from the player.
|
void |
addMetadataOutput(MetadataOutput listener) |
void |
addTextOutput(TextOutput listener)
Registers an output to receive text events.
|
void |
addVideoDebugListener(VideoRendererEventListener listener)
Adds a listener to receive debug events from the video renderer.
|
void |
addVideoListener(VideoListener listener)
Adds a listener to receive video events.
|
void |
blockingSendMessages(ExoPlayer.ExoPlayerMessage... messages) |
void |
clearMetadataOutput(MetadataOutput output)
Deprecated.
|
void |
clearTextOutput(TextOutput output)
Deprecated.
|
void |
clearVideoListener(SimpleExoPlayer.VideoListener listener)
|
void |
clearVideoSurface()
Clears any
Surface, SurfaceHolder, SurfaceView or TextureView
currently set on the player. |
void |
clearVideoSurface(android.view.Surface surface)
Clears the
Surface onto which video is being rendered if it matches the one passed. |
void |
clearVideoSurfaceHolder(android.view.SurfaceHolder surfaceHolder)
Clears the
SurfaceHolder that holds the Surface onto which video is being
rendered if it matches the one passed. |
void |
clearVideoSurfaceView(android.view.SurfaceView surfaceView)
Clears the
SurfaceView onto which video is being rendered if it matches the one
passed. |
void |
clearVideoTextureView(android.view.TextureView textureView)
Clears the
TextureView onto which video is being rendered if it matches the one
passed. |
protected ExoPlayer |
createExoPlayerImpl(Renderer[] renderers,
TrackSelector trackSelector,
LoadControl loadControl,
Clock clock)
Creates the
ExoPlayer implementation used by this instance. |
PlayerMessage |
createMessage(PlayerMessage.Target target)
Creates a message that can be sent to a
PlayerMessage.Target. |
AudioAttributes |
getAudioAttributes()
Returns the attributes for audio playback.
|
DecoderCounters |
getAudioDecoderCounters()
Returns
DecoderCounters for audio, or null if no audio is being played. |
Format |
getAudioFormat()
Returns the audio format currently being played, or null if no audio is being played.
|
int |
getAudioSessionId()
Returns the audio session identifier, or
C.AUDIO_SESSION_ID_UNSET if not set. |
int |
getAudioStreamType()
Deprecated.
Use
getAudioAttributes(). |
int |
getBufferedPercentage()
Returns an estimate of the percentage in the current window up to which data is buffered, or 0
if no estimate is available.
|
long |
getBufferedPosition()
Returns an estimate of the position in the current window up to which data is buffered, in
milliseconds.
|
long |
getContentPosition()
If
Player.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()
If
Player.isPlayingAd() returns true, returns the index of the ad group in the period
currently being played. |
int |
getCurrentAdIndexInAdGroup()
If
Player.isPlayingAd() returns true, returns the index of the ad in its ad group. |
java.lang.Object |
getCurrentManifest()
Returns the current manifest.
|
int |
getCurrentPeriodIndex()
Returns the index of the period currently being played.
|
long |
getCurrentPosition()
Returns the playback position in the current window, in milliseconds.
|
Timeline |
getCurrentTimeline()
Returns the current
Timeline. |
TrackGroupArray |
getCurrentTrackGroups()
Returns the available track groups.
|
TrackSelectionArray |
getCurrentTrackSelections()
Returns the current track selections for each renderer.
|
int |
getCurrentWindowIndex()
Returns the index of the window currently being played.
|
long |
getDuration()
Returns the duration of the current window in milliseconds, or
C.TIME_UNSET if the
duration is not known. |
int |
getNextWindowIndex()
Returns the index of the next timeline window to be played, which may depend on the current
repeat mode and whether shuffle mode is enabled.
|
android.os.Looper |
getPlaybackLooper()
Gets the
Looper associated with the playback thread. |
PlaybackParameters |
getPlaybackParameters()
Returns the currently active playback parameters.
|
int |
getPlaybackState()
Returns the current state of the player.
|
boolean |
getPlayWhenReady()
Whether playback will proceed when
Player.getPlaybackState() == Player.STATE_READY. |
int |
getPreviousWindowIndex()
Returns the index of the previous timeline window to be played, which may depend on the current
repeat mode and whether shuffle mode is enabled.
|
int |
getRendererCount()
Returns the number of renderers.
|
int |
getRendererType(int index)
Returns the track type that the renderer at a given index handles.
|
int |
getRepeatMode()
Returns the current
Player.RepeatMode used for playback. |
boolean |
getShuffleModeEnabled()
Returns whether shuffling of windows is enabled.
|
Player.TextComponent |
getTextComponent()
Returns the component of this player for text output, or null if text is not supported.
|
Player.VideoComponent |
getVideoComponent()
Returns the component of this player for video output, or null if video is not supported.
|
DecoderCounters |
getVideoDecoderCounters()
Returns
DecoderCounters for video, or null if no video is being played. |
Format |
getVideoFormat()
Returns the video format currently being played, or null if no video is being played.
|
int |
getVideoScalingMode()
Returns the video scaling mode.
|
float |
getVolume()
Returns the audio volume, with 0 being silence and 1 being unity gain.
|
boolean |
isCurrentWindowDynamic()
Returns whether the current window is dynamic, or
false if the Timeline is
empty. |
boolean |
isCurrentWindowSeekable()
Returns whether the current window is seekable, or
false if the Timeline is
empty. |
boolean |
isLoading()
Whether the player is currently loading the source.
|
boolean |
isPlayingAd()
Returns whether the player is currently playing an ad.
|
void |
prepare(MediaSource mediaSource)
Prepares the player to play the provided
MediaSource. |
void |
prepare(MediaSource mediaSource,
boolean resetPosition,
boolean resetState)
Prepares the player to play the provided
MediaSource, optionally resetting the playback
position the default position in the first Timeline.Window. |
void |
release()
Releases the player.
|
void |
removeAudioDebugListener(AudioRendererEventListener listener)
Removes a listener to receive debug events from the audio renderer.
|
void |
removeListener(Player.EventListener listener)
Unregister a listener.
|
void |
removeMetadataOutput(MetadataOutput listener) |
void |
removeTextOutput(TextOutput listener)
Removes a text output.
|
void |
removeVideoDebugListener(VideoRendererEventListener listener)
Removes a listener to receive debug events from the video renderer.
|
void |
removeVideoListener(VideoListener listener)
Removes a listener of video events.
|
void |
seekTo(int windowIndex,
long positionMs)
Seeks to a position specified in milliseconds in the specified window.
|
void |
seekTo(long positionMs)
Seeks to a position specified in milliseconds in the current window.
|
void |
seekToDefaultPosition()
Seeks to the default position associated with the current window.
|
void |
seekToDefaultPosition(int windowIndex)
Seeks to the default position associated with the specified window.
|
void |
sendMessages(ExoPlayer.ExoPlayerMessage... messages) |
void |
setAudioAttributes(AudioAttributes audioAttributes)
Sets the attributes for audio playback, used by the underlying audio track.
|
void |
setAudioDebugListener(AudioRendererEventListener listener)
Deprecated.
|
void |
setAudioStreamType(int streamType)
Deprecated.
|
void |
setMetadataOutput(MetadataOutput output)
Deprecated.
|
void |
setPlaybackParameters(PlaybackParameters playbackParameters)
Attempts to set the playback parameters.
|
void |
setPlaybackParams(android.media.PlaybackParams params)
Deprecated.
|
void |
setPlayWhenReady(boolean playWhenReady)
Sets whether playback should proceed when
Player.getPlaybackState() == Player.STATE_READY. |
void |
setRepeatMode(int repeatMode)
Sets the
Player.RepeatMode to be used for playback. |
void |
setSeekParameters(SeekParameters seekParameters)
Sets the parameters that control how seek operations are performed.
|
void |
setShuffleModeEnabled(boolean shuffleModeEnabled)
Sets whether shuffling of windows is enabled.
|
void |
setTextOutput(TextOutput output)
Deprecated.
|
void |
setVideoDebugListener(VideoRendererEventListener listener)
Deprecated.
|
void |
setVideoListener(SimpleExoPlayer.VideoListener listener)
Deprecated.
|
void |
setVideoScalingMode(int videoScalingMode)
Sets the video scaling mode.
|
void |
setVideoSurface(android.view.Surface surface)
Sets the
Surface onto which video will be rendered. |
void |
setVideoSurfaceHolder(android.view.SurfaceHolder surfaceHolder)
Sets the
SurfaceHolder that holds the Surface onto which video will be
rendered. |
void |
setVideoSurfaceView(android.view.SurfaceView surfaceView)
Sets the
SurfaceView onto which video will be rendered. |
void |
setVideoTextureView(android.view.TextureView textureView)
Sets the
TextureView onto which video will be rendered. |
void |
setVolume(float audioVolume)
Sets the audio volume, with 0 being silence and 1 being unity gain.
|
void |
stop()
Stops playback without resetting the player.
|
void |
stop(boolean reset)
Stops playback and optionally resets the player.
|
protected final Renderer[] renderers
protected SimpleExoPlayer(RenderersFactory renderersFactory, TrackSelector trackSelector, LoadControl loadControl)
renderersFactory - A factory for creating Renderers to be used by the instance.trackSelector - The TrackSelector that will be used by the instance.loadControl - The LoadControl that will be used by the instance.protected SimpleExoPlayer(RenderersFactory renderersFactory, TrackSelector trackSelector, LoadControl loadControl, Clock clock)
renderersFactory - A factory for creating Renderers to be used by the instance.trackSelector - The TrackSelector that will be used by the instance.loadControl - The LoadControl that will be used by the instance.clock - The Clock that will be used by the instance. Should always be Clock.DEFAULT, unless the player is being used from a test.public Player.VideoComponent getVideoComponent()
PlayergetVideoComponent in interface Playerpublic Player.TextComponent getTextComponent()
PlayergetTextComponent in interface Playerpublic void setVideoScalingMode(int videoScalingMode)
Note that the scaling mode only applies if a MediaCodec-based video Renderer
is enabled and if the output surface is owned by a SurfaceView.
setVideoScalingMode in interface Player.VideoComponentvideoScalingMode - The video scaling mode.public int getVideoScalingMode()
Player.VideoComponentgetVideoScalingMode in interface Player.VideoComponentpublic void clearVideoSurface()
Player.VideoComponentSurface, SurfaceHolder, SurfaceView or TextureView
currently set on the player.clearVideoSurface in interface Player.VideoComponentpublic void setVideoSurface(android.view.Surface surface)
Player.VideoComponentSurface 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 Player.VideoComponent.setVideoSurfaceView(SurfaceView), Player.VideoComponent.setVideoTextureView(TextureView) or Player.VideoComponent.setVideoSurfaceHolder(SurfaceHolder) rather
than this method, since passing the holder allows the player to track the lifecycle of the
surface automatically.
setVideoSurface in interface Player.VideoComponentsurface - The Surface.public void clearVideoSurface(android.view.Surface surface)
Player.VideoComponentSurface onto which video is being rendered if it matches the one passed.
Else does nothing.clearVideoSurface in interface Player.VideoComponentsurface - The surface to clear.public void setVideoSurfaceHolder(android.view.SurfaceHolder surfaceHolder)
Player.VideoComponentSurfaceHolder that holds the Surface onto which video will be
rendered. The player will track the lifecycle of the surface automatically.setVideoSurfaceHolder in interface Player.VideoComponentsurfaceHolder - The surface holder.public void clearVideoSurfaceHolder(android.view.SurfaceHolder surfaceHolder)
Player.VideoComponentSurfaceHolder that holds the Surface onto which video is being
rendered if it matches the one passed. Else does nothing.clearVideoSurfaceHolder in interface Player.VideoComponentsurfaceHolder - The surface holder to clear.public void setVideoSurfaceView(android.view.SurfaceView surfaceView)
Player.VideoComponentSurfaceView onto which video will be rendered. The player will track the
lifecycle of the surface automatically.setVideoSurfaceView in interface Player.VideoComponentsurfaceView - The surface view.public void clearVideoSurfaceView(android.view.SurfaceView surfaceView)
Player.VideoComponentSurfaceView onto which video is being rendered if it matches the one
passed. Else does nothing.clearVideoSurfaceView in interface Player.VideoComponentsurfaceView - The texture view to clear.public void setVideoTextureView(android.view.TextureView textureView)
Player.VideoComponentTextureView onto which video will be rendered. The player will track the
lifecycle of the surface automatically.setVideoTextureView in interface Player.VideoComponenttextureView - The texture view.public void clearVideoTextureView(android.view.TextureView textureView)
Player.VideoComponentTextureView onto which video is being rendered if it matches the one
passed. Else does nothing.clearVideoTextureView in interface Player.VideoComponenttextureView - The texture view to clear.@Deprecated public void setAudioStreamType(int streamType)
setAudioAttributes(AudioAttributes).Setting the stream type 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.
Calling this method overwrites any attributes set previously by calling
setAudioAttributes(AudioAttributes).
streamType - The stream type for audio playback.@Deprecated public int getAudioStreamType()
getAudioAttributes().public void setAudioAttributes(AudioAttributes audioAttributes)
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).
audioAttributes - The attributes to use for audio playback.public AudioAttributes getAudioAttributes()
public void setVolume(float audioVolume)
audioVolume - The audio volume.public float getVolume()
@Deprecated
public void setPlaybackParams(@Nullable
android.media.PlaybackParams params)
setPlaybackParameters(PlaybackParameters).PlaybackParams governing audio playback.params - The PlaybackParams, or null to clear any previously set parameters.public Format getVideoFormat()
public Format getAudioFormat()
public int getAudioSessionId()
C.AUDIO_SESSION_ID_UNSET if not set.public DecoderCounters getVideoDecoderCounters()
DecoderCounters for video, or null if no video is being played.public DecoderCounters getAudioDecoderCounters()
DecoderCounters for audio, or null if no audio is being played.public void addVideoListener(VideoListener listener)
Player.VideoComponentaddVideoListener in interface Player.VideoComponentlistener - The listener to register.public void removeVideoListener(VideoListener listener)
Player.VideoComponentremoveVideoListener in interface Player.VideoComponentlistener - The listener to unregister.@Deprecated public void setVideoListener(SimpleExoPlayer.VideoListener listener)
addVideoListener(com.google.android.exoplayer2.video.VideoListener).listener - The listener.@Deprecated public void clearVideoListener(SimpleExoPlayer.VideoListener listener)
listener - The listener to clear.public void addTextOutput(TextOutput listener)
Player.TextComponentaddTextOutput in interface Player.TextComponentlistener - The output to register.public void removeTextOutput(TextOutput listener)
Player.TextComponentremoveTextOutput in interface Player.TextComponentlistener - The output to remove.@Deprecated public void setTextOutput(TextOutput output)
addTextOutput(TextOutput).output - The output.@Deprecated public void clearTextOutput(TextOutput output)
removeTextOutput(TextOutput).removeTextOutput(TextOutput).output - The output to clear.public void addMetadataOutput(MetadataOutput listener)
public void removeMetadataOutput(MetadataOutput listener)
@Deprecated public void setMetadataOutput(MetadataOutput output)
addMetadataOutput(MetadataOutput).output - The output.@Deprecated public void clearMetadataOutput(MetadataOutput output)
removeMetadataOutput(MetadataOutput).removeMetadataOutput(MetadataOutput).output - The output to clear.@Deprecated public void setVideoDebugListener(VideoRendererEventListener listener)
addVideoDebugListener(VideoRendererEventListener).listener - The listener.public void addVideoDebugListener(VideoRendererEventListener listener)
listener - The listener.public void removeVideoDebugListener(VideoRendererEventListener listener)
listener - The listener.@Deprecated public void setAudioDebugListener(AudioRendererEventListener listener)
addAudioDebugListener(AudioRendererEventListener).listener - The listener.public void addAudioDebugListener(AudioRendererEventListener listener)
listener - The listener.public void removeAudioDebugListener(AudioRendererEventListener listener)
listener - The listener.public android.os.Looper getPlaybackLooper()
ExoPlayerLooper associated with the playback thread.getPlaybackLooper in interface ExoPlayerLooper associated with the playback thread.public void addListener(Player.EventListener listener)
PlayerLooper, then the listener will be called on the main thread.addListener in interface Playerlistener - The listener to register.public void removeListener(Player.EventListener listener)
PlayerremoveListener in interface Playerlistener - The listener to unregister.public int getPlaybackState()
PlayergetPlaybackState in interface PlayerSTATE constants defined in this interface.public void prepare(MediaSource mediaSource)
ExoPlayerMediaSource. Equivalent to
prepare(mediaSource, true, true).
Note: MediaSource instances are not designed to be re-used. If you want to prepare a
player more than once with the same piece of media, use a new instance each time.
public void prepare(MediaSource mediaSource, boolean resetPosition, boolean resetState)
ExoPlayerMediaSource, optionally resetting the playback
position the default position in the first Timeline.Window.
Note: MediaSource instances are not designed to be re-used. If you want to prepare a
player more than once with the same piece of media, use a new instance each time.
prepare in interface ExoPlayermediaSource - The MediaSource to play.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.getCurrentWindowIndex() and Player.getCurrentPosition().resetState - Whether the timeline, manifest, tracks and track selections should be reset.
Should be true unless the player is being prepared to play the same media as it was playing
previously (e.g. if playback failed and is being retried).public void setPlayWhenReady(boolean playWhenReady)
PlayerPlayer.getPlaybackState() == Player.STATE_READY.
If the player is already in the ready state then this method can be used to pause and resume playback.
setPlayWhenReady in interface PlayerplayWhenReady - Whether playback should proceed when ready.public boolean getPlayWhenReady()
PlayerPlayer.getPlaybackState() == Player.STATE_READY.getPlayWhenReady in interface Playerpublic int getRepeatMode()
PlayerPlayer.RepeatMode used for playback.getRepeatMode in interface Playerpublic void setRepeatMode(int repeatMode)
PlayerPlayer.RepeatMode to be used for playback.setRepeatMode in interface PlayerrepeatMode - A repeat mode.public void setShuffleModeEnabled(boolean shuffleModeEnabled)
PlayersetShuffleModeEnabled in interface PlayershuffleModeEnabled - Whether shuffling is enabled.public boolean getShuffleModeEnabled()
PlayergetShuffleModeEnabled in interface Playerpublic boolean isLoading()
Playerpublic void seekToDefaultPosition()
PlayerseekToDefaultPosition in interface Playerpublic void seekToDefaultPosition(int windowIndex)
PlayerseekToDefaultPosition in interface PlayerwindowIndex - The index of the window whose associated default position should be seeked
to.public void seekTo(long positionMs)
PlayerseekTo in interface PlayerpositionMs - The seek position in the current window, or C.TIME_UNSET to seek to
the window's default position.public void seekTo(int windowIndex,
long positionMs)
PlayerseekTo in interface PlayerwindowIndex - The index of the window.positionMs - The seek position in the specified window, or C.TIME_UNSET to seek to
the window's default position.public void setPlaybackParameters(@Nullable
PlaybackParameters playbackParameters)
Playernull sets the parameters to the
default, PlaybackParameters.DEFAULT, which means there is no speed or pitch adjustment.
Playback parameters changes may cause the player to buffer.
Player.EventListener.onPlaybackParametersChanged(PlaybackParameters) will be called whenever
the currently active playback parameters change. When that listener is called, the parameters
passed to it may not match playbackParameters. For example, the chosen speed or pitch
may be out of range, in which case they are constrained to a set of permitted values. If it is
not possible to change the playback parameters, the listener will not be invoked.
setPlaybackParameters in interface PlayerplaybackParameters - The playback parameters, or null to use the defaults.public PlaybackParameters getPlaybackParameters()
PlayergetPlaybackParameters in interface PlayerPlayer.EventListener.onPlaybackParametersChanged(PlaybackParameters)public void setSeekParameters(@Nullable
SeekParameters seekParameters)
ExoPlayersetSeekParameters in interface ExoPlayerseekParameters - The seek parameters, or null to use the defaults.public void stop()
PlayersetPlayWhenReady(false) rather than
this method if the intention is to pause playback.
Calling this method will cause the playback state to transition to Player.STATE_IDLE. The
player instance can still be used, and Player.release() must still be called on the player if
it's no longer required.
Calling this method does not reset the playback position.
public void stop(boolean reset)
PlayersetPlayWhenReady(false) rather
than this method if the intention is to pause playback.
Calling this method will cause the playback state to transition to Player.STATE_IDLE. The
player instance can still be used, and Player.release() must still be called on the player if
it's no longer required.
public void release()
Playerpublic void sendMessages(ExoPlayer.ExoPlayerMessage... messages)
sendMessages in interface ExoPlayerpublic PlayerMessage createMessage(PlayerMessage.Target target)
ExoPlayerPlayerMessage.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 window defined by Player.getCurrentWindowIndex().
Alternatively, the message can be sent at a specific window using PlayerMessage.setPosition(int, long).createMessage in interface ExoPlayerpublic void blockingSendMessages(ExoPlayer.ExoPlayerMessage... messages)
blockingSendMessages in interface ExoPlayerpublic int getRendererCount()
PlayergetRendererCount in interface Playerpublic int getRendererType(int index)
PlayergetRendererType in interface Playerindex - The index of the renderer.TRACK_TYPE_* constants defined in C.Renderer.getTrackType()public TrackGroupArray getCurrentTrackGroups()
PlayergetCurrentTrackGroups in interface Playerpublic TrackSelectionArray getCurrentTrackSelections()
PlayergetCurrentTrackSelections in interface Playerpublic Timeline getCurrentTimeline()
PlayerTimeline. Never null, but may be empty.getCurrentTimeline in interface Playerpublic java.lang.Object getCurrentManifest()
PlayergetCurrentManifest in interface Playerpublic int getCurrentPeriodIndex()
PlayergetCurrentPeriodIndex in interface Playerpublic int getCurrentWindowIndex()
PlayergetCurrentWindowIndex in interface Playerpublic int getNextWindowIndex()
PlayerC.INDEX_UNSET if the window
currently being played is the last window.getNextWindowIndex in interface Playerpublic int getPreviousWindowIndex()
PlayerC.INDEX_UNSET if the window
currently being played is the first window.getPreviousWindowIndex in interface Playerpublic long getDuration()
PlayerC.TIME_UNSET if the
duration is not known.getDuration in interface Playerpublic long getCurrentPosition()
PlayergetCurrentPosition in interface Playerpublic long getBufferedPosition()
PlayergetBufferedPosition in interface Playerpublic int getBufferedPercentage()
PlayergetBufferedPercentage in interface Playerpublic boolean isCurrentWindowDynamic()
Playerfalse if the Timeline is
empty.isCurrentWindowDynamic in interface PlayerTimeline.Window.isDynamicpublic boolean isCurrentWindowSeekable()
Playerfalse if the Timeline is
empty.isCurrentWindowSeekable in interface PlayerTimeline.Window.isSeekablepublic boolean isPlayingAd()
PlayerisPlayingAd in interface Playerpublic int getCurrentAdGroupIndex()
PlayerPlayer.isPlayingAd() returns true, returns the index of the ad group in the period
currently being played. Returns C.INDEX_UNSET otherwise.getCurrentAdGroupIndex in interface Playerpublic int getCurrentAdIndexInAdGroup()
PlayerPlayer.isPlayingAd() returns true, returns the index of the ad in its ad group. Returns
C.INDEX_UNSET otherwise.getCurrentAdIndexInAdGroup in interface Playerpublic long getContentPosition()
PlayerPlayer.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 Player.getCurrentPosition().getContentPosition in interface Playerprotected ExoPlayer createExoPlayerImpl(Renderer[] renderers, TrackSelector trackSelector, LoadControl loadControl, Clock clock)
ExoPlayer implementation used by this instance.renderers - The Renderers that will be used by the instance.trackSelector - The TrackSelector that will be used by the instance.loadControl - The LoadControl that will be used by the instance.clock - The Clock that will be used by this instance.ExoPlayer instance.