Interface Player.EventListener

    • Method Detail

      • onTimelineChanged

        default void onTimelineChanged​(Timeline timeline,
                                       @TimelineChangeReason
                                       @com.google.android.exoplayer2.Player.TimelineChangeReason int reason)
        Deprecated.
        Called when the timeline has been refreshed.

        Note that the current MediaItem or playback position may change as a result of a timeline change. If playback can't continue smoothly because of this timeline change, a separate onPositionDiscontinuity(PositionInfo, PositionInfo, int) callback will be triggered.

        onEvents(Player, Events) will also be called to report this event along with other events that happen in the same Looper message queue iteration.

        Parameters:
        timeline - The latest timeline. Never null, but may be empty.
        reason - The Player.TimelineChangeReason responsible for this timeline change.
      • onMediaItemTransition

        default void onMediaItemTransition​(@Nullable
                                           MediaItem mediaItem,
                                           @MediaItemTransitionReason
                                           @com.google.android.exoplayer2.Player.MediaItemTransitionReason int reason)
        Deprecated.
        Called when playback transitions to a media item or starts repeating a media item according to the current repeat mode.

        Note that this callback is also called when the playlist becomes non-empty or empty as a consequence of a playlist change.

        onEvents(Player, Events) will also be called to report this event along with other events that happen in the same Looper message queue iteration.

        Parameters:
        mediaItem - The MediaItem. May be null if the playlist becomes empty.
        reason - The reason for the transition.
      • onTracksChanged

        @Deprecated
        default void onTracksChanged​(TrackGroupArray trackGroups,
                                     TrackSelectionArray trackSelections)
        Deprecated.
        Called when the available or selected tracks change.

        onEvents(Player, Events) will also be called to report this event along with other events that happen in the same Looper message queue iteration.

        Parameters:
        trackGroups - The available tracks. Never null, but may be of length zero.
        trackSelections - The selected tracks. Never null, but may contain null elements. A concrete implementation may include null elements if it has a fixed number of renderer components, wishes to report a TrackSelection for each of them, and has one or more renderer components that is not assigned any selected tracks.
      • onTracksInfoChanged

        default void onTracksInfoChanged​(TracksInfo tracksInfo)
        Deprecated.
        Called when the available or selected tracks change.

        onEvents(Player, Events) will also be called to report this event along with other events that happen in the same Looper message queue iteration.

        Parameters:
        tracksInfo - The available tracks information. Never null, but may be of length zero.
      • onPlaylistMetadataChanged

        default void onPlaylistMetadataChanged​(MediaMetadata mediaMetadata)
        Deprecated.
        Called when the playlist MediaMetadata changes.
      • onIsLoadingChanged

        default void onIsLoadingChanged​(boolean isLoading)
        Deprecated.
        Called when the player starts or stops loading the source.

        onEvents(Player, Events) will also be called to report this event along with other events that happen in the same Looper message queue iteration.

        Parameters:
        isLoading - Whether the source is currently being loaded.
      • onPlaybackStateChanged

        default void onPlaybackStateChanged​(@State
                                            @com.google.android.exoplayer2.Player.State int playbackState)
        Deprecated.
        Called when the value returned from Player.getPlaybackState() changes.

        onEvents(Player, Events) will also be called to report this event along with other events that happen in the same Looper message queue iteration.

        Parameters:
        playbackState - The new playback state.
      • onPlayWhenReadyChanged

        default void onPlayWhenReadyChanged​(boolean playWhenReady,
                                            @PlayWhenReadyChangeReason
                                            @com.google.android.exoplayer2.Player.PlayWhenReadyChangeReason int reason)
        Deprecated.
        Called when the value returned from Player.getPlayWhenReady() changes.

        onEvents(Player, Events) will also be called to report this event along with other events that happen in the same Looper message queue iteration.

        Parameters:
        playWhenReady - Whether playback will proceed when ready.
        reason - The reason for the change.
      • onIsPlayingChanged

        default void onIsPlayingChanged​(boolean isPlaying)
        Deprecated.
        Called when the value of Player.isPlaying() changes.

        onEvents(Player, Events) will also be called to report this event along with other events that happen in the same Looper message queue iteration.

        Parameters:
        isPlaying - Whether the player is playing.
      • onRepeatModeChanged

        default void onRepeatModeChanged​(@RepeatMode
                                         @com.google.android.exoplayer2.Player.RepeatMode int repeatMode)
        Deprecated.
        Called when the value of Player.getRepeatMode() changes.

        onEvents(Player, Events) will also be called to report this event along with other events that happen in the same Looper message queue iteration.

        Parameters:
        repeatMode - The Player.RepeatMode used for playback.
      • onShuffleModeEnabledChanged

        default void onShuffleModeEnabledChanged​(boolean shuffleModeEnabled)
        Deprecated.
        Called when the value of Player.getShuffleModeEnabled() changes.

        onEvents(Player, Events) will also be called to report this event along with other events that happen in the same Looper message queue iteration.

        Parameters:
        shuffleModeEnabled - Whether shuffling of media items is enabled.
      • onPlayerError

        default void onPlayerError​(PlaybackException error)
        Deprecated.
        Called when an error occurs. The playback state will transition to 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.

        onEvents(Player, Events) will also be called to report this event along with other events that happen in the same Looper message queue iteration.

        Implementations of Player may pass an instance of a subclass of PlaybackException to this method in order to include more information about the error.

        Parameters:
        error - The error.
      • onPlayerErrorChanged

        default void onPlayerErrorChanged​(@Nullable
                                          PlaybackException error)
        Deprecated.
        Called when the PlaybackException returned by Player.getPlayerError() changes.

        onEvents(Player, Events) will also be called to report this event along with other events that happen in the same Looper message queue iteration.

        Implementations of Player may pass an instance of a subclass of PlaybackException to this method in order to include more information about the error.

        Parameters:
        error - The new error, or null if the error is being cleared.
      • onPositionDiscontinuity

        default void onPositionDiscontinuity​(Player.PositionInfo oldPosition,
                                             Player.PositionInfo newPosition,
                                             @DiscontinuityReason
                                             @com.google.android.exoplayer2.Player.DiscontinuityReason int reason)
        Deprecated.
        Called when a position discontinuity occurs.

        A position discontinuity occurs when the playing period changes, the playback position jumps within the period currently being played, or when the playing period has been skipped or removed.

        onEvents(Player, Events) will also be called to report this event along with other events that happen in the same Looper message queue iteration.

        Parameters:
        oldPosition - The position before the discontinuity.
        newPosition - The position after the discontinuity.
        reason - The Player.DiscontinuityReason responsible for the discontinuity.
      • onPlaybackParametersChanged

        default void onPlaybackParametersChanged​(PlaybackParameters playbackParameters)
        Deprecated.
        Called when the current playback parameters change. The playback parameters may change due to a call to Player.setPlaybackParameters(PlaybackParameters), or the player itself may change them (for example, if audio playback switches to passthrough or offload mode, where speed adjustment is no longer possible).

        onEvents(Player, Events) will also be called to report this event along with other events that happen in the same Looper message queue iteration.

        Parameters:
        playbackParameters - The playback parameters.
      • onSeekBackIncrementChanged

        default void onSeekBackIncrementChanged​(long seekBackIncrementMs)
        Deprecated.
        Called when the value of Player.getSeekBackIncrement() changes.

        onEvents(Player, Events) will also be called to report this event along with other events that happen in the same Looper message queue iteration.

        Parameters:
        seekBackIncrementMs - The Player.seekBack() increment, in milliseconds.
      • onSeekForwardIncrementChanged

        default void onSeekForwardIncrementChanged​(long seekForwardIncrementMs)
        Deprecated.
        Called when the value of Player.getSeekForwardIncrement() changes.

        onEvents(Player, Events) will also be called to report this event along with other events that happen in the same Looper message queue iteration.

        Parameters:
        seekForwardIncrementMs - The Player.seekForward() increment, in milliseconds.
      • onMaxSeekToPreviousPositionChanged

        default void onMaxSeekToPreviousPositionChanged​(long maxSeekToPreviousPositionMs)
        Deprecated.
        Called when the value of Player.getMaxSeekToPreviousPosition() changes.

        onEvents(Player, Events) will also be called to report this event along with other events that happen in the same Looper message queue iteration.

        Parameters:
        maxSeekToPreviousPositionMs - The maximum position for which Player.seekToPrevious() seeks to the previous position, in milliseconds.