Package com.google.android.exoplayer2.analytics

## Class DefaultAnalyticsCollector

- java.lang.Object
- - com.google.android.exoplayer2.analytics.DefaultAnalyticsCollector

- All Implemented Interfaces:
    `AnalyticsCollector`, `DrmSessionEventListener`, `Player.Listener`, `MediaSourceEventListener`, `BandwidthMeter.EventListener`

      public class DefaultAnalyticsCollector
      extends Object
      implements AnalyticsCollector

  Data collector that forwards analytics events to `AnalyticsListeners`.

- - ### Nested Class Summary

    - ### Nested classes/interfaces inherited from interface com.google.android.exoplayer2.upstream.BandwidthMeter.EventListener

      `BandwidthMeter.EventListener.EventDispatcher`

    - ### Nested classes/interfaces inherited from interface com.google.android.exoplayer2.drm.DrmSessionEventListener

      `DrmSessionEventListener.EventDispatcher`

    - ### Nested classes/interfaces inherited from interface com.google.android.exoplayer2.source.MediaSourceEventListener

      `MediaSourceEventListener.EventDispatcher`

  - ### Constructor Summary

    Constructors
    Constructor | Description
    --- | ---
    `DefaultAnalyticsCollector​(Clock clock)` | Creates an analytics collector.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods Deprecated Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `void` | `addListener​(AnalyticsListener listener)` | Adds a listener for analytics events.
    `protected AnalyticsListener.EventTime` | `generateCurrentPlayerMediaPeriodEventTime()` | Generates an `AnalyticsListener.EventTime` for the currently playing item in the player.
    `protected AnalyticsListener.EventTime` | `generateEventTime​(Timeline timeline, int windowIndex, MediaSource.MediaPeriodId mediaPeriodId)` | Returns a new `AnalyticsListener.EventTime` for the specified timeline, window and media period id.
    `void` | `notifySeekStarted()` | Notify analytics collector that a seek operation will start.
    `void` | `onAudioAttributesChanged​(AudioAttributes audioAttributes)` | Called when the value of `Player.getAudioAttributes()` changes.
    `void` | `onAudioCodecError​(Exception audioCodecError)` | Called when an audio decoder encounters an error.
    `void` | `onAudioDecoderInitialized​(String decoderName, long initializedTimestampMs, long initializationDurationMs)` | Called when a audio decoder is created.
    `void` | `onAudioDecoderReleased​(String decoderName)` | Called when a audio decoder is released.
    `void` | `onAudioDisabled​(DecoderCounters counters)` | Called when the audio renderer is disabled.
    `void` | `onAudioEnabled​(DecoderCounters counters)` | Called when the audio renderer is enabled.
    `void` | `onAudioInputFormatChanged​(Format format, DecoderReuseEvaluation decoderReuseEvaluation)` | Called when the format of the media being consumed by the audio renderer changes.
    `void` | `onAudioPositionAdvancing​(long playoutStartSystemTimeMs)` | Called when the audio position has increased for the first time since the last pause or position reset.
    `void` | `onAudioSessionIdChanged​(int audioSessionId)` | Called when the audio session ID changes.
    `void` | `onAudioSinkError​(Exception audioSinkError)` | Called when `AudioSink` has encountered an error.
    `void` | `onAudioUnderrun​(int bufferSize, long bufferSizeMs, long elapsedSinceLastFeedMs)` | Called when an audio underrun occurs.
    `void` | `onAvailableCommandsChanged​(Player.Commands availableCommands)` | Called when the value returned from `Player.isCommandAvailable(int)` changes for at least one `Player.Command`.
    `void` | `onBandwidthSample​(int elapsedMs, long bytesTransferred, long bitrateEstimate)` | Called periodically to indicate that bytes have been transferred or the estimated bitrate has changed.
    `void` | `onCues​(CueGroup cueGroup)` | Called when the value of `Player.getCurrentCues()` changes.
    `void` | `onCues​(List<Cue> cues)` | Called when the value of `Player.getCurrentCues()` changes.
    `void` | `onDeviceInfoChanged​(DeviceInfo deviceInfo)` | Called when the device information changes
    `void` | `onDeviceVolumeChanged​(int volume, boolean muted)` | Called when the value of `Player.getDeviceVolume()` or `Player.isDeviceMuted()` changes.
    `void` | `onDownstreamFormatChanged​(int windowIndex, MediaSource.MediaPeriodId mediaPeriodId, MediaLoadData mediaLoadData)` | Called when a downstream format change occurs (i.e.
    `void` | `onDrmKeysLoaded​(int windowIndex, MediaSource.MediaPeriodId mediaPeriodId)` | Called each time keys are loaded.
    `void` | `onDrmKeysRemoved​(int windowIndex, MediaSource.MediaPeriodId mediaPeriodId)` | Called each time offline keys are removed.
    `void` | `onDrmKeysRestored​(int windowIndex, MediaSource.MediaPeriodId mediaPeriodId)` | Called each time offline keys are restored.
    `void` | `onDrmSessionAcquired​(int windowIndex, MediaSource.MediaPeriodId mediaPeriodId, @com.google.android.exoplayer2.drm.DrmSession.State int state)` | Called each time a drm session is acquired.
    `void` | `onDrmSessionManagerError​(int windowIndex, MediaSource.MediaPeriodId mediaPeriodId, Exception error)` | Called when a drm error occurs.
    `void` | `onDrmSessionReleased​(int windowIndex, MediaSource.MediaPeriodId mediaPeriodId)` | Called each time a drm session is released.
    `void` | `onDroppedFrames​(int count, long elapsedMs)` | Called to report the number of frames dropped by the video renderer.
    `void` | `onEvents​(Player player, Player.Events events)` | Called when one or more player states changed.
    `void` | `onIsLoadingChanged​(boolean isLoading)` | Called when the player starts or stops loading the source.
    `void` | `onIsPlayingChanged​(boolean isPlaying)` | Called when the value of `Player.isPlaying()` changes.
    `void` | `onLoadCanceled​(int windowIndex, MediaSource.MediaPeriodId mediaPeriodId, LoadEventInfo loadEventInfo, MediaLoadData mediaLoadData)` | Called when a load is canceled.
    `void` | `onLoadCompleted​(int windowIndex, MediaSource.MediaPeriodId mediaPeriodId, LoadEventInfo loadEventInfo, MediaLoadData mediaLoadData)` | Called when a load ends.
    `void` | `onLoadError​(int windowIndex, MediaSource.MediaPeriodId mediaPeriodId, LoadEventInfo loadEventInfo, MediaLoadData mediaLoadData, IOException error, boolean wasCanceled)` | Called when a load error occurs.
    `void` | `onLoadingChanged​(boolean isLoading)` |
    `void` | `onLoadStarted​(int windowIndex, MediaSource.MediaPeriodId mediaPeriodId, LoadEventInfo loadEventInfo, MediaLoadData mediaLoadData)` | Called when a load begins.
    `void` | `onMaxSeekToPreviousPositionChanged​(long maxSeekToPreviousPositionMs)` | Called when the value of `Player.getMaxSeekToPreviousPosition()` changes.
    `void` | `onMediaItemTransition​(MediaItem mediaItem, @com.google.android.exoplayer2.Player.MediaItemTransitionReason int reason)` | Called when playback transitions to a media item or starts repeating a media item according to the current `repeat mode`.
    `void` | `onMediaMetadataChanged​(MediaMetadata mediaMetadata)` | Called when the value of `Player.getMediaMetadata()` changes.
    `void` | `onMetadata​(Metadata metadata)` | Called when there is metadata associated with the current playback time.
    `void` | `onPlaybackParametersChanged​(PlaybackParameters playbackParameters)` | Called when the value of `Player.getPlaybackParameters()` changes.
    `void` | `onPlaybackStateChanged​(@com.google.android.exoplayer2.Player.State int playbackState)` | Called when the value returned from `Player.getPlaybackState()` changes.
    `void` | `onPlaybackSuppressionReasonChanged​(@com.google.android.exoplayer2.Player.PlaybackSuppressionReason int playbackSuppressionReason)` | Called when the value returned from `Player.getPlaybackSuppressionReason()` changes.
    `void` | `onPlayerError​(PlaybackException error)` | Called when an error occurs.
    `void` | `onPlayerErrorChanged​(PlaybackException error)` | Called when the `PlaybackException` returned by `Player.getPlayerError()` changes.
    `void` | `onPlayerStateChanged​(boolean playWhenReady, @com.google.android.exoplayer2.Player.State int playbackState)` |
    `void` | `onPlaylistMetadataChanged​(MediaMetadata playlistMetadata)` | Called when the value of `Player.getPlaylistMetadata()` changes.
    `void` | `onPlayWhenReadyChanged​(boolean playWhenReady, @com.google.android.exoplayer2.Player.PlayWhenReadyChangeReason int reason)` | Called when the value returned from `Player.getPlayWhenReady()` changes.
    `void` | `onPositionDiscontinuity​(@com.google.android.exoplayer2.Player.DiscontinuityReason int reason)` |
    `void` | `onPositionDiscontinuity​(Player.PositionInfo oldPosition, Player.PositionInfo newPosition, @com.google.android.exoplayer2.Player.DiscontinuityReason int reason)` | Called when a position discontinuity occurs.
    `void` | `onRenderedFirstFrame()` | Called when a frame is rendered for the first time since setting the surface, or since the renderer was reset, or since the stream being rendered was changed.
    `void` | `onRenderedFirstFrame​(Object output, long renderTimeMs)` | Called when a frame is rendered for the first time since setting the output, or since the renderer was reset, or since the stream being rendered was changed.
    `void` | `onRepeatModeChanged​(@com.google.android.exoplayer2.Player.RepeatMode int repeatMode)` | Called when the value of `Player.getRepeatMode()` changes.
    `void` | `onSeekBackIncrementChanged​(long seekBackIncrementMs)` | Called when the value of `Player.getSeekBackIncrement()` changes.
    `void` | `onSeekForwardIncrementChanged​(long seekForwardIncrementMs)` | Called when the value of `Player.getSeekForwardIncrement()` changes.
    `void` | `onSeekProcessed()` |
    `void` | `onShuffleModeEnabledChanged​(boolean shuffleModeEnabled)` | Called when the value of `Player.getShuffleModeEnabled()` changes.
    `void` | `onSkipSilenceEnabledChanged​(boolean skipSilenceEnabled)` | Called when skipping silences is enabled or disabled in the audio stream.
    `void` | `onSurfaceSizeChanged​(int width, int height)` | Called each time there's a change in the size of the surface onto which the video is being rendered.
    `void` | `onTimelineChanged​(Timeline timeline, @com.google.android.exoplayer2.Player.TimelineChangeReason int reason)` | Called when the value of `Player.getCurrentTimeline()` changes.
    `void` | `onTracksChanged​(Tracks tracks)` | Called when the value of `Player.getCurrentTracks()` changes.
    `void` | `onTrackSelectionParametersChanged​(TrackSelectionParameters parameters)` | Called when the value returned from `Player.getTrackSelectionParameters()` changes.
    `void` | `onUpstreamDiscarded​(int windowIndex, MediaSource.MediaPeriodId mediaPeriodId, MediaLoadData mediaLoadData)` | Called when data is removed from the back of a media buffer, typically so that it can be re-buffered in a different format.
    `void` | `onVideoCodecError​(Exception videoCodecError)` | Called when a video decoder encounters an error.
    `void` | `onVideoDecoderInitialized​(String decoderName, long initializedTimestampMs, long initializationDurationMs)` | Called when a video decoder is created.
    `void` | `onVideoDecoderReleased​(String decoderName)` | Called when a video decoder is released.
    `void` | `onVideoDisabled​(DecoderCounters counters)` | Called when the video renderer is disabled.
    `void` | `onVideoEnabled​(DecoderCounters counters)` | Called when the video renderer is enabled.
    `void` | `onVideoFrameProcessingOffset​(long totalProcessingOffsetUs, int frameCount)` | Called to report the video processing offset of video frames processed by the video renderer.
    `void` | `onVideoInputFormatChanged​(Format format, DecoderReuseEvaluation decoderReuseEvaluation)` | Called when the format of the media being consumed by the video renderer changes.
    `void` | `onVideoSizeChanged​(VideoSize videoSize)` | Called each time there's a change in the size of the video being rendered.
    `void` | `onVolumeChanged​(float volume)` | Called when the value of `Player.getVolume()` changes.
    `void` | `release()` | Releases the collector.
    `void` | `removeListener​(AnalyticsListener listener)` | Removes a previously added analytics event listener.
    `protected void` | `sendEvent​(AnalyticsListener.EventTime eventTime, int eventFlag, ListenerSet.Event<AnalyticsListener> eventInvocation)` | Sends an event to registered listeners.
    `void` | `setPlayer​(Player player, Looper looper)` | Sets the player for which data will be collected.
    `void` | `setThrowsWhenUsingWrongThread​(boolean throwsWhenUsingWrongThread)` | Deprecated. Do not use this method and ensure all calls are made from the correct thread.
    `void` | `updateMediaPeriodQueueInfo​(List<MediaSource.MediaPeriodId> queue, MediaSource.MediaPeriodId readingPeriod)` | Updates the playback queue information used for event association.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

    - ### Methods inherited from interface com.google.android.exoplayer2.drm.DrmSessionEventListener

      `onDrmSessionAcquired`

- - ### Constructor Detail

    - #### DefaultAnalyticsCollector

          public DefaultAnalyticsCollector​(Clock clock)

      Creates an analytics collector.
      Parameters:
        `clock` - A `Clock` used to generate timestamps.

  - ### Method Detail

    - #### setThrowsWhenUsingWrongThread

          @Deprecated
          public void setThrowsWhenUsingWrongThread​(boolean throwsWhenUsingWrongThread)

      Deprecated.
      Do not use this method and ensure all calls are made from the correct thread.
      Sets whether methods throw when using the wrong thread.

      Do not use this method unless to support legacy use cases.

      Parameters:
        `throwsWhenUsingWrongThread` - Whether to throw when using the wrong thread.

    - #### addListener

          @CallSuper
          public void addListener​(AnalyticsListener listener)

      Description copied from interface: `AnalyticsCollector`
      Adds a listener for analytics events.
      Specified by:
        `addListener` in interface `AnalyticsCollector`
      Parameters:
        `listener` - The listener to add.

    - #### removeListener

          @CallSuper
          public void removeListener​(AnalyticsListener listener)

      Description copied from interface: `AnalyticsCollector`
      Removes a previously added analytics event listener.
      Specified by:
        `removeListener` in interface `AnalyticsCollector`
      Parameters:
        `listener` - The listener to remove.

    - #### setPlayer

          @CallSuper
          public void setPlayer​(Player player,
                                Looper looper)

      Description copied from interface: `AnalyticsCollector`
      Sets the player for which data will be collected. Must only be called if no player has been set yet or the current player is idle.
      Specified by:
        `setPlayer` in interface `AnalyticsCollector`
      Parameters:
        `player` - The `Player` for which data will be collected.
        `looper` - The `Looper` used for listener callbacks.

    - #### release

          @CallSuper
          public void release()

      Description copied from interface: `AnalyticsCollector`
      Releases the collector. Must be called after the player for which data is collected has been released.
      Specified by:
        `release` in interface `AnalyticsCollector`

    - #### updateMediaPeriodQueueInfo

          public final void updateMediaPeriodQueueInfo​(List<MediaSource.MediaPeriodId> queue,
                                                       @Nullable
                                                       MediaSource.MediaPeriodId readingPeriod)

      Description copied from interface: `AnalyticsCollector`
      Updates the playback queue information used for event association.

      Should only be called by the player controlling the queue and not from app code.

      Specified by:
        `updateMediaPeriodQueueInfo` in interface `AnalyticsCollector`
      Parameters:
        `queue` - The playback queue of media periods identified by their `MediaSource.MediaPeriodId`.
        `readingPeriod` - The media period in the queue that is currently being read by renderers, or null if the queue is empty.

    - #### notifySeekStarted

          public final void notifySeekStarted()

      Description copied from interface: `AnalyticsCollector`
      Notify analytics collector that a seek operation will start. Should be called before the player adjusts its state and position to the seek.
      Specified by:
        `notifySeekStarted` in interface `AnalyticsCollector`

    - #### onAudioEnabled

          public final void onAudioEnabled​(DecoderCounters counters)

      Description copied from interface: `AnalyticsCollector`
      Called when the audio renderer is enabled.
      Specified by:
        `onAudioEnabled` in interface `AnalyticsCollector`
      Parameters:
        `counters` - `DecoderCounters` that will be updated by the audio renderer for as long as it remains enabled.

    - #### onAudioDecoderInitialized

          public final void onAudioDecoderInitialized​(String decoderName,
                                                      long initializedTimestampMs,
                                                      long initializationDurationMs)

      Description copied from interface: `AnalyticsCollector`
      Called when a audio decoder is created.
      Specified by:
        `onAudioDecoderInitialized` in interface `AnalyticsCollector`
      Parameters:
        `decoderName` - The audio decoder that was created.
        `initializedTimestampMs` - `SystemClock.elapsedRealtime()` when initialization finished.
        `initializationDurationMs` - The time taken to initialize the decoder in milliseconds.

    - #### onAudioInputFormatChanged

          public final void onAudioInputFormatChanged​(Format format,
                                                      @Nullable
                                                      DecoderReuseEvaluation decoderReuseEvaluation)

      Description copied from interface: `AnalyticsCollector`
      Called when the format of the media being consumed by the audio renderer changes.
      Specified by:
        `onAudioInputFormatChanged` in interface `AnalyticsCollector`
      Parameters:
        `format` - The new format.
        `decoderReuseEvaluation` - The result of the evaluation to determine whether an existing decoder instance can be reused for the new format, or `null` if the renderer did not have a decoder.

    - #### onAudioPositionAdvancing

          public final void onAudioPositionAdvancing​(long playoutStartSystemTimeMs)

      Description copied from interface: `AnalyticsCollector`
      Called when the audio position has increased for the first time since the last pause or position reset.
      Specified by:
        `onAudioPositionAdvancing` in interface `AnalyticsCollector`
      Parameters:
        `playoutStartSystemTimeMs` - The approximate derived `System.currentTimeMillis()` at which playout started.

    - #### onAudioUnderrun

          public final void onAudioUnderrun​(int bufferSize,
                                            long bufferSizeMs,
                                            long elapsedSinceLastFeedMs)

      Description copied from interface: `AnalyticsCollector`
      Called when an audio underrun occurs.
      Specified by:
        `onAudioUnderrun` in interface `AnalyticsCollector`
      Parameters:
        `bufferSize` - The size of the audio output buffer, in bytes.
        `bufferSizeMs` - The size of the audio output buffer, in milliseconds, if it contains PCM encoded audio. `C.TIME_UNSET` if the output buffer contains non-PCM encoded audio.
        `elapsedSinceLastFeedMs` - The time since audio was last written to the output buffer.

    - #### onAudioDecoderReleased

          public final void onAudioDecoderReleased​(String decoderName)

      Description copied from interface: `AnalyticsCollector`
      Called when a audio decoder is released.
      Specified by:
        `onAudioDecoderReleased` in interface `AnalyticsCollector`
      Parameters:
        `decoderName` - The audio decoder that was released.

    - #### onAudioDisabled

          public final void onAudioDisabled​(DecoderCounters counters)

      Description copied from interface: `AnalyticsCollector`
      Called when the audio renderer is disabled.
      Specified by:
        `onAudioDisabled` in interface `AnalyticsCollector`
      Parameters:
        `counters` - `DecoderCounters` that were updated by the audio renderer.

    - #### onAudioSinkError

          public final void onAudioSinkError​(Exception audioSinkError)

      Description copied from interface: `AnalyticsCollector`
      Called when `AudioSink` has encountered an error.

      If the sink writes to a platform `AudioTrack`, this will be called for all `AudioTrack` errors.

      Specified by:
        `onAudioSinkError` in interface `AnalyticsCollector`
      Parameters:
        `audioSinkError` - The error that occurred. Typically an `AudioSink.InitializationException`, a `AudioSink.WriteException`, or an `AudioSink.UnexpectedDiscontinuityException`.

    - #### onAudioCodecError

          public final void onAudioCodecError​(Exception audioCodecError)

      Description copied from interface: `AnalyticsCollector`
      Called when an audio decoder encounters an error.
      Specified by:
        `onAudioCodecError` in interface `AnalyticsCollector`
      Parameters:
        `audioCodecError` - The error. Typically a `MediaCodec.CodecException` if the renderer uses `MediaCodec`, or a `DecoderException` if the renderer uses a software decoder.

    - #### onVolumeChanged

          public final void onVolumeChanged​(float volume)

      Description copied from interface: `Player.Listener`
      Called when the value of `Player.getVolume()` changes.

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

      Specified by:
        `onVolumeChanged` in interface `Player.Listener`
      Parameters:
        `volume` - The new volume, with 0 being silence and 1 being unity gain.

    - #### onVideoEnabled

          public final void onVideoEnabled​(DecoderCounters counters)

      Description copied from interface: `AnalyticsCollector`
      Called when the video renderer is enabled.
      Specified by:
        `onVideoEnabled` in interface `AnalyticsCollector`
      Parameters:
        `counters` - `DecoderCounters` that will be updated by the video renderer for as long as it remains enabled.

    - #### onVideoDecoderInitialized

          public final void onVideoDecoderInitialized​(String decoderName,
                                                      long initializedTimestampMs,
                                                      long initializationDurationMs)

      Description copied from interface: `AnalyticsCollector`
      Called when a video decoder is created.
      Specified by:
        `onVideoDecoderInitialized` in interface `AnalyticsCollector`
      Parameters:
        `decoderName` - The decoder that was created.
        `initializedTimestampMs` - `SystemClock.elapsedRealtime()` when initialization finished.
        `initializationDurationMs` - The time taken to initialize the decoder in milliseconds.

    - #### onVideoInputFormatChanged

          public final void onVideoInputFormatChanged​(Format format,
                                                      @Nullable
                                                      DecoderReuseEvaluation decoderReuseEvaluation)

      Description copied from interface: `AnalyticsCollector`
      Called when the format of the media being consumed by the video renderer changes.
      Specified by:
        `onVideoInputFormatChanged` in interface `AnalyticsCollector`
      Parameters:
        `format` - The new format.
        `decoderReuseEvaluation` - The result of the evaluation to determine whether an existing decoder instance can be reused for the new format, or `null` if the renderer did not have a decoder.

    - #### onDroppedFrames

          public final void onDroppedFrames​(int count,
                                            long elapsedMs)

      Description copied from interface: `AnalyticsCollector`
      Called to report the number of frames dropped by the video renderer. Dropped frames are reported whenever the renderer is stopped having dropped frames, and optionally, whenever the count reaches a specified threshold whilst the renderer is started.
      Specified by:
        `onDroppedFrames` in interface `AnalyticsCollector`
      Parameters:
        `count` - The number of dropped frames.
        `elapsedMs` - The duration in milliseconds over which the frames were dropped. This duration is timed from when the renderer was started or from when dropped frames were last reported (whichever was more recent), and not from when the first of the reported drops occurred.

    - #### onVideoDecoderReleased

          public final void onVideoDecoderReleased​(String decoderName)

      Description copied from interface: `AnalyticsCollector`
      Called when a video decoder is released.
      Specified by:
        `onVideoDecoderReleased` in interface `AnalyticsCollector`
      Parameters:
        `decoderName` - The video decoder that was released.

    - #### onVideoDisabled

          public final void onVideoDisabled​(DecoderCounters counters)

      Description copied from interface: `AnalyticsCollector`
      Called when the video renderer is disabled.
      Specified by:
        `onVideoDisabled` in interface `AnalyticsCollector`
      Parameters:
        `counters` - `DecoderCounters` that were updated by the video renderer.

    - #### onRenderedFirstFrame

          public final void onRenderedFirstFrame​(Object output,
                                                 long renderTimeMs)

      Description copied from interface: `AnalyticsCollector`
      Called when a frame is rendered for the first time since setting the output, or since the renderer was reset, or since the stream being rendered was changed.
      Specified by:
        `onRenderedFirstFrame` in interface `AnalyticsCollector`
      Parameters:
        `output` - The output of the video renderer. Normally a `Surface`, however some video renderers may have other output types (e.g., a `VideoDecoderOutputBufferRenderer`).
        `renderTimeMs` - The `SystemClock.elapsedRealtime()` when the frame was rendered.

    - #### onVideoFrameProcessingOffset

          public final void onVideoFrameProcessingOffset​(long totalProcessingOffsetUs,
                                                         int frameCount)

      Description copied from interface: `AnalyticsCollector`
      Called to report the video processing offset of video frames processed by the video renderer.

      Video processing offset represents how early a video frame is processed compared to the player's current position. For each video frame, the offset is calculated as Pvf - Ppl where Pvf is the presentation timestamp of the video frame and Ppl is the current position of the player. Positive values indicate the frame was processed early enough whereas negative values indicate that the player's position had progressed beyond the frame's timestamp when the frame was processed (and the frame was probably dropped).

      The renderer reports the sum of video processing offset samples (one sample per processed video frame: dropped, skipped or rendered) and the total number of samples.

      Specified by:
        `onVideoFrameProcessingOffset` in interface `AnalyticsCollector`
      Parameters:
        `totalProcessingOffsetUs` - The sum of all video frame processing offset samples for the video frames processed by the renderer in microseconds.
        `frameCount` - The number of samples included in the `totalProcessingOffsetUs`.

    - #### onVideoCodecError

          public final void onVideoCodecError​(Exception videoCodecError)

      Description copied from interface: `AnalyticsCollector`
      Called when a video decoder encounters an error.

      This method being called does not indicate that playback has failed, or that it will fail. The player may be able to recover from the error. Hence applications should not implement this method to display a user visible error or initiate an application level retry. `Player.Listener.onPlayerError(com.google.android.exoplayer2.PlaybackException)` is the appropriate place to implement such behavior. This method is called to provide the application with an opportunity to log the error if it wishes to do so.

      Specified by:
        `onVideoCodecError` in interface `AnalyticsCollector`
      Parameters:
        `videoCodecError` - The error. Typically a `MediaCodec.CodecException` if the renderer uses `MediaCodec`, or a `DecoderException` if the renderer uses a software decoder.

    - #### onSurfaceSizeChanged

          public final void onSurfaceSizeChanged​(int width,
                                                 int height)

      Description copied from interface: `Player.Listener`
      Called each time there's a change in the size of the surface onto which the video is being rendered.

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

      Specified by:
        `onSurfaceSizeChanged` in interface `Player.Listener`
      Parameters:
        `width` - The surface width in pixels. May be `C.LENGTH_UNSET` if unknown, or 0 if the video is not rendered onto a surface.
        `height` - The surface height in pixels. May be `C.LENGTH_UNSET` if unknown, or 0 if the video is not rendered onto a surface.

    - #### onLoadStarted

          public final void onLoadStarted​(int windowIndex,
                                          @Nullable
                                          MediaSource.MediaPeriodId mediaPeriodId,
                                          LoadEventInfo loadEventInfo,
                                          MediaLoadData mediaLoadData)

      Description copied from interface: `MediaSourceEventListener`
      Called when a load begins.
      Specified by:
        `onLoadStarted` in interface `MediaSourceEventListener`
      Parameters:
        `windowIndex` - The window index in the timeline of the media source this load belongs to.
        `mediaPeriodId` - The `MediaSource.MediaPeriodId` this load belongs to. Null if the load does not belong to a specific media period.
        `loadEventInfo` - The `LoadEventInfo` corresponding to the event. The value of `LoadEventInfo.uri` won't reflect potential redirection yet and `LoadEventInfo.responseHeaders` will be empty.
        `mediaLoadData` - The `MediaLoadData` defining the data being loaded.

    - #### onLoadCompleted

          public final void onLoadCompleted​(int windowIndex,
                                            @Nullable
                                            MediaSource.MediaPeriodId mediaPeriodId,
                                            LoadEventInfo loadEventInfo,
                                            MediaLoadData mediaLoadData)

      Description copied from interface: `MediaSourceEventListener`
      Called when a load ends.
      Specified by:
        `onLoadCompleted` in interface `MediaSourceEventListener`
      Parameters:
        `windowIndex` - The window index in the timeline of the media source this load belongs to.
        `mediaPeriodId` - The `MediaSource.MediaPeriodId` this load belongs to. Null if the load does not belong to a specific media period.
        `loadEventInfo` - The `LoadEventInfo` corresponding to the event. The values of `LoadEventInfo.elapsedRealtimeMs` and `LoadEventInfo.bytesLoaded` are relative to the corresponding `MediaSourceEventListener.onLoadStarted(int, MediaPeriodId, LoadEventInfo, MediaLoadData)` event.
        `mediaLoadData` - The `MediaLoadData` defining the data being loaded.

    - #### onLoadCanceled

          public final void onLoadCanceled​(int windowIndex,
                                           @Nullable
                                           MediaSource.MediaPeriodId mediaPeriodId,
                                           LoadEventInfo loadEventInfo,
                                           MediaLoadData mediaLoadData)

      Description copied from interface: `MediaSourceEventListener`
      Called when a load is canceled.
      Specified by:
        `onLoadCanceled` in interface `MediaSourceEventListener`
      Parameters:
        `windowIndex` - The window index in the timeline of the media source this load belongs to.
        `mediaPeriodId` - The `MediaSource.MediaPeriodId` this load belongs to. Null if the load does not belong to a specific media period.
        `loadEventInfo` - The `LoadEventInfo` corresponding to the event. The values of `LoadEventInfo.elapsedRealtimeMs` and `LoadEventInfo.bytesLoaded` are relative to the corresponding `MediaSourceEventListener.onLoadStarted(int, MediaPeriodId, LoadEventInfo, MediaLoadData)` event.
        `mediaLoadData` - The `MediaLoadData` defining the data being loaded.

    - #### onLoadError

          public final void onLoadError​(int windowIndex,
                                        @Nullable
                                        MediaSource.MediaPeriodId mediaPeriodId,
                                        LoadEventInfo loadEventInfo,
                                        MediaLoadData mediaLoadData,
                                        IOException error,
                                        boolean wasCanceled)

      Description copied from interface: `MediaSourceEventListener`
      Called when a load error occurs.

      The error may or may not have resulted in the load being canceled, as indicated by the `wasCanceled` parameter. If the load was canceled, `MediaSourceEventListener.onLoadCanceled(int, com.google.android.exoplayer2.source.MediaSource.MediaPeriodId, com.google.android.exoplayer2.source.LoadEventInfo, com.google.android.exoplayer2.source.MediaLoadData)` will not be called in addition to this method.

      This method being called does not indicate that playback has failed, or that it will fail. The player may be able to recover from the error. Hence applications should not implement this method to display a user visible error or initiate an application level retry. `Player.Listener.onPlayerError(com.google.android.exoplayer2.PlaybackException)` is the appropriate place to implement such behavior. This method is called to provide the application with an opportunity to log the error if it wishes to do so.

      Specified by:
        `onLoadError` in interface `MediaSourceEventListener`
      Parameters:
        `windowIndex` - The window index in the timeline of the media source this load belongs to.
        `mediaPeriodId` - The `MediaSource.MediaPeriodId` this load belongs to. Null if the load does not belong to a specific media period.
        `loadEventInfo` - The `LoadEventInfo` corresponding to the event. The values of `LoadEventInfo.elapsedRealtimeMs` and `LoadEventInfo.bytesLoaded` are relative to the corresponding `MediaSourceEventListener.onLoadStarted(int, MediaPeriodId, LoadEventInfo, MediaLoadData)` event.
        `mediaLoadData` - The `MediaLoadData` defining the data being loaded.
        `error` - The load error.
        `wasCanceled` - Whether the load was canceled as a result of the error.

    - #### onUpstreamDiscarded

          public final void onUpstreamDiscarded​(int windowIndex,
                                                @Nullable
                                                MediaSource.MediaPeriodId mediaPeriodId,
                                                MediaLoadData mediaLoadData)

      Description copied from interface: `MediaSourceEventListener`
      Called when data is removed from the back of a media buffer, typically so that it can be re-buffered in a different format.
      Specified by:
        `onUpstreamDiscarded` in interface `MediaSourceEventListener`
      Parameters:
        `windowIndex` - The window index in the timeline of the media source this load belongs to.
        `mediaPeriodId` - The `MediaSource.MediaPeriodId` the media belongs to.
        `mediaLoadData` - The `MediaLoadData` defining the media being discarded.

    - #### onDownstreamFormatChanged

          public final void onDownstreamFormatChanged​(int windowIndex,
                                                      @Nullable
                                                      MediaSource.MediaPeriodId mediaPeriodId,
                                                      MediaLoadData mediaLoadData)

      Description copied from interface: `MediaSourceEventListener`
      Called when a downstream format change occurs (i.e. when the format of the media being read from one or more `SampleStream`s provided by the source changes).
      Specified by:
        `onDownstreamFormatChanged` in interface `MediaSourceEventListener`
      Parameters:
        `windowIndex` - The window index in the timeline of the media source this load belongs to.
        `mediaPeriodId` - The `MediaSource.MediaPeriodId` the media belongs to.
        `mediaLoadData` - The `MediaLoadData` defining the newly selected downstream data.

    - #### onTimelineChanged

          public final void onTimelineChanged​(Timeline timeline,
                                              @TimelineChangeReason
                                              @com.google.android.exoplayer2.Player.TimelineChangeReason int reason)

      Description copied from interface: `Player.Listener`
      Called when the value of `Player.getCurrentTimeline()` changes.

      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 `Player.Listener.onPositionDiscontinuity(PositionInfo, PositionInfo, int)` callback will be triggered.

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

      Specified by:
        `onTimelineChanged` in interface `Player.Listener`
      Parameters:
        `timeline` - The latest timeline. Never null, but may be empty.
        `reason` - The `Player.TimelineChangeReason` responsible for this timeline change.

    - #### onMediaItemTransition

          public final void onMediaItemTransition​(@Nullable
                                                  MediaItem mediaItem,
                                                  @MediaItemTransitionReason
                                                  @com.google.android.exoplayer2.Player.MediaItemTransitionReason int reason)

      Description copied from interface: `Player.Listener`
      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 value of `Player.getCurrentTimeline()` becomes non-empty or empty.

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

      Specified by:
        `onMediaItemTransition` in interface `Player.Listener`
      Parameters:
        `mediaItem` - The `MediaItem`. May be null if the playlist becomes empty.
        `reason` - The reason for the transition.

    - #### onTracksChanged

          public void onTracksChanged​(Tracks tracks)

      Description copied from interface: `Player.Listener`
      Called when the value of `Player.getCurrentTracks()` changes.

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

      Specified by:
        `onTracksChanged` in interface `Player.Listener`
      Parameters:
        `tracks` - The available tracks information. Never null, but may be of length zero.

    - #### onLoadingChanged

          public void onLoadingChanged​(boolean isLoading)

      Specified by:
        `onLoadingChanged` in interface `Player.Listener`

    - #### onIsLoadingChanged

          public final void onIsLoadingChanged​(boolean isLoading)

      Description copied from interface: `Player.Listener`
      Called when the player starts or stops loading the source.

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

      Specified by:
        `onIsLoadingChanged` in interface `Player.Listener`
      Parameters:
        `isLoading` - Whether the source is currently being loaded.

    - #### onAvailableCommandsChanged

          public void onAvailableCommandsChanged​(Player.Commands availableCommands)

      Description copied from interface: `Player.Listener`
      Called when the value returned from `Player.isCommandAvailable(int)` changes for at least one `Player.Command`.

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

      Specified by:
        `onAvailableCommandsChanged` in interface `Player.Listener`
      Parameters:
        `availableCommands` - The available `Player.Commands`.

    - #### onPlayerStateChanged

          public final void onPlayerStateChanged​(boolean playWhenReady,
                                                 @State
                                                 @com.google.android.exoplayer2.Player.State int playbackState)

      Specified by:
        `onPlayerStateChanged` in interface `Player.Listener`

    - #### onPlaybackStateChanged

          public final void onPlaybackStateChanged​(@State
                                                   @com.google.android.exoplayer2.Player.State int playbackState)

      Description copied from interface: `Player.Listener`
      Called when the value returned from `Player.getPlaybackState()` changes.

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

      Specified by:
        `onPlaybackStateChanged` in interface `Player.Listener`
      Parameters:
        `playbackState` - The new playback `Player.State`.

    - #### onPlayWhenReadyChanged

          public final void onPlayWhenReadyChanged​(boolean playWhenReady,
                                                   @PlayWhenReadyChangeReason
                                                   @com.google.android.exoplayer2.Player.PlayWhenReadyChangeReason int reason)

      Description copied from interface: `Player.Listener`
      Called when the value returned from `Player.getPlayWhenReady()` changes.

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

      Specified by:
        `onPlayWhenReadyChanged` in interface `Player.Listener`
      Parameters:
        `playWhenReady` - Whether playback will proceed when ready.
        `reason` - The `Player.PlayWhenReadyChangeReason` for the change.

    - #### onPlaybackSuppressionReasonChanged

          public final void onPlaybackSuppressionReasonChanged​(@PlaybackSuppressionReason
                                                               @com.google.android.exoplayer2.Player.PlaybackSuppressionReason int playbackSuppressionReason)

      Description copied from interface: `Player.Listener`
      Called when the value returned from `Player.getPlaybackSuppressionReason()` changes.

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

      Specified by:
        `onPlaybackSuppressionReasonChanged` in interface `Player.Listener`
      Parameters:
        `playbackSuppressionReason` - The current `Player.PlaybackSuppressionReason`.

    - #### onIsPlayingChanged

          public void onIsPlayingChanged​(boolean isPlaying)

      Description copied from interface: `Player.Listener`
      Called when the value of `Player.isPlaying()` changes.

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

      Specified by:
        `onIsPlayingChanged` in interface `Player.Listener`
      Parameters:
        `isPlaying` - Whether the player is playing.

    - #### onRepeatModeChanged

          public final void onRepeatModeChanged​(@RepeatMode
                                                @com.google.android.exoplayer2.Player.RepeatMode int repeatMode)

      Description copied from interface: `Player.Listener`
      Called when the value of `Player.getRepeatMode()` changes.

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

      Specified by:
        `onRepeatModeChanged` in interface `Player.Listener`
      Parameters:
        `repeatMode` - The `Player.RepeatMode` used for playback.

    - #### onShuffleModeEnabledChanged

          public final void onShuffleModeEnabledChanged​(boolean shuffleModeEnabled)

      Description copied from interface: `Player.Listener`
      Called when the value of `Player.getShuffleModeEnabled()` changes.

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

      Specified by:
        `onShuffleModeEnabledChanged` in interface `Player.Listener`
      Parameters:
        `shuffleModeEnabled` - Whether shuffling of media items is enabled.

    - #### onPlayerError

          public final void onPlayerError​(PlaybackException error)

      Description copied from interface: `Player.Listener`
      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.

      `Player.Listener.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.

      Specified by:
        `onPlayerError` in interface `Player.Listener`
      Parameters:
        `error` - The error.

    - #### onPlayerErrorChanged

          public void onPlayerErrorChanged​(@Nullable
                                           PlaybackException error)

      Description copied from interface: `Player.Listener`
      Called when the `PlaybackException` returned by `Player.getPlayerError()` changes.

      `Player.Listener.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.

      Specified by:
        `onPlayerErrorChanged` in interface `Player.Listener`
      Parameters:
        `error` - The new error, or null if the error is being cleared.

    - #### onPositionDiscontinuity

          public void onPositionDiscontinuity​(@DiscontinuityReason
                                              @com.google.android.exoplayer2.Player.DiscontinuityReason int reason)

      Specified by:
        `onPositionDiscontinuity` in interface `Player.Listener`

    - #### onPositionDiscontinuity

          public final void onPositionDiscontinuity​(Player.PositionInfo oldPosition,
                                                    Player.PositionInfo newPosition,
                                                    @DiscontinuityReason
                                                    @com.google.android.exoplayer2.Player.DiscontinuityReason int reason)

      Description copied from interface: `Player.Listener`
      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.

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

      Specified by:
        `onPositionDiscontinuity` in interface `Player.Listener`
      Parameters:
        `oldPosition` - The position before the discontinuity.
        `newPosition` - The position after the discontinuity.
        `reason` - The `Player.DiscontinuityReason` responsible for the discontinuity.

    - #### onPlaybackParametersChanged

          public final void onPlaybackParametersChanged​(PlaybackParameters playbackParameters)

      Description copied from interface: `Player.Listener`
      Called when the value of `Player.getPlaybackParameters()` changes. 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).

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

      Specified by:
        `onPlaybackParametersChanged` in interface `Player.Listener`
      Parameters:
        `playbackParameters` - The playback parameters.

    - #### onSeekBackIncrementChanged

          public void onSeekBackIncrementChanged​(long seekBackIncrementMs)

      Description copied from interface: `Player.Listener`
      Called when the value of `Player.getSeekBackIncrement()` changes.

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

      Specified by:
        `onSeekBackIncrementChanged` in interface `Player.Listener`
      Parameters:
        `seekBackIncrementMs` - The `Player.seekBack()` increment, in milliseconds.

    - #### onSeekForwardIncrementChanged

          public void onSeekForwardIncrementChanged​(long seekForwardIncrementMs)

      Description copied from interface: `Player.Listener`
      Called when the value of `Player.getSeekForwardIncrement()` changes.

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

      Specified by:
        `onSeekForwardIncrementChanged` in interface `Player.Listener`
      Parameters:
        `seekForwardIncrementMs` - The `Player.seekForward()` increment, in milliseconds.

    - #### onMaxSeekToPreviousPositionChanged

          public void onMaxSeekToPreviousPositionChanged​(long maxSeekToPreviousPositionMs)

      Description copied from interface: `Player.Listener`
      Called when the value of `Player.getMaxSeekToPreviousPosition()` changes.

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

      Specified by:
        `onMaxSeekToPreviousPositionChanged` in interface `Player.Listener`
      Parameters:
        `maxSeekToPreviousPositionMs` - The maximum position for which `Player.seekToPrevious()` seeks to the previous position, in milliseconds.

    - #### onMediaMetadataChanged

          public void onMediaMetadataChanged​(MediaMetadata mediaMetadata)

      Description copied from interface: `Player.Listener`
      Called when the value of `Player.getMediaMetadata()` changes.

      This method may be called multiple times in quick succession.

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

      Specified by:
        `onMediaMetadataChanged` in interface `Player.Listener`
      Parameters:
        `mediaMetadata` - The combined `MediaMetadata`.

    - #### onPlaylistMetadataChanged

          public void onPlaylistMetadataChanged​(MediaMetadata playlistMetadata)

      Description copied from interface: `Player.Listener`
      Called when the value of `Player.getPlaylistMetadata()` changes.

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

      Specified by:
        `onPlaylistMetadataChanged` in interface `Player.Listener`

    - #### onMetadata

          public final void onMetadata​(Metadata metadata)

      Description copied from interface: `Player.Listener`
      Called when there is metadata associated with the current playback time.

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

      Specified by:
        `onMetadata` in interface `Player.Listener`
      Parameters:
        `metadata` - The metadata.

    - #### onCues

          public void onCues​(List<Cue> cues)

      Description copied from interface: `Player.Listener`
      Called when the value of `Player.getCurrentCues()` changes.

      Both this method and `Player.Listener.onCues(CueGroup)` are called when there is a change in the cues. You should only implement one or the other.

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

      Specified by:
        `onCues` in interface `Player.Listener`

    - #### onCues

          public void onCues​(CueGroup cueGroup)

      Description copied from interface: `Player.Listener`
      Called when the value of `Player.getCurrentCues()` changes.

      Both this method and `Player.Listener.onCues(List)` are called when there is a change in the cues. You should only implement one or the other.

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

      Specified by:
        `onCues` in interface `Player.Listener`

    - #### onSeekProcessed

          public final void onSeekProcessed()

      Specified by:
        `onSeekProcessed` in interface `Player.Listener`

    - #### onSkipSilenceEnabledChanged

          public final void onSkipSilenceEnabledChanged​(boolean skipSilenceEnabled)

      Description copied from interface: `Player.Listener`
      Called when skipping silences is enabled or disabled in the audio stream.

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

      Specified by:
        `onSkipSilenceEnabledChanged` in interface `Player.Listener`
      Parameters:
        `skipSilenceEnabled` - Whether skipping silences in the audio stream is enabled.

    - #### onAudioSessionIdChanged

          public final void onAudioSessionIdChanged​(int audioSessionId)

      Description copied from interface: `Player.Listener`
      Called when the audio session ID changes.

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

      Specified by:
        `onAudioSessionIdChanged` in interface `Player.Listener`
      Parameters:
        `audioSessionId` - The audio session ID.

    - #### onAudioAttributesChanged

          public final void onAudioAttributesChanged​(AudioAttributes audioAttributes)

      Description copied from interface: `Player.Listener`
      Called when the value of `Player.getAudioAttributes()` changes.

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

      Specified by:
        `onAudioAttributesChanged` in interface `Player.Listener`
      Parameters:
        `audioAttributes` - The audio attributes.

    - #### onVideoSizeChanged

          public final void onVideoSizeChanged​(VideoSize videoSize)

      Description copied from interface: `Player.Listener`
      Called each time there's a change in the size of the video being rendered.

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

      Specified by:
        `onVideoSizeChanged` in interface `Player.Listener`
      Parameters:
        `videoSize` - The new size of the video.

    - #### onTrackSelectionParametersChanged

          public void onTrackSelectionParametersChanged​(TrackSelectionParameters parameters)

      Description copied from interface: `Player.Listener`
      Called when the value returned from `Player.getTrackSelectionParameters()` changes.

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

      Specified by:
        `onTrackSelectionParametersChanged` in interface `Player.Listener`
      Parameters:
        `parameters` - The new `TrackSelectionParameters`.

    - #### onDeviceInfoChanged

          public void onDeviceInfoChanged​(DeviceInfo deviceInfo)

      Description copied from interface: `Player.Listener`
      Called when the device information changes

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

      Specified by:
        `onDeviceInfoChanged` in interface `Player.Listener`
      Parameters:
        `deviceInfo` - The new `DeviceInfo`.

    - #### onDeviceVolumeChanged

          public void onDeviceVolumeChanged​(int volume,
                                            boolean muted)

      Description copied from interface: `Player.Listener`
      Called when the value of `Player.getDeviceVolume()` or `Player.isDeviceMuted()` changes.

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

      Specified by:
        `onDeviceVolumeChanged` in interface `Player.Listener`
      Parameters:
        `volume` - The new device volume, with 0 being silence and 1 being unity gain.
        `muted` - Whether the device is muted.

    - #### onRenderedFirstFrame

          public void onRenderedFirstFrame()

      Description copied from interface: `Player.Listener`
      Called when a frame is rendered for the first time since setting the surface, or since the renderer was reset, or since the stream being rendered was changed.

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

      Specified by:
        `onRenderedFirstFrame` in interface `Player.Listener`

    - #### onEvents

          public void onEvents​(Player player,
                               Player.Events events)

      Description copied from interface: `Player.Listener`
      Called when one or more player states changed.

      State changes and events that happen within one `Looper` message queue iteration are reported together and only after all individual callbacks were triggered.

      Listeners should prefer this method over individual callbacks in the following cases:

      - They intend to trigger the same logic for multiple events (e.g. when updating a UI for both `Player.Listener.onPlaybackStateChanged(int)` and `Player.Listener.onPlayWhenReadyChanged(boolean, int)`).
      - They need access to the `Player` object to trigger further events (e.g. to call `Player.seekTo(long)` after a `Player.Listener.onMediaItemTransition(MediaItem, int)`).
      - They intend to use multiple state values together or in combination with `Player` getter methods. For example using `Player.getCurrentMediaItemIndex()` with the `timeline` provided in `Player.Listener.onTimelineChanged(Timeline, int)` is only safe from within this method.
      - They are interested in events that logically happened together (e.g `Player.Listener.onPlaybackStateChanged(int)` to `Player.STATE_BUFFERING` because of `Player.Listener.onMediaItemTransition(MediaItem, int)`).
      Specified by:
        `onEvents` in interface `Player.Listener`
      Parameters:
        `player` - The `Player` whose state changed. Use the getters to obtain the latest states.
        `events` - The `Player.Events` that happened in this iteration, indicating which player states changed.

    - #### onBandwidthSample

          public final void onBandwidthSample​(int elapsedMs,
                                              long bytesTransferred,
                                              long bitrateEstimate)

      Description copied from interface: `BandwidthMeter.EventListener`
      Called periodically to indicate that bytes have been transferred or the estimated bitrate has changed.

      Note: The estimated bitrate is typically derived from more information than just `bytesTransferred` and `elapsedMs`.

      Specified by:
        `onBandwidthSample` in interface `BandwidthMeter.EventListener`
      Parameters:
        `elapsedMs` - The time taken to transfer `bytesTransferred`, in milliseconds. This is at most the elapsed time since the last callback, but may be less if there were periods during which data was not being transferred.
        `bytesTransferred` - The number of bytes transferred since the last callback.
        `bitrateEstimate` - The estimated bitrate in bits/sec.

    - #### onDrmSessionAcquired

          public final void onDrmSessionAcquired​(int windowIndex,
                                                 @Nullable
                                                 MediaSource.MediaPeriodId mediaPeriodId,
                                                 @State
                                                 @com.google.android.exoplayer2.drm.DrmSession.State int state)

      Description copied from interface: `DrmSessionEventListener`
      Called each time a drm session is acquired.
      Specified by:
        `onDrmSessionAcquired` in interface `DrmSessionEventListener`
      Parameters:
        `windowIndex` - The window index in the timeline this media period belongs to.
        `mediaPeriodId` - The `MediaSource.MediaPeriodId` associated with the drm session.
        `state` - The `DrmSession.State` of the session when the acquisition completed.

    - #### onDrmKeysLoaded

          public final void onDrmKeysLoaded​(int windowIndex,
                                            @Nullable
                                            MediaSource.MediaPeriodId mediaPeriodId)

      Description copied from interface: `DrmSessionEventListener`
      Called each time keys are loaded.
      Specified by:
        `onDrmKeysLoaded` in interface `DrmSessionEventListener`
      Parameters:
        `windowIndex` - The window index in the timeline this media period belongs to.
        `mediaPeriodId` - The `MediaSource.MediaPeriodId` associated with the drm session.

    - #### onDrmSessionManagerError

          public final void onDrmSessionManagerError​(int windowIndex,
                                                     @Nullable
                                                     MediaSource.MediaPeriodId mediaPeriodId,
                                                     Exception error)

      Description copied from interface: `DrmSessionEventListener`
      Called when a drm error occurs.

      This method being called does not indicate that playback has failed, or that it will fail. The player may be able to recover from the error and continue. Hence applications should not implement this method to display a user visible error or initiate an application level retry (`Player.Listener.onPlayerError(com.google.android.exoplayer2.PlaybackException)` is the appropriate place to implement such behavior). This method is called to provide the application with an opportunity to log the error if it wishes to do so.

      Specified by:
        `onDrmSessionManagerError` in interface `DrmSessionEventListener`
      Parameters:
        `windowIndex` - The window index in the timeline this media period belongs to.
        `mediaPeriodId` - The `MediaSource.MediaPeriodId` associated with the drm session.
        `error` - The corresponding exception.

    - #### onDrmKeysRestored

          public final void onDrmKeysRestored​(int windowIndex,
                                              @Nullable
                                              MediaSource.MediaPeriodId mediaPeriodId)

      Description copied from interface: `DrmSessionEventListener`
      Called each time offline keys are restored.
      Specified by:
        `onDrmKeysRestored` in interface `DrmSessionEventListener`
      Parameters:
        `windowIndex` - The window index in the timeline this media period belongs to.
        `mediaPeriodId` - The `MediaSource.MediaPeriodId` associated with the drm session.

    - #### onDrmKeysRemoved

          public final void onDrmKeysRemoved​(int windowIndex,
                                             @Nullable
                                             MediaSource.MediaPeriodId mediaPeriodId)

      Description copied from interface: `DrmSessionEventListener`
      Called each time offline keys are removed.
      Specified by:
        `onDrmKeysRemoved` in interface `DrmSessionEventListener`
      Parameters:
        `windowIndex` - The window index in the timeline this media period belongs to.
        `mediaPeriodId` - The `MediaSource.MediaPeriodId` associated with the drm session.

    - #### onDrmSessionReleased

          public final void onDrmSessionReleased​(int windowIndex,
                                                 @Nullable
                                                 MediaSource.MediaPeriodId mediaPeriodId)

      Description copied from interface: `DrmSessionEventListener`
      Called each time a drm session is released.
      Specified by:
        `onDrmSessionReleased` in interface `DrmSessionEventListener`
      Parameters:
        `windowIndex` - The window index in the timeline this media period belongs to.
        `mediaPeriodId` - The `MediaSource.MediaPeriodId` associated with the drm session.

    - #### sendEvent

          protected final void sendEvent​(AnalyticsListener.EventTime eventTime,
                                         int eventFlag,
                                         ListenerSet.Event<AnalyticsListener> eventInvocation)

      Sends an event to registered listeners.
      Parameters:
        `eventTime` - The `AnalyticsListener.EventTime` to report.
        `eventFlag` - An integer flag indicating the type of the event, or `C.INDEX_UNSET` to report this event without flag.
        `eventInvocation` - The event.

    - #### generateCurrentPlayerMediaPeriodEventTime

          protected final AnalyticsListener.EventTime generateCurrentPlayerMediaPeriodEventTime()

      Generates an `AnalyticsListener.EventTime` for the currently playing item in the player.

    - #### generateEventTime

          @RequiresNonNull("player")
          protected final AnalyticsListener.EventTime generateEventTime​(Timeline timeline,
                                                                        int windowIndex,
                                                                        @Nullable
                                                                        MediaSource.MediaPeriodId mediaPeriodId)

      Returns a new `AnalyticsListener.EventTime` for the specified timeline, window and media period id.