public static interface Player.EventListener
Modifier and Type | Method and Description |
---|---|
default void |
onLoadingChanged(boolean isLoading)
Called when the player starts or stops loading the source.
|
default void |
onPlaybackParametersChanged(PlaybackParameters playbackParameters)
Called when the current playback parameters change.
|
default void |
onPlayerError(ExoPlaybackException error)
Called when an error occurs.
|
default void |
onPlayerStateChanged(boolean playWhenReady,
int playbackState)
Called when the value returned from either
Player.getPlayWhenReady() or Player.getPlaybackState() changes. |
default void |
onPositionDiscontinuity(int reason)
Called when a position discontinuity occurs without a change to the timeline.
|
default void |
onRepeatModeChanged(int repeatMode)
Called when the value of
Player.getRepeatMode() changes. |
default void |
onSeekProcessed()
Called when all pending seek requests have been processed by the player.
|
default void |
onShuffleModeEnabledChanged(boolean shuffleModeEnabled)
Called when the value of
Player.getShuffleModeEnabled() changes. |
default void |
onTimelineChanged(Timeline timeline,
Object manifest,
int reason)
Called when the timeline and/or manifest has been refreshed.
|
default void |
onTracksChanged(TrackGroupArray trackGroups,
TrackSelectionArray trackSelections)
Called when the available or selected tracks change.
|
default void onTimelineChanged(Timeline timeline, @Nullable Object manifest, @Player.TimelineChangeReason int reason)
Note that if the timeline has changed then a position discontinuity may also have
occurred. For example, the current period index may have changed as a result of periods being
added or removed from the timeline. This will not be reported via a separate call to
onPositionDiscontinuity(int)
.
timeline
- The latest timeline. Never null, but may be empty.manifest
- The latest manifest. May be null.reason
- The Player.TimelineChangeReason
responsible for this timeline change.default void onTracksChanged(TrackGroupArray trackGroups, TrackSelectionArray trackSelections)
trackGroups
- The available tracks. Never null, but may be of length zero.trackSelections
- The track selections for each renderer. Never null and always of
length Player.getRendererCount()
, but may contain null elements.default void onLoadingChanged(boolean isLoading)
isLoading
- Whether the source is currently being loaded.default void onPlayerStateChanged(boolean playWhenReady, int playbackState)
Player.getPlayWhenReady()
or Player.getPlaybackState()
changes.playWhenReady
- Whether playback will proceed when ready.playbackState
- One of the STATE
constants.default void onRepeatModeChanged(@Player.RepeatMode int repeatMode)
Player.getRepeatMode()
changes.repeatMode
- The Player.RepeatMode
used for playback.default void onShuffleModeEnabledChanged(boolean shuffleModeEnabled)
Player.getShuffleModeEnabled()
changes.shuffleModeEnabled
- Whether shuffling of windows is enabled.default void onPlayerError(ExoPlaybackException error)
Player.STATE_IDLE
immediately after this method is called. The player instance can still be used, and Player.release()
must still be called on the player should it no longer be required.error
- The error.default void onPositionDiscontinuity(@Player.DiscontinuityReason int reason)
When a position discontinuity occurs as a result of a change to the timeline this method
is not called. onTimelineChanged(Timeline, Object, int)
is called in this
case.
reason
- The Player.DiscontinuityReason
responsible for the discontinuity.default void onPlaybackParametersChanged(PlaybackParameters playbackParameters)
Player.setPlaybackParameters(PlaybackParameters)
, or the player itself may change
them (for example, if audio playback switches to passthrough mode, where speed adjustment is
no longer possible).playbackParameters
- The playback parameters.default void onSeekProcessed()
onPlayerStateChanged(boolean, int)
.