public final class DebugTextViewHelper extends Object implements Runnable, ExoPlayer.EventListener
TextView
with debug information obtained from
a SimpleExoPlayer
.Constructor and Description |
---|
DebugTextViewHelper(SimpleExoPlayer player,
TextView textView) |
Modifier and Type | Method and Description |
---|---|
void |
onLoadingChanged(boolean isLoading)
Called when the player starts or stops loading the source.
|
void |
onPlayerError(ExoPlaybackException error)
Called when an error occurs.
|
void |
onPlayerStateChanged(boolean playWhenReady,
int playbackState)
Called when the value returned from either
ExoPlayer.getPlayWhenReady() or
ExoPlayer.getPlaybackState() changes. |
void |
onPositionDiscontinuity()
Called when a position discontinuity occurs.
|
void |
onTimelineChanged(Timeline timeline,
Object manifest)
Called when timeline and/or manifest has been refreshed.
|
void |
run() |
void |
start()
Starts periodic updates of the
TextView . |
void |
stop()
Stops periodic updates of the
TextView . |
public DebugTextViewHelper(SimpleExoPlayer player, TextView textView)
player
- The SimpleExoPlayer
from which debug information should be obtained.textView
- The TextView
that should be updated to display the information.public void start()
TextView
. Must be called from the application's main
thread.public void stop()
TextView
. Must be called from the application's main
thread.public void onLoadingChanged(boolean isLoading)
ExoPlayer.EventListener
onLoadingChanged
in interface ExoPlayer.EventListener
isLoading
- Whether the source is currently being loaded.public void onPlayerStateChanged(boolean playWhenReady, int playbackState)
ExoPlayer.EventListener
ExoPlayer.getPlayWhenReady()
or
ExoPlayer.getPlaybackState()
changes.onPlayerStateChanged
in interface ExoPlayer.EventListener
playWhenReady
- Whether playback will proceed when ready.playbackState
- One of the STATE
constants defined in the ExoPlayer
interface.public void onPositionDiscontinuity()
ExoPlayer.EventListener
onPositionDiscontinuity
in interface ExoPlayer.EventListener
public void onTimelineChanged(Timeline timeline, Object manifest)
ExoPlayer.EventListener
onTimelineChanged
in interface ExoPlayer.EventListener
timeline
- The latest timeline, or null if the timeline is being cleared.manifest
- The latest manifest, or null if the manifest is being cleared.public void onPlayerError(ExoPlaybackException error)
ExoPlayer.EventListener
ExoPlayer.STATE_IDLE
immediately after this method is called. The player instance can still be used, and
ExoPlayer.release()
must still be called on the player should it no longer be required.onPlayerError
in interface ExoPlayer.EventListener
error
- The error.