Interface Player.EventListener

    • Method Detail

      • onTimelineChanged

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

        Note that the current window or period index 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
                                           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

        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.
      • onStaticMetadataChanged

        default void onStaticMetadataChanged​(List<Metadata> metadataList)
        Deprecated.
        Called when the static metadata changes.

        The provided metadataList is an immutable list of Metadata instances, where the elements correspond to the current track selections, or an empty list if there are no track selections or the selected tracks contain no static metadata.

        The metadata is considered static in the sense that it comes from the tracks' declared Formats, rather than being timed (or dynamic) metadata, which is represented within a metadata track.

        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:
        metadataList - The static metadata.
      • 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
                                            int state)
        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:
        state - The new playback state.
      • onPlayWhenReadyChanged

        default void onPlayWhenReadyChanged​(boolean playWhenReady,
                                            @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.
      • 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 windows is enabled.
      • onPlayerError

        default void onPlayerError​(ExoPlaybackException 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.

        Parameters:
        error - The error.
      • onPositionDiscontinuity

        default void onPositionDiscontinuity​(Player.PositionInfo oldPosition,
                                             Player.PositionInfo newPosition,
                                             @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.