# AnalyticsCollector

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/AnalyticsCollector.java+class:androidx.media3.exoplayer.analytics.AnalyticsCollector)

*** ** * ** ***


```
@UnstableApi
public interface AnalyticsCollector extends Player.Listener, MediaSourceEventListener, BandwidthMeter.EventListener, DrmSessionEventListener
```

<br />

Known direct subclasses [DefaultAnalyticsCollector](https://developer.android.com/reference/androidx/media3/exoplayer/analytics/DefaultAnalyticsCollector)

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

*** ** * ** ***

Interface for data collectors that forward analytics events to `https://developer.android.com/reference/androidx/media3/exoplayer/analytics/AnalyticsListener`.

## Summary

| ### Public methods |
|---|---|
| `abstract void` | `https://developer.android.com/reference/androidx/media3/exoplayer/analytics/AnalyticsCollector#addListener(androidx.media3.exoplayer.analytics.AnalyticsListener)(https://developer.android.com/reference/androidx/media3/exoplayer/analytics/AnalyticsListener listener)` Adds a listener for analytics events. |
| `abstract void` | `https://developer.android.com/reference/androidx/media3/exoplayer/analytics/AnalyticsCollector#notifySeekStarted()()` Notifies the analytics collector that a seek operation will start. |
| `abstract void` | `https://developer.android.com/reference/androidx/media3/exoplayer/analytics/AnalyticsCollector#onAudioCodecError(java.lang.Exception)(https://developer.android.com/reference/java/lang/Exception.html audioCodecError)` Called when an audio decoder encounters an error. |
| `abstract void` | `https://developer.android.com/reference/androidx/media3/exoplayer/analytics/AnalyticsCollector#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. |
| `abstract void` | `https://developer.android.com/reference/androidx/media3/exoplayer/analytics/AnalyticsCollector#onAudioDecoderReleased(java.lang.String)(https://developer.android.com/reference/java/lang/String.html decoderName)` Called when a audio decoder is released. |
| `abstract void` | `https://developer.android.com/reference/androidx/media3/exoplayer/analytics/AnalyticsCollector#onAudioDisabled(androidx.media3.exoplayer.DecoderCounters)(https://developer.android.com/reference/androidx/media3/exoplayer/DecoderCounters counters)` Called when the audio renderer is disabled. |
| `abstract void` | `https://developer.android.com/reference/androidx/media3/exoplayer/analytics/AnalyticsCollector#onAudioEnabled(androidx.media3.exoplayer.DecoderCounters)(https://developer.android.com/reference/androidx/media3/exoplayer/DecoderCounters counters)` Called when the audio renderer is enabled. |
| `abstract void` | `https://developer.android.com/reference/androidx/media3/exoplayer/analytics/AnalyticsCollector#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. |
| `abstract void` | `https://developer.android.com/reference/androidx/media3/exoplayer/analytics/AnalyticsCollector#onAudioPositionAdvancing(long)(long playoutStartSystemTimeMs)` Called when the audio position has increased for the first time since the last pause or position reset. |
| `abstract void` | `https://developer.android.com/reference/androidx/media3/exoplayer/analytics/AnalyticsCollector#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. |
| `abstract void` | `https://developer.android.com/reference/androidx/media3/exoplayer/analytics/AnalyticsCollector#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. |
| `abstract void` | `https://developer.android.com/reference/androidx/media3/exoplayer/analytics/AnalyticsCollector#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. |
| `abstract void` | `https://developer.android.com/reference/androidx/media3/exoplayer/analytics/AnalyticsCollector#onAudioUnderrun(int,long,long)( int bufferSize, long bufferSizeMs, long elapsedSinceLastFeedMs )` Called when an audio underrun occurs. |
| `abstract void` | `https://developer.android.com/reference/androidx/media3/exoplayer/analytics/AnalyticsCollector#onDroppedFrames(int,long)(int count, long elapsedMs)` Called to report the number of frames dropped by the video renderer. |
| `abstract void` | `https://developer.android.com/reference/androidx/media3/exoplayer/analytics/AnalyticsCollector#onDroppedSeeksWhileScrubbing(int)(int droppedSeekCount)` Called when seeks are dropped when scrubbing. |
| `abstract void` | `https://developer.android.com/reference/androidx/media3/exoplayer/analytics/AnalyticsCollector#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. |
| `abstract void` | `https://developer.android.com/reference/androidx/media3/exoplayer/analytics/AnalyticsCollector#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. |
| `abstract void` | `https://developer.android.com/reference/androidx/media3/exoplayer/analytics/AnalyticsCollector#onVideoCodecError(java.lang.Exception)(https://developer.android.com/reference/java/lang/Exception.html videoCodecError)` Called when a video decoder encounters an error. |
| `abstract void` | `https://developer.android.com/reference/androidx/media3/exoplayer/analytics/AnalyticsCollector#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. |
| `abstract void` | `https://developer.android.com/reference/androidx/media3/exoplayer/analytics/AnalyticsCollector#onVideoDecoderReleased(java.lang.String)(https://developer.android.com/reference/java/lang/String.html decoderName)` Called when a video decoder is released. |
| `abstract void` | `https://developer.android.com/reference/androidx/media3/exoplayer/analytics/AnalyticsCollector#onVideoDisabled(androidx.media3.exoplayer.DecoderCounters)(https://developer.android.com/reference/androidx/media3/exoplayer/DecoderCounters counters)` Called when the video renderer is disabled. |
| `abstract void` | `https://developer.android.com/reference/androidx/media3/exoplayer/analytics/AnalyticsCollector#onVideoEnabled(androidx.media3.exoplayer.DecoderCounters)(https://developer.android.com/reference/androidx/media3/exoplayer/DecoderCounters counters)` Called when the video renderer is enabled. |
| `abstract void` | `https://developer.android.com/reference/androidx/media3/exoplayer/analytics/AnalyticsCollector#onVideoFrameProcessingOffset(long,int)( long totalProcessingOffsetUs, int frameCount )` Called to report the video processing offset of video frames processed by the video renderer. |
| `abstract void` | `https://developer.android.com/reference/androidx/media3/exoplayer/analytics/AnalyticsCollector#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. |
| `abstract void` | `https://developer.android.com/reference/androidx/media3/exoplayer/analytics/AnalyticsCollector#release()()` Releases the collector. |
| `abstract void` | `https://developer.android.com/reference/androidx/media3/exoplayer/analytics/AnalyticsCollector#removeListener(androidx.media3.exoplayer.analytics.AnalyticsListener)(https://developer.android.com/reference/androidx/media3/exoplayer/analytics/AnalyticsListener listener)` Removes a previously added analytics event listener. |
| `abstract void` | `https://developer.android.com/reference/androidx/media3/exoplayer/analytics/AnalyticsCollector#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. |
| `abstract void` | `https://developer.android.com/reference/androidx/media3/exoplayer/analytics/AnalyticsCollector#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. |

| ### Inherited methods |
|---|
| From [androidx.media3.exoplayer.upstream.BandwidthMeter.EventListener](https://developer.android.com/reference/androidx/media3/exoplayer/upstream/BandwidthMeter.EventListener) |---|---| | `abstract void` | `https://developer.android.com/reference/androidx/media3/exoplayer/upstream/BandwidthMeter.EventListener#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. | |
| From [androidx.media3.exoplayer.drm.DrmSessionEventListener](https://developer.android.com/reference/androidx/media3/exoplayer/drm/DrmSessionEventListener) |---|---| | `default 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 /> | | `default void` | `https://developer.android.com/reference/androidx/media3/exoplayer/drm/DrmSessionEventListener#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. | | `default void` | `https://developer.android.com/reference/androidx/media3/exoplayer/drm/DrmSessionEventListener#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. | | `default void` | `https://developer.android.com/reference/androidx/media3/exoplayer/drm/DrmSessionEventListener#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. | | `default void` | `https://developer.android.com/reference/androidx/media3/exoplayer/drm/DrmSessionEventListener#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. | | `default void` | `https://developer.android.com/reference/androidx/media3/exoplayer/drm/DrmSessionEventListener#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. | | `default void` | `https://developer.android.com/reference/androidx/media3/exoplayer/drm/DrmSessionEventListener#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. | |
| From [androidx.media3.exoplayer.source.MediaSourceEventListener](https://developer.android.com/reference/androidx/media3/exoplayer/source/MediaSourceEventListener) |---|---| | `default void` | `https://developer.android.com/reference/androidx/media3/exoplayer/source/MediaSourceEventListener#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). | | `default void` | `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)( 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. | | `default void` | `https://developer.android.com/reference/androidx/media3/exoplayer/source/MediaSourceEventListener#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. | | `default void` | `https://developer.android.com/reference/androidx/media3/exoplayer/source/MediaSourceEventListener#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. | | `default void` | `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)( 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. | | `default void` | `https://developer.android.com/reference/androidx/media3/exoplayer/source/MediaSourceEventListener#onUpstreamDiscarded(int,androidx.media3.exoplayer.source.MediaSource.MediaPeriodId,androidx.media3.exoplayer.source.MediaLoadData)( int windowIndex, 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. | |
| From [androidx.media3.common.Player.Listener](https://developer.android.com/reference/androidx/media3/common/Player.Listener) |---|---| | `default void` | `https://developer.android.com/reference/androidx/media3/common/Player.Listener#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. | | `default void` | `@https://developer.android.com/reference/androidx/media3/common/util/UnstableApi https://developer.android.com/reference/androidx/media3/common/Player.Listener#onAudioSessionIdChanged(int)(int audioSessionId)` Called when the audio session ID changes. | | `default void` | `https://developer.android.com/reference/androidx/media3/common/Player.Listener#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`. | | `default void` | `https://developer.android.com/reference/androidx/media3/common/Player.Listener#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. | | `default void` | `@https://developer.android.com/reference/androidx/media3/common/util/UnstableApi [onCues](https://developer.android.com/reference/androidx/media3/common/Player.Listener#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 /> | | `default void` | `https://developer.android.com/reference/androidx/media3/common/Player.Listener#onDeviceInfoChanged(androidx.media3.common.DeviceInfo)(https://developer.android.com/reference/androidx/media3/common/DeviceInfo deviceInfo)` Called when the device information changes | | `default void` | `https://developer.android.com/reference/androidx/media3/common/Player.Listener#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. | | `default void` | `https://developer.android.com/reference/androidx/media3/common/Player.Listener#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. | | `default void` | `https://developer.android.com/reference/androidx/media3/common/Player.Listener#onIsLoadingChanged(boolean)(boolean isLoading)` Called when the player starts or stops loading the source. | | `default void` | `https://developer.android.com/reference/androidx/media3/common/Player.Listener#onIsPlayingChanged(boolean)(boolean isPlaying)` Called when the value of `https://developer.android.com/reference/androidx/media3/common/Player#isPlaying()` changes. | | `default void` | `@https://developer.android.com/reference/androidx/media3/common/util/UnstableApi [onLoadingChanged](https://developer.android.com/reference/androidx/media3/common/Player.Listener#onLoadingChanged(boolean))(boolean isLoading)` **This method is deprecated.** Use `https://developer.android.com/reference/androidx/media3/common/Player.Listener#onIsLoadingChanged(boolean)` instead. <br /> | | `default void` | `https://developer.android.com/reference/androidx/media3/common/Player.Listener#onMaxSeekToPreviousPositionChanged(long)(long maxSeekToPreviousPositionMs)` Called when the value of `https://developer.android.com/reference/androidx/media3/common/Player#getMaxSeekToPreviousPosition()` changes. | | `default void` | `https://developer.android.com/reference/androidx/media3/common/Player.Listener#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()`. | | `default void` | `https://developer.android.com/reference/androidx/media3/common/Player.Listener#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. | | `default void` | `@https://developer.android.com/reference/androidx/media3/common/util/UnstableApi https://developer.android.com/reference/androidx/media3/common/Player.Listener#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. | | `default void` | `https://developer.android.com/reference/androidx/media3/common/Player.Listener#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. | | `default void` | `https://developer.android.com/reference/androidx/media3/common/Player.Listener#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. | | `default void` | `https://developer.android.com/reference/androidx/media3/common/Player.Listener#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. | | `default void` | `https://developer.android.com/reference/androidx/media3/common/Player.Listener#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. | | `default void` | `https://developer.android.com/reference/androidx/media3/common/Player.Listener#onPlayerError(androidx.media3.common.PlaybackException)(https://developer.android.com/reference/androidx/media3/common/PlaybackException error)` Called when an error occurs. | | `default void` | `https://developer.android.com/reference/androidx/media3/common/Player.Listener#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. | | `default void` | `@https://developer.android.com/reference/androidx/media3/common/util/UnstableApi [onPlayerStateChanged](https://developer.android.com/reference/androidx/media3/common/Player.Listener#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 /> | | `default void` | `https://developer.android.com/reference/androidx/media3/common/Player.Listener#onPlaylistMetadataChanged(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#getPlaylistMetadata()` changes. | | `default void` | `@https://developer.android.com/reference/androidx/media3/common/util/UnstableApi [onPositionDiscontinuity](https://developer.android.com/reference/androidx/media3/common/Player.Listener#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 /> | | `default void` | `https://developer.android.com/reference/androidx/media3/common/Player.Listener#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. | | `default void` | `https://developer.android.com/reference/androidx/media3/common/Player.Listener#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. | | `default void` | `https://developer.android.com/reference/androidx/media3/common/Player.Listener#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. | | `default void` | `https://developer.android.com/reference/androidx/media3/common/Player.Listener#onSeekBackIncrementChanged(long)(long seekBackIncrementMs)` Called when the value of `https://developer.android.com/reference/androidx/media3/common/Player#getSeekBackIncrement()` changes. | | `default void` | `https://developer.android.com/reference/androidx/media3/common/Player.Listener#onSeekForwardIncrementChanged(long)(long seekForwardIncrementMs)` Called when the value of `https://developer.android.com/reference/androidx/media3/common/Player#getSeekForwardIncrement()` changes. | | `default void` | `https://developer.android.com/reference/androidx/media3/common/Player.Listener#onShuffleModeEnabledChanged(boolean)(boolean shuffleModeEnabled)` Called when the value of `https://developer.android.com/reference/androidx/media3/common/Player#getShuffleModeEnabled()` changes. | | `default void` | `https://developer.android.com/reference/androidx/media3/common/Player.Listener#onSkipSilenceEnabledChanged(boolean)(boolean skipSilenceEnabled)` Called when skipping silences is enabled or disabled in the audio stream. | | `default void` | `https://developer.android.com/reference/androidx/media3/common/Player.Listener#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. | | `default void` | `https://developer.android.com/reference/androidx/media3/common/Player.Listener#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. | | `default void` | `https://developer.android.com/reference/androidx/media3/common/Player.Listener#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. | | `default void` | `https://developer.android.com/reference/androidx/media3/common/Player.Listener#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. | | `default void` | `https://developer.android.com/reference/androidx/media3/common/Player.Listener#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. | | `default void` | `https://developer.android.com/reference/androidx/media3/common/Player.Listener#onVolumeChanged(float)(float volume)` Called when the value of `https://developer.android.com/reference/androidx/media3/common/Player#getVolume()` changes. | |

## Public methods

### addListener

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

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

### onAudioCodecError

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

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

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

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

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

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

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

### onAudioSinkError

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

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

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

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

### onDroppedFrames

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

```
abstract void onDroppedSeeksWhileScrubbing(int droppedSeekCount)
```

Called when seeks are dropped when scrubbing.

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

### onRenderedFirstFrame

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

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

### onVideoCodecError

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

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

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

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

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

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

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

### release

```
abstract void release()
```

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

### removeListener

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

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

### updateMediaPeriodQueueInfo

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