# DefaultAnalyticsCollector

Artifact: [androidx.media3:media3-exoplayer](https://developer.android.com/jetpack/androidx/releases/media3) [View Source](https://cs.android.com/search?q=file:androidx/media3/exoplayer/analytics/DefaultAnalyticsCollector.java+class:androidx.media3.exoplayer.analytics.DefaultAnalyticsCollector)

*** ** * ** ***


```
@UnstableApi
public class DefaultAnalyticsCollector implements AnalyticsCollector
```

<br />

*** ** * ** ***

Data collector that forwards analytics events to `https://developer.android.com/reference/androidx/media3/exoplayer/analytics/AnalyticsListener`.

## Summary

| ### Public constructors |
|---|
| `https://developer.android.com/reference/androidx/media3/exoplayer/analytics/DefaultAnalyticsCollector#DefaultAnalyticsCollector(androidx.media3.common.util.Clock)(https://developer.android.com/reference/androidx/media3/common/util/Clock clock)` Creates an analytics collector. |

| ### Public methods |
|---|---|
| `void` | `@https://developer.android.com/reference/androidx/annotation/CallSuper https://developer.android.com/reference/androidx/media3/exoplayer/analytics/DefaultAnalyticsCollector#addListener(androidx.media3.exoplayer.analytics.AnalyticsListener)(https://developer.android.com/reference/androidx/media3/exoplayer/analytics/AnalyticsListener listener)` Adds a listener for analytics events. |
| `final void` | `https://developer.android.com/reference/androidx/media3/exoplayer/analytics/DefaultAnalyticsCollector#notifySeekStarted()()` Notifies the analytics collector that a seek operation will start. |
| `final void` | `https://developer.android.com/reference/androidx/media3/exoplayer/analytics/DefaultAnalyticsCollector#onAudioAttributesChanged(androidx.media3.common.AudioAttributes)(https://developer.android.com/reference/androidx/media3/common/AudioAttributes audioAttributes)` Called when the value of `https://developer.android.com/reference/androidx/media3/common/Player#getAudioAttributes()` changes. |
| `final void` | `https://developer.android.com/reference/androidx/media3/exoplayer/analytics/DefaultAnalyticsCollector#onAudioCodecError(java.lang.Exception)(https://developer.android.com/reference/java/lang/Exception.html audioCodecError)` Called when an audio decoder encounters an error. |
| `final void` | `https://developer.android.com/reference/androidx/media3/exoplayer/analytics/DefaultAnalyticsCollector#onAudioDecoderInitialized(java.lang.String,long,long)( https://developer.android.com/reference/java/lang/String.html decoderName, long initializedTimestampMs, long initializationDurationMs )` Called when a audio decoder is created. |
| `final void` | `https://developer.android.com/reference/androidx/media3/exoplayer/analytics/DefaultAnalyticsCollector#onAudioDecoderReleased(java.lang.String)(https://developer.android.com/reference/java/lang/String.html decoderName)` Called when a audio decoder is released. |
| `final void` | `https://developer.android.com/reference/androidx/media3/exoplayer/analytics/DefaultAnalyticsCollector#onAudioDisabled(androidx.media3.exoplayer.DecoderCounters)(https://developer.android.com/reference/androidx/media3/exoplayer/DecoderCounters counters)` Called when the audio renderer is disabled. |
| `final void` | `https://developer.android.com/reference/androidx/media3/exoplayer/analytics/DefaultAnalyticsCollector#onAudioEnabled(androidx.media3.exoplayer.DecoderCounters)(https://developer.android.com/reference/androidx/media3/exoplayer/DecoderCounters counters)` Called when the audio renderer is enabled. |
| `final void` | `https://developer.android.com/reference/androidx/media3/exoplayer/analytics/DefaultAnalyticsCollector#onAudioInputFormatChanged(androidx.media3.common.Format,androidx.media3.exoplayer.DecoderReuseEvaluation)( https://developer.android.com/reference/androidx/media3/common/Format format, @https://developer.android.com/reference/androidx/annotation/Nullable https://developer.android.com/reference/androidx/media3/exoplayer/DecoderReuseEvaluation decoderReuseEvaluation )` Called when the format of the media being consumed by the audio renderer changes. |
| `final void` | `https://developer.android.com/reference/androidx/media3/exoplayer/analytics/DefaultAnalyticsCollector#onAudioPositionAdvancing(long)(long playoutStartSystemTimeMs)` Called when the audio position has increased for the first time since the last pause or position reset. |
| `final void` | `https://developer.android.com/reference/androidx/media3/exoplayer/analytics/DefaultAnalyticsCollector#onAudioSessionIdChanged(int)(int audioSessionId)` Called when the audio session ID changes. |
| `final void` | `https://developer.android.com/reference/androidx/media3/exoplayer/analytics/DefaultAnalyticsCollector#onAudioSinkError(java.lang.Exception)(https://developer.android.com/reference/java/lang/Exception.html audioSinkError)` Called when `https://developer.android.com/reference/androidx/media3/exoplayer/audio/AudioSink` has encountered an error. |
| `void` | `https://developer.android.com/reference/androidx/media3/exoplayer/analytics/DefaultAnalyticsCollector#onAudioTrackInitialized(androidx.media3.exoplayer.audio.AudioSink.AudioTrackConfig)(https://developer.android.com/reference/androidx/media3/exoplayer/audio/AudioSink.AudioTrackConfig audioTrackConfig)` Called when an `https://developer.android.com/reference/android/media/AudioTrack.html` has been initialized. |
| `void` | `https://developer.android.com/reference/androidx/media3/exoplayer/analytics/DefaultAnalyticsCollector#onAudioTrackReleased(androidx.media3.exoplayer.audio.AudioSink.AudioTrackConfig)(https://developer.android.com/reference/androidx/media3/exoplayer/audio/AudioSink.AudioTrackConfig audioTrackConfig)` Called when an `https://developer.android.com/reference/android/media/AudioTrack.html` has been released. |
| `final void` | `https://developer.android.com/reference/androidx/media3/exoplayer/analytics/DefaultAnalyticsCollector#onAudioUnderrun(int,long,long)( int bufferSize, long bufferSizeMs, long elapsedSinceLastFeedMs )` Called when an audio underrun occurs. |
| `void` | `https://developer.android.com/reference/androidx/media3/exoplayer/analytics/DefaultAnalyticsCollector#onAvailableCommandsChanged(androidx.media3.common.Player.Commands)(https://developer.android.com/reference/androidx/media3/common/Player.Commands availableCommands)` Called when the value returned from `https://developer.android.com/reference/androidx/media3/common/Player#isCommandAvailable(int)` changes for at least one `https://developer.android.com/reference/androidx/media3/common/Player.Command`. |
| `final void` | `https://developer.android.com/reference/androidx/media3/exoplayer/analytics/DefaultAnalyticsCollector#onBandwidthSample(int,long,long)( int elapsedMs, long bytesTransferred, long bitrateEstimate )` Called periodically to indicate that bytes have been transferred or the estimated bitrate has changed. |
| `void` | `https://developer.android.com/reference/androidx/media3/exoplayer/analytics/DefaultAnalyticsCollector#onCues(androidx.media3.common.text.CueGroup)(https://developer.android.com/reference/androidx/media3/common/text/CueGroup cueGroup)` Called when the value of `https://developer.android.com/reference/androidx/media3/common/Player#getCurrentCues()` changes. |
| `void` | `https://developer.android.com/reference/androidx/media3/exoplayer/analytics/DefaultAnalyticsCollector#onCues(java.util.List<androidx.media3.common.text.Cue>)(https://developer.android.com/reference/java/util/List.html<https://developer.android.com/reference/androidx/media3/common/text/Cue> cues)` **This method is deprecated.** Use `https://developer.android.com/reference/androidx/media3/common/Player.Listener#onCues(androidx.media3.common.text.CueGroup)` instead. <br /> |
| `void` | `https://developer.android.com/reference/androidx/media3/exoplayer/analytics/DefaultAnalyticsCollector#onDeviceInfoChanged(androidx.media3.common.DeviceInfo)(https://developer.android.com/reference/androidx/media3/common/DeviceInfo deviceInfo)` Called when the device information changes |
| `void` | `https://developer.android.com/reference/androidx/media3/exoplayer/analytics/DefaultAnalyticsCollector#onDeviceVolumeChanged(int,boolean)(int volume, boolean muted)` Called when the value of `https://developer.android.com/reference/androidx/media3/common/Player#getDeviceVolume()` or `https://developer.android.com/reference/androidx/media3/common/Player#isDeviceMuted()` changes. |
| `final void` | `https://developer.android.com/reference/androidx/media3/exoplayer/analytics/DefaultAnalyticsCollector#onDownstreamFormatChanged(int,androidx.media3.exoplayer.source.MediaSource.MediaPeriodId,androidx.media3.exoplayer.source.MediaLoadData)( int windowIndex, @https://developer.android.com/reference/androidx/annotation/Nullable https://developer.android.com/reference/androidx/media3/exoplayer/source/MediaSource.MediaPeriodId mediaPeriodId, https://developer.android.com/reference/androidx/media3/exoplayer/source/MediaLoadData mediaLoadData )` Called when a downstream format change occurs (i.e. when the format of the media being read from one or more `https://developer.android.com/reference/androidx/media3/exoplayer/source/SampleStream`s provided by the source changes). |
| `void` | `https://developer.android.com/reference/androidx/media3/exoplayer/analytics/DefaultAnalyticsCollector#onDrmKeysLoaded(int,androidx.media3.exoplayer.source.MediaSource.MediaPeriodId,androidx.media3.exoplayer.drm.KeyRequestInfo)( int windowIndex, @https://developer.android.com/reference/androidx/annotation/Nullable https://developer.android.com/reference/androidx/media3/exoplayer/source/MediaSource.MediaPeriodId mediaPeriodId, https://developer.android.com/reference/androidx/media3/exoplayer/drm/KeyRequestInfo keyRequestInfo )` Called each time keys are loaded. |
| `final void` | `https://developer.android.com/reference/androidx/media3/exoplayer/analytics/DefaultAnalyticsCollector#onDrmKeysRemoved(int,androidx.media3.exoplayer.source.MediaSource.MediaPeriodId)( int windowIndex, @https://developer.android.com/reference/androidx/annotation/Nullable https://developer.android.com/reference/androidx/media3/exoplayer/source/MediaSource.MediaPeriodId mediaPeriodId )` Called each time offline keys are removed. |
| `final void` | `https://developer.android.com/reference/androidx/media3/exoplayer/analytics/DefaultAnalyticsCollector#onDrmKeysRestored(int,androidx.media3.exoplayer.source.MediaSource.MediaPeriodId)( int windowIndex, @https://developer.android.com/reference/androidx/annotation/Nullable https://developer.android.com/reference/androidx/media3/exoplayer/source/MediaSource.MediaPeriodId mediaPeriodId )` Called each time offline keys are restored. |
| `final void` | `https://developer.android.com/reference/androidx/media3/exoplayer/analytics/DefaultAnalyticsCollector#onDrmSessionAcquired(int,androidx.media3.exoplayer.source.MediaSource.MediaPeriodId,int)( int windowIndex, @https://developer.android.com/reference/androidx/annotation/Nullable https://developer.android.com/reference/androidx/media3/exoplayer/source/MediaSource.MediaPeriodId mediaPeriodId, @https://developer.android.com/reference/androidx/media3/exoplayer/drm/DrmSession.State int state )` Called each time a drm session is acquired. |
| `final void` | `https://developer.android.com/reference/androidx/media3/exoplayer/analytics/DefaultAnalyticsCollector#onDrmSessionManagerError(int,androidx.media3.exoplayer.source.MediaSource.MediaPeriodId,java.lang.Exception)( int windowIndex, @https://developer.android.com/reference/androidx/annotation/Nullable https://developer.android.com/reference/androidx/media3/exoplayer/source/MediaSource.MediaPeriodId mediaPeriodId, https://developer.android.com/reference/java/lang/Exception.html error )` Called when a drm error occurs. |
| `final void` | `https://developer.android.com/reference/androidx/media3/exoplayer/analytics/DefaultAnalyticsCollector#onDrmSessionReleased(int,androidx.media3.exoplayer.source.MediaSource.MediaPeriodId)( int windowIndex, @https://developer.android.com/reference/androidx/annotation/Nullable https://developer.android.com/reference/androidx/media3/exoplayer/source/MediaSource.MediaPeriodId mediaPeriodId )` Called each time a drm session is released. |
| `final void` | `https://developer.android.com/reference/androidx/media3/exoplayer/analytics/DefaultAnalyticsCollector#onDroppedFrames(int,long)(int count, long elapsedMs)` Called to report the number of frames dropped by the video renderer. |
| `void` | `https://developer.android.com/reference/androidx/media3/exoplayer/analytics/DefaultAnalyticsCollector#onDroppedSeeksWhileScrubbing(int)(int droppedSeekCount)` Called when seeks are dropped when scrubbing. |
| `void` | `https://developer.android.com/reference/androidx/media3/exoplayer/analytics/DefaultAnalyticsCollector#onEvents(androidx.media3.common.Player,androidx.media3.common.Player.Events)(https://developer.android.com/reference/androidx/media3/common/Player player, https://developer.android.com/reference/androidx/media3/common/Player.Events events)` Called when one or more player states changed. |
| `final void` | `https://developer.android.com/reference/androidx/media3/exoplayer/analytics/DefaultAnalyticsCollector#onIsLoadingChanged(boolean)(boolean isLoading)` Called when the player starts or stops loading the source. |
| `void` | `https://developer.android.com/reference/androidx/media3/exoplayer/analytics/DefaultAnalyticsCollector#onIsPlayingChanged(boolean)(boolean isPlaying)` Called when the value of `https://developer.android.com/reference/androidx/media3/common/Player#isPlaying()` changes. |
| `final void` | `https://developer.android.com/reference/androidx/media3/exoplayer/analytics/DefaultAnalyticsCollector#onLoadCanceled(int,androidx.media3.exoplayer.source.MediaSource.MediaPeriodId,androidx.media3.exoplayer.source.LoadEventInfo,androidx.media3.exoplayer.source.MediaLoadData)( int windowIndex, @https://developer.android.com/reference/androidx/annotation/Nullable https://developer.android.com/reference/androidx/media3/exoplayer/source/MediaSource.MediaPeriodId mediaPeriodId, https://developer.android.com/reference/androidx/media3/exoplayer/source/LoadEventInfo loadEventInfo, https://developer.android.com/reference/androidx/media3/exoplayer/source/MediaLoadData mediaLoadData )` Called when a load is canceled. |
| `final void` | `https://developer.android.com/reference/androidx/media3/exoplayer/analytics/DefaultAnalyticsCollector#onLoadCompleted(int,androidx.media3.exoplayer.source.MediaSource.MediaPeriodId,androidx.media3.exoplayer.source.LoadEventInfo,androidx.media3.exoplayer.source.MediaLoadData)( int windowIndex, @https://developer.android.com/reference/androidx/annotation/Nullable https://developer.android.com/reference/androidx/media3/exoplayer/source/MediaSource.MediaPeriodId mediaPeriodId, https://developer.android.com/reference/androidx/media3/exoplayer/source/LoadEventInfo loadEventInfo, https://developer.android.com/reference/androidx/media3/exoplayer/source/MediaLoadData mediaLoadData )` Called when a load ends. |
| `final void` | `https://developer.android.com/reference/androidx/media3/exoplayer/analytics/DefaultAnalyticsCollector#onLoadError(int,androidx.media3.exoplayer.source.MediaSource.MediaPeriodId,androidx.media3.exoplayer.source.LoadEventInfo,androidx.media3.exoplayer.source.MediaLoadData,java.io.IOException,boolean)( int windowIndex, @https://developer.android.com/reference/androidx/annotation/Nullable https://developer.android.com/reference/androidx/media3/exoplayer/source/MediaSource.MediaPeriodId mediaPeriodId, https://developer.android.com/reference/androidx/media3/exoplayer/source/LoadEventInfo loadEventInfo, https://developer.android.com/reference/androidx/media3/exoplayer/source/MediaLoadData mediaLoadData, https://developer.android.com/reference/java/io/IOException.html error, boolean wasCanceled )` Called when a load error occurs. |
| `final void` | `https://developer.android.com/reference/androidx/media3/exoplayer/analytics/DefaultAnalyticsCollector#onLoadStarted(int,androidx.media3.exoplayer.source.MediaSource.MediaPeriodId,androidx.media3.exoplayer.source.LoadEventInfo,androidx.media3.exoplayer.source.MediaLoadData,int)( int windowIndex, @https://developer.android.com/reference/androidx/annotation/Nullable https://developer.android.com/reference/androidx/media3/exoplayer/source/MediaSource.MediaPeriodId mediaPeriodId, https://developer.android.com/reference/androidx/media3/exoplayer/source/LoadEventInfo loadEventInfo, https://developer.android.com/reference/androidx/media3/exoplayer/source/MediaLoadData mediaLoadData, int retryCount )` Called when a load begins. |
| `void` | `https://developer.android.com/reference/androidx/media3/exoplayer/analytics/DefaultAnalyticsCollector#onLoadingChanged(boolean)(boolean isLoading)` **This method is deprecated.** Use `https://developer.android.com/reference/androidx/media3/common/Player.Listener#onIsLoadingChanged(boolean)` instead. <br /> |
| `void` | `https://developer.android.com/reference/androidx/media3/exoplayer/analytics/DefaultAnalyticsCollector#onMaxSeekToPreviousPositionChanged(long)(long maxSeekToPreviousPositionMs)` Called when the value of `https://developer.android.com/reference/androidx/media3/common/Player#getMaxSeekToPreviousPosition()` changes. |
| `final void` | `https://developer.android.com/reference/androidx/media3/exoplayer/analytics/DefaultAnalyticsCollector#onMediaItemTransition(androidx.media3.common.MediaItem,int)( @https://developer.android.com/reference/androidx/annotation/Nullable https://developer.android.com/reference/androidx/media3/common/MediaItem mediaItem, @https://developer.android.com/reference/androidx/media3/common/Player.MediaItemTransitionReason int reason )` Called when playback transitions to a media item or starts repeating a media item according to the current `https://developer.android.com/reference/androidx/media3/common/Player#getRepeatMode()`. |
| `void` | `https://developer.android.com/reference/androidx/media3/exoplayer/analytics/DefaultAnalyticsCollector#onMediaMetadataChanged(androidx.media3.common.MediaMetadata)(https://developer.android.com/reference/androidx/media3/common/MediaMetadata mediaMetadata)` Called when the value of `https://developer.android.com/reference/androidx/media3/common/Player#getMediaMetadata()` changes. |
| `final void` | `https://developer.android.com/reference/androidx/media3/exoplayer/analytics/DefaultAnalyticsCollector#onMetadata(androidx.media3.common.Metadata)(https://developer.android.com/reference/androidx/media3/common/Metadata metadata)` Called when there is metadata associated with the current playback time. |
| `final void` | `https://developer.android.com/reference/androidx/media3/exoplayer/analytics/DefaultAnalyticsCollector#onPlayWhenReadyChanged(boolean,int)( boolean playWhenReady, @https://developer.android.com/reference/androidx/media3/common/Player.PlayWhenReadyChangeReason int reason )` Called when the value returned from `https://developer.android.com/reference/androidx/media3/common/Player#getPlayWhenReady()` changes. |
| `final void` | `https://developer.android.com/reference/androidx/media3/exoplayer/analytics/DefaultAnalyticsCollector#onPlaybackParametersChanged(androidx.media3.common.PlaybackParameters)(https://developer.android.com/reference/androidx/media3/common/PlaybackParameters playbackParameters)` Called when the value of `https://developer.android.com/reference/androidx/media3/common/Player#getPlaybackParameters()` changes. |
| `final void` | `https://developer.android.com/reference/androidx/media3/exoplayer/analytics/DefaultAnalyticsCollector#onPlaybackStateChanged(int)(@https://developer.android.com/reference/androidx/media3/common/Player.State int playbackState)` Called when the value returned from `https://developer.android.com/reference/androidx/media3/common/Player#getPlaybackState()` changes. |
| `final void` | `https://developer.android.com/reference/androidx/media3/exoplayer/analytics/DefaultAnalyticsCollector#onPlaybackSuppressionReasonChanged(int)( @https://developer.android.com/reference/androidx/media3/common/Player.PlaybackSuppressionReason int playbackSuppressionReason )` Called when the value returned from `https://developer.android.com/reference/androidx/media3/common/Player#getPlaybackSuppressionReason()` changes. |
| `final void` | `https://developer.android.com/reference/androidx/media3/exoplayer/analytics/DefaultAnalyticsCollector#onPlayerError(androidx.media3.common.PlaybackException)(https://developer.android.com/reference/androidx/media3/common/PlaybackException error)` Called when an error occurs. |
| `void` | `https://developer.android.com/reference/androidx/media3/exoplayer/analytics/DefaultAnalyticsCollector#onPlayerErrorChanged(androidx.media3.common.PlaybackException)(@https://developer.android.com/reference/androidx/annotation/Nullable https://developer.android.com/reference/androidx/media3/common/PlaybackException error)` Called when the `https://developer.android.com/reference/androidx/media3/common/PlaybackException` returned by `https://developer.android.com/reference/androidx/media3/common/Player#getPlayerError()` changes. |
| `final void` | `https://developer.android.com/reference/androidx/media3/exoplayer/analytics/DefaultAnalyticsCollector#onPlayerStateChanged(boolean,int)( boolean playWhenReady, @https://developer.android.com/reference/androidx/media3/common/Player.State int playbackState )` **This method is deprecated.** Use `https://developer.android.com/reference/androidx/media3/common/Player.Listener#onPlaybackStateChanged(int)` and `https://developer.android.com/reference/androidx/media3/common/Player.Listener#onPlayWhenReadyChanged(boolean,int)` instead. <br /> |
| `void` | `https://developer.android.com/reference/androidx/media3/exoplayer/analytics/DefaultAnalyticsCollector#onPlaylistMetadataChanged(androidx.media3.common.MediaMetadata)(https://developer.android.com/reference/androidx/media3/common/MediaMetadata playlistMetadata)` Called when the value of `https://developer.android.com/reference/androidx/media3/common/Player#getPlaylistMetadata()` changes. |
| `void` | `https://developer.android.com/reference/androidx/media3/exoplayer/analytics/DefaultAnalyticsCollector#onPositionDiscontinuity(int)(@https://developer.android.com/reference/androidx/media3/common/Player.DiscontinuityReason int reason)` **This method is deprecated.** Use `https://developer.android.com/reference/androidx/media3/common/Player.Listener#onPositionDiscontinuity(androidx.media3.common.Player.PositionInfo,androidx.media3.common.Player.PositionInfo,int)` instead. <br /> |
| `final void` | `https://developer.android.com/reference/androidx/media3/exoplayer/analytics/DefaultAnalyticsCollector#onPositionDiscontinuity(androidx.media3.common.Player.PositionInfo,androidx.media3.common.Player.PositionInfo,int)( https://developer.android.com/reference/androidx/media3/common/Player.PositionInfo oldPosition, https://developer.android.com/reference/androidx/media3/common/Player.PositionInfo newPosition, @https://developer.android.com/reference/androidx/media3/common/Player.DiscontinuityReason int reason )` Called when a position discontinuity occurs. |
| `void` | `https://developer.android.com/reference/androidx/media3/exoplayer/analytics/DefaultAnalyticsCollector#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. |
| `final void` | `https://developer.android.com/reference/androidx/media3/exoplayer/analytics/DefaultAnalyticsCollector#onRenderedFirstFrame(java.lang.Object,long)(https://developer.android.com/reference/java/lang/Object.html 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` | `https://developer.android.com/reference/androidx/media3/exoplayer/analytics/DefaultAnalyticsCollector#onRendererReadyChanged(int,int,boolean)( int rendererIndex, @https://developer.android.com/reference/androidx/media3/common/C.TrackType int rendererTrackType, boolean isRendererReady )` Called each time a renderer starts or stops allowing playback to be ready. |
| `final void` | `https://developer.android.com/reference/androidx/media3/exoplayer/analytics/DefaultAnalyticsCollector#onRepeatModeChanged(int)(@https://developer.android.com/reference/androidx/media3/common/Player.RepeatMode int repeatMode)` Called when the value of `https://developer.android.com/reference/androidx/media3/common/Player#getRepeatMode()` changes. |
| `void` | `https://developer.android.com/reference/androidx/media3/exoplayer/analytics/DefaultAnalyticsCollector#onSeekBackIncrementChanged(long)(long seekBackIncrementMs)` Called when the value of `https://developer.android.com/reference/androidx/media3/common/Player#getSeekBackIncrement()` changes. |
| `void` | `https://developer.android.com/reference/androidx/media3/exoplayer/analytics/DefaultAnalyticsCollector#onSeekForwardIncrementChanged(long)(long seekForwardIncrementMs)` Called when the value of `https://developer.android.com/reference/androidx/media3/common/Player#getSeekForwardIncrement()` changes. |
| `final void` | `https://developer.android.com/reference/androidx/media3/exoplayer/analytics/DefaultAnalyticsCollector#onShuffleModeEnabledChanged(boolean)(boolean shuffleModeEnabled)` Called when the value of `https://developer.android.com/reference/androidx/media3/common/Player#getShuffleModeEnabled()` changes. |
| `final void` | `https://developer.android.com/reference/androidx/media3/exoplayer/analytics/DefaultAnalyticsCollector#onSkipSilenceEnabledChanged(boolean)(boolean skipSilenceEnabled)` Called when skipping silences is enabled or disabled in the audio stream. |
| `final void` | `https://developer.android.com/reference/androidx/media3/exoplayer/analytics/DefaultAnalyticsCollector#onSurfaceSizeChanged(int,int)(int width, int height)` Called each time there's a change in the size of the surface onto which the video is being rendered. |
| `final void` | `https://developer.android.com/reference/androidx/media3/exoplayer/analytics/DefaultAnalyticsCollector#onTimelineChanged(androidx.media3.common.Timeline,int)( https://developer.android.com/reference/androidx/media3/common/Timeline timeline, @https://developer.android.com/reference/androidx/media3/common/Player.TimelineChangeReason int reason )` Called when the value of `https://developer.android.com/reference/androidx/media3/common/Player#getCurrentTimeline()` changes. |
| `void` | `https://developer.android.com/reference/androidx/media3/exoplayer/analytics/DefaultAnalyticsCollector#onTrackSelectionParametersChanged(androidx.media3.common.TrackSelectionParameters)(https://developer.android.com/reference/androidx/media3/common/TrackSelectionParameters parameters)` Called when the value returned from `https://developer.android.com/reference/androidx/media3/common/Player#getTrackSelectionParameters()` changes. |
| `void` | `https://developer.android.com/reference/androidx/media3/exoplayer/analytics/DefaultAnalyticsCollector#onTracksChanged(androidx.media3.common.Tracks)(https://developer.android.com/reference/androidx/media3/common/Tracks tracks)` Called when the value of `https://developer.android.com/reference/androidx/media3/common/Player#getCurrentTracks()` changes. |
| `final void` | `https://developer.android.com/reference/androidx/media3/exoplayer/analytics/DefaultAnalyticsCollector#onUpstreamDiscarded(int,androidx.media3.exoplayer.source.MediaSource.MediaPeriodId,androidx.media3.exoplayer.source.MediaLoadData)( int windowIndex, @https://developer.android.com/reference/androidx/annotation/Nullable https://developer.android.com/reference/androidx/media3/exoplayer/source/MediaSource.MediaPeriodId mediaPeriodId, https://developer.android.com/reference/androidx/media3/exoplayer/source/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. |
| `final void` | `https://developer.android.com/reference/androidx/media3/exoplayer/analytics/DefaultAnalyticsCollector#onVideoCodecError(java.lang.Exception)(https://developer.android.com/reference/java/lang/Exception.html videoCodecError)` Called when a video decoder encounters an error. |
| `final void` | `https://developer.android.com/reference/androidx/media3/exoplayer/analytics/DefaultAnalyticsCollector#onVideoDecoderInitialized(java.lang.String,long,long)( https://developer.android.com/reference/java/lang/String.html decoderName, long initializedTimestampMs, long initializationDurationMs )` Called when a video decoder is created. |
| `final void` | `https://developer.android.com/reference/androidx/media3/exoplayer/analytics/DefaultAnalyticsCollector#onVideoDecoderReleased(java.lang.String)(https://developer.android.com/reference/java/lang/String.html decoderName)` Called when a video decoder is released. |
| `final void` | `https://developer.android.com/reference/androidx/media3/exoplayer/analytics/DefaultAnalyticsCollector#onVideoDisabled(androidx.media3.exoplayer.DecoderCounters)(https://developer.android.com/reference/androidx/media3/exoplayer/DecoderCounters counters)` Called when the video renderer is disabled. |
| `final void` | `https://developer.android.com/reference/androidx/media3/exoplayer/analytics/DefaultAnalyticsCollector#onVideoEnabled(androidx.media3.exoplayer.DecoderCounters)(https://developer.android.com/reference/androidx/media3/exoplayer/DecoderCounters counters)` Called when the video renderer is enabled. |
| `final void` | `https://developer.android.com/reference/androidx/media3/exoplayer/analytics/DefaultAnalyticsCollector#onVideoFrameProcessingOffset(long,int)( long totalProcessingOffsetUs, int frameCount )` Called to report the video processing offset of video frames processed by the video renderer. |
| `final void` | `https://developer.android.com/reference/androidx/media3/exoplayer/analytics/DefaultAnalyticsCollector#onVideoInputFormatChanged(androidx.media3.common.Format,androidx.media3.exoplayer.DecoderReuseEvaluation)( https://developer.android.com/reference/androidx/media3/common/Format format, @https://developer.android.com/reference/androidx/annotation/Nullable https://developer.android.com/reference/androidx/media3/exoplayer/DecoderReuseEvaluation decoderReuseEvaluation )` Called when the format of the media being consumed by the video renderer changes. |
| `final void` | `https://developer.android.com/reference/androidx/media3/exoplayer/analytics/DefaultAnalyticsCollector#onVideoSizeChanged(androidx.media3.common.VideoSize)(https://developer.android.com/reference/androidx/media3/common/VideoSize videoSize)` Called each time when `https://developer.android.com/reference/androidx/media3/common/Player#getVideoSize()` changes. |
| `final void` | `https://developer.android.com/reference/androidx/media3/exoplayer/analytics/DefaultAnalyticsCollector#onVolumeChanged(float)(float volume)` Called when the value of `https://developer.android.com/reference/androidx/media3/common/Player#getVolume()` changes. |
| `void` | `@https://developer.android.com/reference/androidx/annotation/CallSuper https://developer.android.com/reference/androidx/media3/exoplayer/analytics/DefaultAnalyticsCollector#release()()` Releases the collector. |
| `void` | `@https://developer.android.com/reference/androidx/annotation/CallSuper https://developer.android.com/reference/androidx/media3/exoplayer/analytics/DefaultAnalyticsCollector#removeListener(androidx.media3.exoplayer.analytics.AnalyticsListener)(https://developer.android.com/reference/androidx/media3/exoplayer/analytics/AnalyticsListener listener)` Removes a previously added analytics event listener. |
| `void` | `@https://developer.android.com/reference/androidx/annotation/CallSuper https://developer.android.com/reference/androidx/media3/exoplayer/analytics/DefaultAnalyticsCollector#setPlayer(androidx.media3.common.Player,android.os.Looper)(https://developer.android.com/reference/androidx/media3/common/Player player, https://developer.android.com/reference/android/os/Looper.html looper)` Sets the player for which data will be collected. |
| `void` | `[setThrowsWhenUsingWrongThread](https://developer.android.com/reference/androidx/media3/exoplayer/analytics/DefaultAnalyticsCollector#setThrowsWhenUsingWrongThread(boolean))(boolean throwsWhenUsingWrongThread)` **This method is deprecated.** Do not use this method and ensure all calls are made from the correct thread. <br /> |
| `final void` | `https://developer.android.com/reference/androidx/media3/exoplayer/analytics/DefaultAnalyticsCollector#updateMediaPeriodQueueInfo(java.util.List<androidx.media3.exoplayer.source.MediaSource.MediaPeriodId>,androidx.media3.exoplayer.source.MediaSource.MediaPeriodId)( https://developer.android.com/reference/java/util/List.html<https://developer.android.com/reference/androidx/media3/exoplayer/source/MediaSource.MediaPeriodId> queue, @https://developer.android.com/reference/androidx/annotation/Nullable https://developer.android.com/reference/androidx/media3/exoplayer/source/MediaSource.MediaPeriodId readingPeriod )` Updates the playback queue information used for event association. |

| ### Protected methods |
|---|---|
| `final https://developer.android.com/reference/androidx/media3/exoplayer/analytics/AnalyticsListener.EventTime` | `https://developer.android.com/reference/androidx/media3/exoplayer/analytics/DefaultAnalyticsCollector#generateCurrentPlayerMediaPeriodEventTime()()` Generates an `https://developer.android.com/reference/androidx/media3/exoplayer/analytics/AnalyticsListener.EventTime` for the currently playing item in the player. |
| `final https://developer.android.com/reference/androidx/media3/exoplayer/analytics/AnalyticsListener.EventTime` | `@https://checkerframework.org/api/org/checkerframework/checker/nullness/qual/RequiresNonNull.html(value = "player") https://developer.android.com/reference/androidx/media3/exoplayer/analytics/DefaultAnalyticsCollector#generateEventTime(androidx.media3.common.Timeline,int,androidx.media3.exoplayer.source.MediaSource.MediaPeriodId)( https://developer.android.com/reference/androidx/media3/common/Timeline timeline, int windowIndex, @https://developer.android.com/reference/androidx/annotation/Nullable https://developer.android.com/reference/androidx/media3/exoplayer/source/MediaSource.MediaPeriodId mediaPeriodId )` Returns a new `https://developer.android.com/reference/androidx/media3/exoplayer/analytics/AnalyticsListener.EventTime` for the specified timeline, window and media period id. |
| `final void` | `https://developer.android.com/reference/androidx/media3/exoplayer/analytics/DefaultAnalyticsCollector#sendEvent(androidx.media3.exoplayer.analytics.AnalyticsListener.EventTime,int,androidx.media3.common.util.ListenerSet.Event<androidx.media3.exoplayer.analytics.AnalyticsListener>)( https://developer.android.com/reference/androidx/media3/exoplayer/analytics/AnalyticsListener.EventTime eventTime, int eventFlag, https://developer.android.com/reference/androidx/media3/common/util/ListenerSet.Event<https://developer.android.com/reference/androidx/media3/exoplayer/analytics/AnalyticsListener> eventInvocation )` Sends an event to registered listeners. |

| ### Inherited methods |
|---|
| From [androidx.media3.exoplayer.drm.DrmSessionEventListener](https://developer.android.com/reference/androidx/media3/exoplayer/drm/DrmSessionEventListener) |---|---| | `void` | `[onDrmKeysLoaded](https://developer.android.com/reference/androidx/media3/exoplayer/drm/DrmSessionEventListener#onDrmKeysLoaded(int,androidx.media3.exoplayer.source.MediaSource.MediaPeriodId))( int windowIndex, @https://developer.android.com/reference/androidx/annotation/Nullable https://developer.android.com/reference/androidx/media3/exoplayer/source/MediaSource.MediaPeriodId mediaPeriodId )` **This method is deprecated.** Implement `https://developer.android.com/reference/androidx/media3/exoplayer/drm/DrmSessionEventListener#onDrmKeysLoaded(int,androidx.media3.exoplayer.source.MediaSource.MediaPeriodId,androidx.media3.exoplayer.drm.KeyRequestInfo)` instead <br /> | |

## Public constructors

### DefaultAnalyticsCollector

```
public DefaultAnalyticsCollector(Clock clock)
```

Creates an analytics collector.

| Parameters |
|---|---|
| `https://developer.android.com/reference/androidx/media3/common/util/Clock clock` | A `https://developer.android.com/reference/androidx/media3/common/util/Clock` used to generate timestamps. |

## Public methods

### addListener

```
@CallSuper
public void addListener(AnalyticsListener listener)
```

Adds a listener for analytics events.

| Parameters |
|---|---|
| `https://developer.android.com/reference/androidx/media3/exoplayer/analytics/AnalyticsListener listener` | The listener to add. |

### notifySeekStarted

```
public final void notifySeekStarted()
```

Notifies the analytics collector that a seek operation will start. Should be called before the player adjusts its state and position to the seek.

### onAudioAttributesChanged

```
public final void onAudioAttributesChanged(AudioAttributes audioAttributes)
```

Called when the value of `https://developer.android.com/reference/androidx/media3/common/Player#getAudioAttributes()` changes.

`https://developer.android.com/reference/androidx/media3/common/Player.Listener#onEvents(androidx.media3.common.Player,androidx.media3.common.Player.Events)` will also be called to report this event along with other events that happen in the same `https://developer.android.com/reference/android/os/Looper.html` message queue iteration.

| Parameters |
|---|---|
| `https://developer.android.com/reference/androidx/media3/common/AudioAttributes audioAttributes` | The audio attributes. |

### onAudioCodecError

```
public final void onAudioCodecError(Exception audioCodecError)
```

Called when an audio decoder encounters an error.

| Parameters |
|---|---|
| `https://developer.android.com/reference/java/lang/Exception.html audioCodecError` | The error. Typically a `https://developer.android.com/reference/android/media/MediaCodec.CodecException.html` if the renderer uses `https://developer.android.com/reference/android/media/MediaCodec.html`, or a `https://developer.android.com/reference/androidx/media3/decoder/DecoderException` if the renderer uses a software decoder. |

### onAudioDecoderInitialized

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

Called when a audio decoder is created.

| Parameters |
|---|---|
| `https://developer.android.com/reference/java/lang/String.html decoderName` | The audio decoder that was created. |
| `long initializedTimestampMs` | `https://developer.android.com/reference/android/os/SystemClock.html#elapsedRealtime()` when initialization finished. |
| `long initializationDurationMs` | The time taken to initialize the decoder in milliseconds. |

### onAudioDecoderReleased

```
public final void onAudioDecoderReleased(String decoderName)
```

Called when a audio decoder is released.

| Parameters |
|---|---|
| `https://developer.android.com/reference/java/lang/String.html decoderName` | The audio decoder that was released. |

### onAudioDisabled

```
public final void onAudioDisabled(DecoderCounters counters)
```

Called when the audio renderer is disabled.

| Parameters |
|---|---|
| `https://developer.android.com/reference/androidx/media3/exoplayer/DecoderCounters counters` | `https://developer.android.com/reference/androidx/media3/exoplayer/DecoderCounters` that were updated by the audio renderer. |

### onAudioEnabled

```
public final void onAudioEnabled(DecoderCounters counters)
```

Called when the audio renderer is enabled.

| Parameters |
|---|---|
| `https://developer.android.com/reference/androidx/media3/exoplayer/DecoderCounters counters` | `https://developer.android.com/reference/androidx/media3/exoplayer/DecoderCounters` that will be updated by the audio renderer for as long as it remains enabled. |

### onAudioInputFormatChanged

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

Called when the format of the media being consumed by the audio renderer changes.

| Parameters |
|---|---|
| `https://developer.android.com/reference/androidx/media3/common/Format format` | The new format. |
| `@https://developer.android.com/reference/androidx/annotation/Nullable https://developer.android.com/reference/androidx/media3/exoplayer/DecoderReuseEvaluation 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)
```

Called when the audio position has increased for the first time since the last pause or position reset.

| Parameters |
|---|---|
| `long playoutStartSystemTimeMs` | The approximate derived `https://developer.android.com/reference/java/lang/System.html#currentTimeMillis()` at which playout started. |

### onAudioSessionIdChanged

```
public final void onAudioSessionIdChanged(int audioSessionId)
```

Called when the audio session ID changes.

`https://developer.android.com/reference/androidx/media3/common/Player.Listener#onEvents(androidx.media3.common.Player,androidx.media3.common.Player.Events)` will also be called to report this event along with other events that happen in the same `https://developer.android.com/reference/android/os/Looper.html` message queue iteration.

| Parameters |
|---|---|
| `int audioSessionId` | The audio session ID. |

### onAudioSinkError

```
public final void onAudioSinkError(Exception audioSinkError)
```

Called when `https://developer.android.com/reference/androidx/media3/exoplayer/audio/AudioSink` has encountered an error.

If the sink writes to a platform `https://developer.android.com/reference/android/media/AudioTrack.html`, this will be called for all `https://developer.android.com/reference/android/media/AudioTrack.html` errors.

| Parameters |
|---|---|
| `https://developer.android.com/reference/java/lang/Exception.html audioSinkError` | The error that occurred. Typically an `https://developer.android.com/reference/androidx/media3/exoplayer/audio/AudioSink.InitializationException`, a `https://developer.android.com/reference/androidx/media3/exoplayer/audio/AudioSink.WriteException`, or an `https://developer.android.com/reference/androidx/media3/exoplayer/audio/AudioSink.UnexpectedDiscontinuityException`. |

### onAudioTrackInitialized

```
public void onAudioTrackInitialized(AudioSink.AudioTrackConfig audioTrackConfig)
```

Called when an `https://developer.android.com/reference/android/media/AudioTrack.html` has been initialized.

| Parameters |
|---|---|
| `https://developer.android.com/reference/androidx/media3/exoplayer/audio/AudioSink.AudioTrackConfig audioTrackConfig` | The `https://developer.android.com/reference/androidx/media3/exoplayer/audio/AudioSink.AudioTrackConfig` of the initialized `https://developer.android.com/reference/android/media/AudioTrack.html`. |

### onAudioTrackReleased

```
public void onAudioTrackReleased(AudioSink.AudioTrackConfig audioTrackConfig)
```

Called when an `https://developer.android.com/reference/android/media/AudioTrack.html` has been released.

| Parameters |
|---|---|
| `https://developer.android.com/reference/androidx/media3/exoplayer/audio/AudioSink.AudioTrackConfig audioTrackConfig` | The `https://developer.android.com/reference/androidx/media3/exoplayer/audio/AudioSink.AudioTrackConfig` of the released `https://developer.android.com/reference/android/media/AudioTrack.html`. |

### onAudioUnderrun

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

Called when an audio underrun occurs.

| Parameters |
|---|---|
| `int bufferSize` | The size of the audio output buffer, in bytes. |
| `long bufferSizeMs` | The size of the audio output buffer, in milliseconds, if it contains PCM encoded audio. `https://developer.android.com/reference/androidx/media3/common/C#TIME_UNSET()` if the output buffer contains non-PCM encoded audio. |
| `long elapsedSinceLastFeedMs` | The time since audio was last written to the output buffer. |

### onAvailableCommandsChanged

```
public void onAvailableCommandsChanged(Player.Commands availableCommands)
```

Called when the value returned from `https://developer.android.com/reference/androidx/media3/common/Player#isCommandAvailable(int)` changes for at least one `https://developer.android.com/reference/androidx/media3/common/Player.Command`.

`https://developer.android.com/reference/androidx/media3/common/Player.Listener#onEvents(androidx.media3.common.Player,androidx.media3.common.Player.Events)` will also be called to report this event along with other events that happen in the same `https://developer.android.com/reference/android/os/Looper.html` message queue iteration.

| Parameters |
|---|---|
| `https://developer.android.com/reference/androidx/media3/common/Player.Commands availableCommands` | The available `https://developer.android.com/reference/androidx/media3/common/Player.Commands`. |

### onBandwidthSample

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

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

| Parameters |
|---|---|
| `int 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. |
| `long bytesTransferred` | The number of bytes transferred since the last callback. |
| `long bitrateEstimate` | The estimated bitrate in bits/sec. |

### onCues

```
public void onCues(CueGroup cueGroup)
```

Called when the value of `https://developer.android.com/reference/androidx/media3/common/Player#getCurrentCues()` changes.

Both this method and `https://developer.android.com/reference/androidx/media3/common/Player.Listener#onCues(java.util.List<androidx.media3.common.text.Cue>)` are called when there is a change in the cues. You should only implement one or the other.

`https://developer.android.com/reference/androidx/media3/common/Player.Listener#onEvents(androidx.media3.common.Player,androidx.media3.common.Player.Events)` will also be called to report this event along with other events that happen in the same `https://developer.android.com/reference/android/os/Looper.html` message queue iteration.

### onCues

```
public void onCues(List<Cue> cues)
```

> [!CAUTION]
> **This method is deprecated.**   
>
> Use `https://developer.android.com/reference/androidx/media3/common/Player.Listener#onCues(androidx.media3.common.text.CueGroup)` instead.

Called when the value of `https://developer.android.com/reference/androidx/media3/common/Player#getCurrentCues()` changes.

Both this method and `https://developer.android.com/reference/androidx/media3/common/Player.Listener#onCues(androidx.media3.common.text.CueGroup)` are called when there is a change in the cues. You should only implement one or the other.

`https://developer.android.com/reference/androidx/media3/common/Player.Listener#onEvents(androidx.media3.common.Player,androidx.media3.common.Player.Events)` will also be called to report this event along with other events that happen in the same `https://developer.android.com/reference/android/os/Looper.html` message queue iteration.

### onDeviceInfoChanged

```
public void onDeviceInfoChanged(DeviceInfo deviceInfo)
```

Called when the device information changes

`https://developer.android.com/reference/androidx/media3/common/Player.Listener#onEvents(androidx.media3.common.Player,androidx.media3.common.Player.Events)` will also be called to report this event along with other events that happen in the same `https://developer.android.com/reference/android/os/Looper.html` message queue iteration.

| Parameters |
|---|---|
| `https://developer.android.com/reference/androidx/media3/common/DeviceInfo deviceInfo` | The new `https://developer.android.com/reference/androidx/media3/common/DeviceInfo`. |

### onDeviceVolumeChanged

```
public void onDeviceVolumeChanged(int volume, boolean muted)
```

Called when the value of `https://developer.android.com/reference/androidx/media3/common/Player#getDeviceVolume()` or `https://developer.android.com/reference/androidx/media3/common/Player#isDeviceMuted()` changes.

`https://developer.android.com/reference/androidx/media3/common/Player.Listener#onEvents(androidx.media3.common.Player,androidx.media3.common.Player.Events)` will also be called to report this event along with other events that happen in the same `https://developer.android.com/reference/android/os/Looper.html` message queue iteration.

| Parameters |
|---|---|
| `int volume` | The new device volume, with 0 being silence and 1 being unity gain. |
| `boolean muted` | Whether the device is muted. |

### onDownstreamFormatChanged

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

Called when a downstream format change occurs (i.e. when the format of the media being read from one or more `https://developer.android.com/reference/androidx/media3/exoplayer/source/SampleStream`s provided by the source changes).

| Parameters |
|---|---|
| `int windowIndex` | The window index in the timeline of the media source this load belongs to. |
| `@https://developer.android.com/reference/androidx/annotation/Nullable https://developer.android.com/reference/androidx/media3/exoplayer/source/MediaSource.MediaPeriodId mediaPeriodId` | The `https://developer.android.com/reference/androidx/media3/exoplayer/source/MediaSource.MediaPeriodId` the media belongs to. |
| `https://developer.android.com/reference/androidx/media3/exoplayer/source/MediaLoadData mediaLoadData` | The `https://developer.android.com/reference/androidx/media3/exoplayer/source/MediaLoadData` defining the newly selected downstream data. |

### onDrmKeysLoaded

```
public void onDrmKeysLoaded(
    int windowIndex,
    @Nullable MediaSource.MediaPeriodId mediaPeriodId,
    KeyRequestInfo keyRequestInfo
)
```

Called each time keys are loaded.

| Parameters |
|---|---|
| `int windowIndex` | The window index in the timeline this media period belongs to. |
| `@https://developer.android.com/reference/androidx/annotation/Nullable https://developer.android.com/reference/androidx/media3/exoplayer/source/MediaSource.MediaPeriodId mediaPeriodId` | The `https://developer.android.com/reference/androidx/media3/exoplayer/source/MediaSource.MediaPeriodId` associated with the drm session. |
| `https://developer.android.com/reference/androidx/media3/exoplayer/drm/KeyRequestInfo keyRequestInfo` | The `https://developer.android.com/reference/androidx/media3/exoplayer/drm/KeyRequestInfo` with load info for the drm server requests |

### onDrmKeysRemoved

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

Called each time offline keys are removed.

| Parameters |
|---|---|
| `int windowIndex` | The window index in the timeline this media period belongs to. |
| `@https://developer.android.com/reference/androidx/annotation/Nullable https://developer.android.com/reference/androidx/media3/exoplayer/source/MediaSource.MediaPeriodId mediaPeriodId` | The `https://developer.android.com/reference/androidx/media3/exoplayer/source/MediaSource.MediaPeriodId` associated with the drm session. |

### onDrmKeysRestored

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

Called each time offline keys are restored.

| Parameters |
|---|---|
| `int windowIndex` | The window index in the timeline this media period belongs to. |
| `@https://developer.android.com/reference/androidx/annotation/Nullable https://developer.android.com/reference/androidx/media3/exoplayer/source/MediaSource.MediaPeriodId mediaPeriodId` | The `https://developer.android.com/reference/androidx/media3/exoplayer/source/MediaSource.MediaPeriodId` associated with the drm session. |

### onDrmSessionAcquired

```
public final void onDrmSessionAcquired(
    int windowIndex,
    @Nullable MediaSource.MediaPeriodId mediaPeriodId,
    @DrmSession.State int state
)
```

Called each time a drm session is acquired.

| Parameters |
|---|---|
| `int windowIndex` | The window index in the timeline this media period belongs to. |
| `@https://developer.android.com/reference/androidx/annotation/Nullable https://developer.android.com/reference/androidx/media3/exoplayer/source/MediaSource.MediaPeriodId mediaPeriodId` | The `https://developer.android.com/reference/androidx/media3/exoplayer/source/MediaSource.MediaPeriodId` associated with the drm session. |
| `@https://developer.android.com/reference/androidx/media3/exoplayer/drm/DrmSession.State int state` | The `https://developer.android.com/reference/androidx/media3/exoplayer/drm/DrmSession.State` of the session when the acquisition completed. |

### onDrmSessionManagerError

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

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 (`https://developer.android.com/reference/androidx/media3/common/Player.Listener#onPlayerError(androidx.media3.common.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.

| Parameters |
|---|---|
| `int windowIndex` | The window index in the timeline this media period belongs to. |
| `@https://developer.android.com/reference/androidx/annotation/Nullable https://developer.android.com/reference/androidx/media3/exoplayer/source/MediaSource.MediaPeriodId mediaPeriodId` | The `https://developer.android.com/reference/androidx/media3/exoplayer/source/MediaSource.MediaPeriodId` associated with the drm session. |
| `https://developer.android.com/reference/java/lang/Exception.html error` | The corresponding exception. |

### onDrmSessionReleased

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

Called each time a drm session is released.

| Parameters |
|---|---|
| `int windowIndex` | The window index in the timeline this media period belongs to. |
| `@https://developer.android.com/reference/androidx/annotation/Nullable https://developer.android.com/reference/androidx/media3/exoplayer/source/MediaSource.MediaPeriodId mediaPeriodId` | The `https://developer.android.com/reference/androidx/media3/exoplayer/source/MediaSource.MediaPeriodId` associated with the drm session. |

### onDroppedFrames

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

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.

| Parameters |
|---|---|
| `int count` | The number of dropped frames. |
| `long 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. |

### onDroppedSeeksWhileScrubbing

```
public void onDroppedSeeksWhileScrubbing(int droppedSeekCount)
```

Called when seeks are dropped when scrubbing.

| Parameters |
|---|---|
| `int droppedSeekCount` | The number of dropped seeks. |

### onEvents

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

Called when one or more player states changed.

State changes and events that happen within one `https://developer.android.com/reference/android/os/Looper.html` 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 `https://developer.android.com/reference/androidx/media3/common/Player.Listener#onPlaybackStateChanged(int)` and `https://developer.android.com/reference/androidx/media3/common/Player.Listener#onPlayWhenReadyChanged(boolean,int)`).
- They need access to the `https://developer.android.com/reference/androidx/media3/common/Player` object to trigger further events (e.g. to call `https://developer.android.com/reference/androidx/media3/common/Player#seekTo(long)` after a `https://developer.android.com/reference/androidx/media3/common/Player.Listener#onMediaItemTransition(androidx.media3.common.MediaItem,int)`).
- They intend to use multiple state values together or in combination with `https://developer.android.com/reference/androidx/media3/common/Player` getter methods. For example using `https://developer.android.com/reference/androidx/media3/common/Player#getCurrentMediaItemIndex()` with the `
  timeline` provided in `https://developer.android.com/reference/androidx/media3/common/Player.Listener#onTimelineChanged(androidx.media3.common.Timeline,int)` is only safe from within this method.
- They are interested in events that logically happened together (e.g `https://developer.android.com/reference/androidx/media3/common/Player.Listener#onPlaybackStateChanged(int)` to `https://developer.android.com/reference/androidx/media3/common/Player#STATE_BUFFERING()` because of `https://developer.android.com/reference/androidx/media3/common/Player.Listener#onMediaItemTransition(androidx.media3.common.MediaItem,int)`).

| Parameters |
|---|---|
| `https://developer.android.com/reference/androidx/media3/common/Player player` | The `https://developer.android.com/reference/androidx/media3/common/Player` whose state changed. Use the getters to obtain the latest states. |
| `https://developer.android.com/reference/androidx/media3/common/Player.Events events` | The `https://developer.android.com/reference/androidx/media3/common/Player.Events` that happened in this iteration, indicating which player states changed. |

### onIsLoadingChanged

```
public final void onIsLoadingChanged(boolean isLoading)
```

Called when the player starts or stops loading the source.

`https://developer.android.com/reference/androidx/media3/common/Player.Listener#onEvents(androidx.media3.common.Player,androidx.media3.common.Player.Events)` will also be called to report this event along with other events that happen in the same `https://developer.android.com/reference/android/os/Looper.html` message queue iteration.

| Parameters |
|---|---|
| `boolean isLoading` | Whether the source is currently being loaded. |

### onIsPlayingChanged

```
public void onIsPlayingChanged(boolean isPlaying)
```

Called when the value of `https://developer.android.com/reference/androidx/media3/common/Player#isPlaying()` changes.

`https://developer.android.com/reference/androidx/media3/common/Player.Listener#onEvents(androidx.media3.common.Player,androidx.media3.common.Player.Events)` will also be called to report this event along with other events that happen in the same `https://developer.android.com/reference/android/os/Looper.html` message queue iteration.

| Parameters |
|---|---|
| `boolean isPlaying` | Whether the player is playing. |

### onLoadCanceled

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

Called when a load is canceled.

| Parameters |
|---|---|
| `int windowIndex` | The window index in the timeline of the media source this load belongs to. |
| `@https://developer.android.com/reference/androidx/annotation/Nullable https://developer.android.com/reference/androidx/media3/exoplayer/source/MediaSource.MediaPeriodId mediaPeriodId` | The `https://developer.android.com/reference/androidx/media3/exoplayer/source/MediaSource.MediaPeriodId` this load belongs to. Null if the load does not belong to a specific media period. |
| `https://developer.android.com/reference/androidx/media3/exoplayer/source/LoadEventInfo loadEventInfo` | The `https://developer.android.com/reference/androidx/media3/exoplayer/source/LoadEventInfo` corresponding to the event. The values of `https://developer.android.com/reference/androidx/media3/exoplayer/source/LoadEventInfo#elapsedRealtimeMs()` and `https://developer.android.com/reference/androidx/media3/exoplayer/source/LoadEventInfo#bytesLoaded()` are relative to the corresponding `https://developer.android.com/reference/androidx/media3/exoplayer/source/MediaSourceEventListener#onLoadStarted(int,androidx.media3.exoplayer.source.MediaSource.MediaPeriodId,androidx.media3.exoplayer.source.LoadEventInfo,androidx.media3.exoplayer.source.MediaLoadData,int)` event. |
| `https://developer.android.com/reference/androidx/media3/exoplayer/source/MediaLoadData mediaLoadData` | The `https://developer.android.com/reference/androidx/media3/exoplayer/source/MediaLoadData` defining the data being loaded. |

### onLoadCompleted

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

Called when a load ends.

| Parameters |
|---|---|
| `int windowIndex` | The window index in the timeline of the media source this load belongs to. |
| `@https://developer.android.com/reference/androidx/annotation/Nullable https://developer.android.com/reference/androidx/media3/exoplayer/source/MediaSource.MediaPeriodId mediaPeriodId` | The `https://developer.android.com/reference/androidx/media3/exoplayer/source/MediaSource.MediaPeriodId` this load belongs to. Null if the load does not belong to a specific media period. |
| `https://developer.android.com/reference/androidx/media3/exoplayer/source/LoadEventInfo loadEventInfo` | The `https://developer.android.com/reference/androidx/media3/exoplayer/source/LoadEventInfo` corresponding to the event. The values of `https://developer.android.com/reference/androidx/media3/exoplayer/source/LoadEventInfo#elapsedRealtimeMs()` and `https://developer.android.com/reference/androidx/media3/exoplayer/source/LoadEventInfo#bytesLoaded()` are relative to the corresponding `https://developer.android.com/reference/androidx/media3/exoplayer/source/MediaSourceEventListener#onLoadStarted(int,androidx.media3.exoplayer.source.MediaSource.MediaPeriodId,androidx.media3.exoplayer.source.LoadEventInfo,androidx.media3.exoplayer.source.MediaLoadData,int)` event. |
| `https://developer.android.com/reference/androidx/media3/exoplayer/source/MediaLoadData mediaLoadData` | The `https://developer.android.com/reference/androidx/media3/exoplayer/source/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
)
```

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, `https://developer.android.com/reference/androidx/media3/exoplayer/source/MediaSourceEventListener#onLoadCanceled(int,androidx.media3.exoplayer.source.MediaSource.MediaPeriodId,androidx.media3.exoplayer.source.LoadEventInfo,androidx.media3.exoplayer.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. `https://developer.android.com/reference/androidx/media3/common/Player.Listener#onPlayerError(androidx.media3.common.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.

| Parameters |
|---|---|
| `int windowIndex` | The window index in the timeline of the media source this load belongs to. |
| `@https://developer.android.com/reference/androidx/annotation/Nullable https://developer.android.com/reference/androidx/media3/exoplayer/source/MediaSource.MediaPeriodId mediaPeriodId` | The `https://developer.android.com/reference/androidx/media3/exoplayer/source/MediaSource.MediaPeriodId` this load belongs to. Null if the load does not belong to a specific media period. |
| `https://developer.android.com/reference/androidx/media3/exoplayer/source/LoadEventInfo loadEventInfo` | The `https://developer.android.com/reference/androidx/media3/exoplayer/source/LoadEventInfo` corresponding to the event. The values of `https://developer.android.com/reference/androidx/media3/exoplayer/source/LoadEventInfo#elapsedRealtimeMs()` and `https://developer.android.com/reference/androidx/media3/exoplayer/source/LoadEventInfo#bytesLoaded()` are relative to the corresponding `https://developer.android.com/reference/androidx/media3/exoplayer/source/MediaSourceEventListener#onLoadStarted(int,androidx.media3.exoplayer.source.MediaSource.MediaPeriodId,androidx.media3.exoplayer.source.LoadEventInfo,androidx.media3.exoplayer.source.MediaLoadData,int)` event. |
| `https://developer.android.com/reference/androidx/media3/exoplayer/source/MediaLoadData mediaLoadData` | The `https://developer.android.com/reference/androidx/media3/exoplayer/source/MediaLoadData` defining the data being loaded. |
| `https://developer.android.com/reference/java/io/IOException.html error` | The load error. |
| `boolean wasCanceled` | Whether the load was canceled as a result of the error. |

### onLoadStarted

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

Called when a load begins.

| Parameters |
|---|---|
| `int windowIndex` | The window index in the timeline of the media source this load belongs to. |
| `@https://developer.android.com/reference/androidx/annotation/Nullable https://developer.android.com/reference/androidx/media3/exoplayer/source/MediaSource.MediaPeriodId mediaPeriodId` | The `https://developer.android.com/reference/androidx/media3/exoplayer/source/MediaSource.MediaPeriodId` this load belongs to. Null if the load does not belong to a specific media period. |
| `https://developer.android.com/reference/androidx/media3/exoplayer/source/LoadEventInfo loadEventInfo` | The `https://developer.android.com/reference/androidx/media3/exoplayer/source/LoadEventInfo` corresponding to the event. The value of `https://developer.android.com/reference/androidx/media3/exoplayer/source/LoadEventInfo#uri()` won't reflect potential redirection yet and `https://developer.android.com/reference/androidx/media3/exoplayer/source/LoadEventInfo#responseHeaders()` will be empty. |
| `https://developer.android.com/reference/androidx/media3/exoplayer/source/MediaLoadData mediaLoadData` | The `https://developer.android.com/reference/androidx/media3/exoplayer/source/MediaLoadData` defining the data being loaded. |
| `int retryCount` | The number of failed attempts since this method was first called (this is zero for the first load attempt). |

### onLoadingChanged

```
public void onLoadingChanged(boolean isLoading)
```

> [!CAUTION]
> **This method is deprecated.**   
>
> Use `https://developer.android.com/reference/androidx/media3/common/Player.Listener#onIsLoadingChanged(boolean)` instead.

### onMaxSeekToPreviousPositionChanged

```
public void onMaxSeekToPreviousPositionChanged(long maxSeekToPreviousPositionMs)
```

Called when the value of `https://developer.android.com/reference/androidx/media3/common/Player#getMaxSeekToPreviousPosition()` changes.

`https://developer.android.com/reference/androidx/media3/common/Player.Listener#onEvents(androidx.media3.common.Player,androidx.media3.common.Player.Events)` will also be called to report this event along with other events that happen in the same `https://developer.android.com/reference/android/os/Looper.html` message queue iteration.

| Parameters |
|---|---|
| `long maxSeekToPreviousPositionMs` | The maximum position for which `https://developer.android.com/reference/androidx/media3/common/Player#seekToPrevious()` seeks to the previous position, in milliseconds. |

### onMediaItemTransition

```
public final void onMediaItemTransition(
    @Nullable MediaItem mediaItem,
    @Player.MediaItemTransitionReason int reason
)
```

Called when playback transitions to a media item or starts repeating a media item according to the current `https://developer.android.com/reference/androidx/media3/common/Player#getRepeatMode()`.

Note that this callback is also called when the value of `https://developer.android.com/reference/androidx/media3/common/Player#getCurrentTimeline()` becomes non-empty or empty.

`https://developer.android.com/reference/androidx/media3/common/Player.Listener#onEvents(androidx.media3.common.Player,androidx.media3.common.Player.Events)` will also be called to report this event along with other events that happen in the same `https://developer.android.com/reference/android/os/Looper.html` message queue iteration.

| Parameters |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/Nullable https://developer.android.com/reference/androidx/media3/common/MediaItem mediaItem` | The `https://developer.android.com/reference/androidx/media3/common/MediaItem`. May be null if the playlist becomes empty. |
| `@https://developer.android.com/reference/androidx/media3/common/Player.MediaItemTransitionReason int reason` | The reason for the transition. |

### onMediaMetadataChanged

```
public void onMediaMetadataChanged(MediaMetadata mediaMetadata)
```

Called when the value of `https://developer.android.com/reference/androidx/media3/common/Player#getMediaMetadata()` changes.

This method may be called multiple times in quick succession.

`https://developer.android.com/reference/androidx/media3/common/Player.Listener#onEvents(androidx.media3.common.Player,androidx.media3.common.Player.Events)` will also be called to report this event along with other events that happen in the same `https://developer.android.com/reference/android/os/Looper.html` message queue iteration.

| Parameters |
|---|---|
| `https://developer.android.com/reference/androidx/media3/common/MediaMetadata mediaMetadata` | The combined `https://developer.android.com/reference/androidx/media3/common/MediaMetadata`. |

### onMetadata

```
public final void onMetadata(Metadata metadata)
```

Called when there is metadata associated with the current playback time.

`https://developer.android.com/reference/androidx/media3/common/Player.Listener#onEvents(androidx.media3.common.Player,androidx.media3.common.Player.Events)` will also be called to report this event along with other events that happen in the same `https://developer.android.com/reference/android/os/Looper.html` message queue iteration.

| Parameters |
|---|---|
| `https://developer.android.com/reference/androidx/media3/common/Metadata metadata` | The metadata. |

### onPlayWhenReadyChanged

```
public final void onPlayWhenReadyChanged(
    boolean playWhenReady,
    @Player.PlayWhenReadyChangeReason int reason
)
```

Called when the value returned from `https://developer.android.com/reference/androidx/media3/common/Player#getPlayWhenReady()` changes.

The current `playWhenReady` value may be re-reported if the `reason` for this value changes.

`https://developer.android.com/reference/androidx/media3/common/Player.Listener#onEvents(androidx.media3.common.Player,androidx.media3.common.Player.Events)` will also be called to report this event along with other events that happen in the same `https://developer.android.com/reference/android/os/Looper.html` message queue iteration.

| Parameters |
|---|---|
| `boolean playWhenReady` | Whether playback will proceed when ready. |
| `@https://developer.android.com/reference/androidx/media3/common/Player.PlayWhenReadyChangeReason int reason` | The `https://developer.android.com/reference/androidx/media3/common/Player.PlayWhenReadyChangeReason` for the change. |

### onPlaybackParametersChanged

```
public final void onPlaybackParametersChanged(PlaybackParameters playbackParameters)
```

Called when the value of `https://developer.android.com/reference/androidx/media3/common/Player#getPlaybackParameters()` changes. The playback parameters may change due to a call to `https://developer.android.com/reference/androidx/media3/common/Player#setPlaybackParameters(androidx.media3.common.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).

`https://developer.android.com/reference/androidx/media3/common/Player.Listener#onEvents(androidx.media3.common.Player,androidx.media3.common.Player.Events)` will also be called to report this event along with other events that happen in the same `https://developer.android.com/reference/android/os/Looper.html` message queue iteration.

| Parameters |
|---|---|
| `https://developer.android.com/reference/androidx/media3/common/PlaybackParameters playbackParameters` | The playback parameters. |

### onPlaybackStateChanged

```
public final void onPlaybackStateChanged(@Player.State int playbackState)
```

Called when the value returned from `https://developer.android.com/reference/androidx/media3/common/Player#getPlaybackState()` changes.

`https://developer.android.com/reference/androidx/media3/common/Player.Listener#onEvents(androidx.media3.common.Player,androidx.media3.common.Player.Events)` will also be called to report this event along with other events that happen in the same `https://developer.android.com/reference/android/os/Looper.html` message queue iteration.

| Parameters |
|---|---|
| `@https://developer.android.com/reference/androidx/media3/common/Player.State int playbackState` | The new playback `https://developer.android.com/reference/androidx/media3/common/Player.State`. |

### onPlaybackSuppressionReasonChanged

```
public final void onPlaybackSuppressionReasonChanged(
    @Player.PlaybackSuppressionReason int playbackSuppressionReason
)
```

Called when the value returned from `https://developer.android.com/reference/androidx/media3/common/Player#getPlaybackSuppressionReason()` changes.

`https://developer.android.com/reference/androidx/media3/common/Player.Listener#onEvents(androidx.media3.common.Player,androidx.media3.common.Player.Events)` will also be called to report this event along with other events that happen in the same `https://developer.android.com/reference/android/os/Looper.html` message queue iteration.

| Parameters |
|---|---|
| `@https://developer.android.com/reference/androidx/media3/common/Player.PlaybackSuppressionReason int playbackSuppressionReason` | The current `https://developer.android.com/reference/androidx/media3/common/Player.PlaybackSuppressionReason`. |

### onPlayerError

```
public final void onPlayerError(PlaybackException error)
```

Called when an error occurs. The playback state will transition to `https://developer.android.com/reference/androidx/media3/common/Player#STATE_IDLE()` immediately after this method is called. The player instance can still be used, and `https://developer.android.com/reference/androidx/media3/common/Player#release()` must still be called on the player should it no longer be required.

`https://developer.android.com/reference/androidx/media3/common/Player.Listener#onEvents(androidx.media3.common.Player,androidx.media3.common.Player.Events)` will also be called to report this event along with other events that happen in the same `https://developer.android.com/reference/android/os/Looper.html` message queue iteration.

Implementations of Player may pass an instance of a subclass of `https://developer.android.com/reference/androidx/media3/common/PlaybackException` to this method in order to include more information about the error.

| Parameters |
|---|---|
| `https://developer.android.com/reference/androidx/media3/common/PlaybackException error` | The error. |

### onPlayerErrorChanged

```
public void onPlayerErrorChanged(@Nullable PlaybackException error)
```

Called when the `https://developer.android.com/reference/androidx/media3/common/PlaybackException` returned by `https://developer.android.com/reference/androidx/media3/common/Player#getPlayerError()` changes.

`https://developer.android.com/reference/androidx/media3/common/Player.Listener#onEvents(androidx.media3.common.Player,androidx.media3.common.Player.Events)` will also be called to report this event along with other events that happen in the same `https://developer.android.com/reference/android/os/Looper.html` message queue iteration.

Implementations of Player may pass an instance of a subclass of `https://developer.android.com/reference/androidx/media3/common/PlaybackException` to this method in order to include more information about the error.

| Parameters |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/Nullable https://developer.android.com/reference/androidx/media3/common/PlaybackException error` | The new error, or null if the error is being cleared. |

### onPlayerStateChanged

```
public final void onPlayerStateChanged(
    boolean playWhenReady,
    @Player.State int playbackState
)
```

> [!CAUTION]
> **This method is deprecated.**   
>
> Use `https://developer.android.com/reference/androidx/media3/common/Player.Listener#onPlaybackStateChanged(int)` and `https://developer.android.com/reference/androidx/media3/common/Player.Listener#onPlayWhenReadyChanged(boolean,int)` instead.

### onPlaylistMetadataChanged

```
public void onPlaylistMetadataChanged(MediaMetadata playlistMetadata)
```

Called when the value of `https://developer.android.com/reference/androidx/media3/common/Player#getPlaylistMetadata()` changes.

`https://developer.android.com/reference/androidx/media3/common/Player.Listener#onEvents(androidx.media3.common.Player,androidx.media3.common.Player.Events)` will also be called to report this event along with other events that happen in the same `https://developer.android.com/reference/android/os/Looper.html` message queue iteration.

### onPositionDiscontinuity

```
public void onPositionDiscontinuity(@Player.DiscontinuityReason int reason)
```

> [!CAUTION]
> **This method is deprecated.**   
>
> Use `https://developer.android.com/reference/androidx/media3/common/Player.Listener#onPositionDiscontinuity(androidx.media3.common.Player.PositionInfo,androidx.media3.common.Player.PositionInfo,int)` instead.

### onPositionDiscontinuity

```
public final void onPositionDiscontinuity(
    Player.PositionInfo oldPosition,
    Player.PositionInfo newPosition,
    @Player.DiscontinuityReason int reason
)
```

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.

`https://developer.android.com/reference/androidx/media3/common/Player.Listener#onEvents(androidx.media3.common.Player,androidx.media3.common.Player.Events)` will also be called to report this event along with other events that happen in the same `https://developer.android.com/reference/android/os/Looper.html` message queue iteration.

| Parameters |
|---|---|
| `https://developer.android.com/reference/androidx/media3/common/Player.PositionInfo oldPosition` | The position before the discontinuity. |
| `https://developer.android.com/reference/androidx/media3/common/Player.PositionInfo newPosition` | The position after the discontinuity. |
| `@https://developer.android.com/reference/androidx/media3/common/Player.DiscontinuityReason int reason` | The `https://developer.android.com/reference/androidx/media3/common/Player.DiscontinuityReason` responsible for the discontinuity. |

### onRenderedFirstFrame

```
public 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.

`https://developer.android.com/reference/androidx/media3/common/Player.Listener#onEvents(androidx.media3.common.Player,androidx.media3.common.Player.Events)` will also be called to report this event along with other events that happen in the same `https://developer.android.com/reference/android/os/Looper.html` message queue iteration.

### onRenderedFirstFrame

```
public final 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.

| Parameters |
|---|---|
| `https://developer.android.com/reference/java/lang/Object.html output` | The output of the video renderer. Normally a `https://developer.android.com/reference/android/view/Surface.html`, however some video renderers may have other output types (e.g., a `https://developer.android.com/reference/androidx/media3/exoplayer/video/VideoDecoderOutputBufferRenderer`). |
| `long renderTimeMs` | The `https://developer.android.com/reference/android/os/SystemClock.html#elapsedRealtime()` when the frame was rendered. |

### onRendererReadyChanged

```
public void onRendererReadyChanged(
    int rendererIndex,
    @C.TrackType int rendererTrackType,
    boolean isRendererReady
)
```

Called each time a renderer starts or stops allowing playback to be ready.

| Parameters |
|---|---|
| `int rendererIndex` | The index of the renderer in the `https://developer.android.com/reference/androidx/media3/exoplayer/ExoPlayer` instance. |
| `@https://developer.android.com/reference/androidx/media3/common/C.TrackType int rendererTrackType` | The `https://developer.android.com/reference/androidx/media3/common/C.TrackType` of the renderer. |
| `boolean isRendererReady` | Whether the renderer allows playback to be ready. |

### onRepeatModeChanged

```
public final void onRepeatModeChanged(@Player.RepeatMode int repeatMode)
```

Called when the value of `https://developer.android.com/reference/androidx/media3/common/Player#getRepeatMode()` changes.

`https://developer.android.com/reference/androidx/media3/common/Player.Listener#onEvents(androidx.media3.common.Player,androidx.media3.common.Player.Events)` will also be called to report this event along with other events that happen in the same `https://developer.android.com/reference/android/os/Looper.html` message queue iteration.

| Parameters |
|---|---|
| `@https://developer.android.com/reference/androidx/media3/common/Player.RepeatMode int repeatMode` | The `https://developer.android.com/reference/androidx/media3/common/Player.RepeatMode` used for playback. |

### onSeekBackIncrementChanged

```
public void onSeekBackIncrementChanged(long seekBackIncrementMs)
```

Called when the value of `https://developer.android.com/reference/androidx/media3/common/Player#getSeekBackIncrement()` changes.

`https://developer.android.com/reference/androidx/media3/common/Player.Listener#onEvents(androidx.media3.common.Player,androidx.media3.common.Player.Events)` will also be called to report this event along with other events that happen in the same `https://developer.android.com/reference/android/os/Looper.html` message queue iteration.

| Parameters |
|---|---|
| `long seekBackIncrementMs` | The `https://developer.android.com/reference/androidx/media3/common/Player#seekBack()` increment, in milliseconds. |

### onSeekForwardIncrementChanged

```
public void onSeekForwardIncrementChanged(long seekForwardIncrementMs)
```

Called when the value of `https://developer.android.com/reference/androidx/media3/common/Player#getSeekForwardIncrement()` changes.

`https://developer.android.com/reference/androidx/media3/common/Player.Listener#onEvents(androidx.media3.common.Player,androidx.media3.common.Player.Events)` will also be called to report this event along with other events that happen in the same `https://developer.android.com/reference/android/os/Looper.html` message queue iteration.

| Parameters |
|---|---|
| `long seekForwardIncrementMs` | The `https://developer.android.com/reference/androidx/media3/common/Player#seekForward()` increment, in milliseconds. |

### onShuffleModeEnabledChanged

```
public final void onShuffleModeEnabledChanged(boolean shuffleModeEnabled)
```

Called when the value of `https://developer.android.com/reference/androidx/media3/common/Player#getShuffleModeEnabled()` changes.

`https://developer.android.com/reference/androidx/media3/common/Player.Listener#onEvents(androidx.media3.common.Player,androidx.media3.common.Player.Events)` will also be called to report this event along with other events that happen in the same `https://developer.android.com/reference/android/os/Looper.html` message queue iteration.

| Parameters |
|---|---|
| `boolean shuffleModeEnabled` | Whether shuffling of `https://developer.android.com/reference/androidx/media3/common/MediaItem` is enabled. |

### onSkipSilenceEnabledChanged

```
public final void onSkipSilenceEnabledChanged(boolean skipSilenceEnabled)
```

Called when skipping silences is enabled or disabled in the audio stream.

`https://developer.android.com/reference/androidx/media3/common/Player.Listener#onEvents(androidx.media3.common.Player,androidx.media3.common.Player.Events)` will also be called to report this event along with other events that happen in the same `https://developer.android.com/reference/android/os/Looper.html` message queue iteration.

| Parameters |
|---|---|
| `boolean skipSilenceEnabled` | Whether skipping silences in the audio stream is enabled. |

### onSurfaceSizeChanged

```
public final 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.

`https://developer.android.com/reference/androidx/media3/common/Player.Listener#onEvents(androidx.media3.common.Player,androidx.media3.common.Player.Events)` will also be called to report this event along with other events that happen in the same `https://developer.android.com/reference/android/os/Looper.html` message queue iteration.

| Parameters |
|---|---|
| `int width` | The surface width in pixels. May be `https://developer.android.com/reference/androidx/media3/common/C#LENGTH_UNSET()` if unknown, or 0 if the video is not rendered onto a surface. |
| `int height` | The surface height in pixels. May be `https://developer.android.com/reference/androidx/media3/common/C#LENGTH_UNSET()` if unknown, or 0 if the video is not rendered onto a surface. |

### onTimelineChanged

```
public final void onTimelineChanged(
    Timeline timeline,
    @Player.TimelineChangeReason int reason
)
```

Called when the value of `https://developer.android.com/reference/androidx/media3/common/Player#getCurrentTimeline()` changes.

Note that the current `https://developer.android.com/reference/androidx/media3/common/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 `https://developer.android.com/reference/androidx/media3/common/Player.Listener#onPositionDiscontinuity(androidx.media3.common.Player.PositionInfo,androidx.media3.common.Player.PositionInfo,int)` callback will be triggered.

`https://developer.android.com/reference/androidx/media3/common/Player.Listener#onEvents(androidx.media3.common.Player,androidx.media3.common.Player.Events)` will also be called to report this event along with other events that happen in the same `https://developer.android.com/reference/android/os/Looper.html` message queue iteration.

| Parameters |
|---|---|
| `https://developer.android.com/reference/androidx/media3/common/Timeline timeline` | The latest timeline. Never null, but may be empty. |
| `@https://developer.android.com/reference/androidx/media3/common/Player.TimelineChangeReason int reason` | The `https://developer.android.com/reference/androidx/media3/common/Player.TimelineChangeReason` responsible for this timeline change. |

### onTrackSelectionParametersChanged

```
public void onTrackSelectionParametersChanged(TrackSelectionParameters parameters)
```

Called when the value returned from `https://developer.android.com/reference/androidx/media3/common/Player#getTrackSelectionParameters()` changes.

`https://developer.android.com/reference/androidx/media3/common/Player.Listener#onEvents(androidx.media3.common.Player,androidx.media3.common.Player.Events)` will also be called to report this event along with other events that happen in the same `https://developer.android.com/reference/android/os/Looper.html` message queue iteration.

| Parameters |
|---|---|
| `https://developer.android.com/reference/androidx/media3/common/TrackSelectionParameters parameters` | The new `https://developer.android.com/reference/androidx/media3/common/TrackSelectionParameters`. |

### onTracksChanged

```
public void onTracksChanged(Tracks tracks)
```

Called when the value of `https://developer.android.com/reference/androidx/media3/common/Player#getCurrentTracks()` changes.

`https://developer.android.com/reference/androidx/media3/common/Player.Listener#onEvents(androidx.media3.common.Player,androidx.media3.common.Player.Events)` will also be called to report this event along with other events that happen in the same `https://developer.android.com/reference/android/os/Looper.html` message queue iteration.

| Parameters |
|---|---|
| `https://developer.android.com/reference/androidx/media3/common/Tracks tracks` | The available tracks information. Never null, but may be of length zero. |

### onUpstreamDiscarded

```
public final void onUpstreamDiscarded(
    int windowIndex,
    @Nullable 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.

| Parameters |
|---|---|
| `int windowIndex` | The window index in the timeline of the media source this load belongs to. |
| `@https://developer.android.com/reference/androidx/annotation/Nullable https://developer.android.com/reference/androidx/media3/exoplayer/source/MediaSource.MediaPeriodId mediaPeriodId` | The `https://developer.android.com/reference/androidx/media3/exoplayer/source/MediaSource.MediaPeriodId` the media belongs to. |
| `https://developer.android.com/reference/androidx/media3/exoplayer/source/MediaLoadData mediaLoadData` | The `https://developer.android.com/reference/androidx/media3/exoplayer/source/MediaLoadData` defining the media being discarded. |

### onVideoCodecError

```
public final void onVideoCodecError(Exception videoCodecError)
```

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. `https://developer.android.com/reference/androidx/media3/common/Player.Listener#onPlayerError(androidx.media3.common.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.

| Parameters |
|---|---|
| `https://developer.android.com/reference/java/lang/Exception.html videoCodecError` | The error. Typically a `https://developer.android.com/reference/android/media/MediaCodec.CodecException.html` if the renderer uses `https://developer.android.com/reference/android/media/MediaCodec.html`, or a `https://developer.android.com/reference/androidx/media3/decoder/DecoderException` if the renderer uses a software decoder. |

### onVideoDecoderInitialized

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

Called when a video decoder is created.

| Parameters |
|---|---|
| `https://developer.android.com/reference/java/lang/String.html decoderName` | The decoder that was created. |
| `long initializedTimestampMs` | `https://developer.android.com/reference/android/os/SystemClock.html#elapsedRealtime()` when initialization finished. |
| `long initializationDurationMs` | The time taken to initialize the decoder in milliseconds. |

### onVideoDecoderReleased

```
public final void onVideoDecoderReleased(String decoderName)
```

Called when a video decoder is released.

| Parameters |
|---|---|
| `https://developer.android.com/reference/java/lang/String.html decoderName` | The video decoder that was released. |

### onVideoDisabled

```
public final void onVideoDisabled(DecoderCounters counters)
```

Called when the video renderer is disabled.

| Parameters |
|---|---|
| `https://developer.android.com/reference/androidx/media3/exoplayer/DecoderCounters counters` | `https://developer.android.com/reference/androidx/media3/exoplayer/DecoderCounters` that were updated by the video renderer. |

### onVideoEnabled

```
public final void onVideoEnabled(DecoderCounters counters)
```

Called when the video renderer is enabled.

| Parameters |
|---|---|
| `https://developer.android.com/reference/androidx/media3/exoplayer/DecoderCounters counters` | `https://developer.android.com/reference/androidx/media3/exoplayer/DecoderCounters` that will be updated by the video renderer for as long as it remains enabled. |

### onVideoFrameProcessingOffset

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

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.

| Parameters |
|---|---|
| `long totalProcessingOffsetUs` | The sum of all video frame processing offset samples for the video frames processed by the renderer in microseconds. |
| `int frameCount` | The number of samples included in the `totalProcessingOffsetUs`. |

### onVideoInputFormatChanged

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

Called when the format of the media being consumed by the video renderer changes.

| Parameters |
|---|---|
| `https://developer.android.com/reference/androidx/media3/common/Format format` | The new format. |
| `@https://developer.android.com/reference/androidx/annotation/Nullable https://developer.android.com/reference/androidx/media3/exoplayer/DecoderReuseEvaluation 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. |

### onVideoSizeChanged

```
public final void onVideoSizeChanged(VideoSize videoSize)
```

Called each time when `https://developer.android.com/reference/androidx/media3/common/Player#getVideoSize()` changes.

`https://developer.android.com/reference/androidx/media3/common/Player.Listener#onEvents(androidx.media3.common.Player,androidx.media3.common.Player.Events)` will also be called to report this event along with other events that happen in the same `https://developer.android.com/reference/android/os/Looper.html` message queue iteration.

| Parameters |
|---|---|
| `https://developer.android.com/reference/androidx/media3/common/VideoSize videoSize` | The new size of the video. |

### onVolumeChanged

```
public final void onVolumeChanged(float volume)
```

Called when the value of `https://developer.android.com/reference/androidx/media3/common/Player#getVolume()` changes.

`https://developer.android.com/reference/androidx/media3/common/Player.Listener#onEvents(androidx.media3.common.Player,androidx.media3.common.Player.Events)` will also be called to report this event along with other events that happen in the same `https://developer.android.com/reference/android/os/Looper.html` message queue iteration.

| Parameters |
|---|---|
| `float volume` | The new volume, with 0 being silence and 1 being unity gain. |

### release

```
@CallSuper
public void release()
```

Releases the collector. Must be called after the player for which data is collected has been released.

### removeListener

```
@CallSuper
public void removeListener(AnalyticsListener listener)
```

Removes a previously added analytics event listener.

| Parameters |
|---|---|
| `https://developer.android.com/reference/androidx/media3/exoplayer/analytics/AnalyticsListener listener` | The listener to remove. |

### setPlayer

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

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.

| Parameters |
|---|---|
| `https://developer.android.com/reference/androidx/media3/common/Player player` | The `https://developer.android.com/reference/androidx/media3/common/Player` for which data will be collected. |
| `https://developer.android.com/reference/android/os/Looper.html looper` | The `https://developer.android.com/reference/android/os/Looper.html` used for listener callbacks. |

### setThrowsWhenUsingWrongThread

```
public void [setThrowsWhenUsingWrongThread](https://developer.android.com/reference/androidx/media3/exoplayer/analytics/DefaultAnalyticsCollector#setThrowsWhenUsingWrongThread(boolean))(boolean throwsWhenUsingWrongThread)
```

> [!CAUTION]
> **This method is 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 |
|---|---|
| `boolean throwsWhenUsingWrongThread` | Whether to throw when using the wrong thread. |

### updateMediaPeriodQueueInfo

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

Updates the playback queue information used for event association.

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

| Parameters |
|---|---|
| `https://developer.android.com/reference/java/util/List.html<https://developer.android.com/reference/androidx/media3/exoplayer/source/MediaSource.MediaPeriodId> queue` | The playback queue of media periods identified by their `https://developer.android.com/reference/androidx/media3/exoplayer/source/MediaSource.MediaPeriodId`. |
| `@https://developer.android.com/reference/androidx/annotation/Nullable https://developer.android.com/reference/androidx/media3/exoplayer/source/MediaSource.MediaPeriodId readingPeriod` | The media period in the queue that is currently being read by renderers, or null if the queue is empty. |

## Protected methods

### generateCurrentPlayerMediaPeriodEventTime

```
protected final AnalyticsListener.EventTime generateCurrentPlayerMediaPeriodEventTime()
```

Generates an `https://developer.android.com/reference/androidx/media3/exoplayer/analytics/AnalyticsListener.EventTime` for the currently playing item in the player.

### generateEventTime

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

Returns a new `https://developer.android.com/reference/androidx/media3/exoplayer/analytics/AnalyticsListener.EventTime` for the specified timeline, window and media period id.

### sendEvent

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

Sends an event to registered listeners.

| Parameters |
|---|---|
| `https://developer.android.com/reference/androidx/media3/exoplayer/analytics/AnalyticsListener.EventTime eventTime` | The `https://developer.android.com/reference/androidx/media3/exoplayer/analytics/AnalyticsListener.EventTime` to report. |
| `int eventFlag` | An integer flag indicating the type of the event, or `https://developer.android.com/reference/androidx/media3/common/C#INDEX_UNSET()` to report this event without flag. |
| `https://developer.android.com/reference/androidx/media3/common/util/ListenerSet.Event<https://developer.android.com/reference/androidx/media3/exoplayer/analytics/AnalyticsListener> eventInvocation` | The event. |