Back to Exoplayer

AnalyticsCollector (ExoPlayer library)

docs/doc/reference/com/google/android/exoplayer2/analytics/AnalyticsCollector.html

latest22.6 KB
Original Source

Package com.google.android.exoplayer2.analytics

Interface AnalyticsCollector

  • All Superinterfaces:BandwidthMeter.EventListener, DrmSessionEventListener, MediaSourceEventListener, Player.ListenerAll Known Implementing Classes:DefaultAnalyticsCollector

[@Deprecated](https://developer.android.com/reference/java/lang/Deprecated.html "class or interface in java.lang")public interfaceAnalyticsCollectorextends[Player.Listener](../Player.Listener.html "interface in com.google.android.exoplayer2"),[MediaSourceEventListener](../source/MediaSourceEventListener.html "interface in com.google.android.exoplayer2.source"),[BandwidthMeter.EventListener](../upstream/BandwidthMeter.EventListener.html "interface in com.google.android.exoplayer2.upstream"),[DrmSessionEventListener](../drm/DrmSessionEventListener.html "interface in com.google.android.exoplayer2.drm")

Deprecated. com.google.android.exoplayer2 is deprecated. Please migrate to androidx.media3 (which contains the same ExoPlayer code). See the migration guide for more details, including a script to help with the migration.

Interface for data collectors that forward analytics events to AnalyticsListeners.

Nested Class Summary

- 

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

BandwidthMeter.EventListener.EventDispatcher

- 

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

DrmSessionEventListener.EventDispatcher

- 

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

MediaSourceEventListener.EventDispatcher

Method Summary

All Methods Instance Methods Abstract Methods Deprecated Methods | Modifier and Type | Method | Description | | --- | --- | --- | | void | addListener​(AnalyticsListener listener) | Deprecated.

Adds a listener for analytics events. | | void | notifySeekStarted() | Deprecated.

Notify analytics collector that a seek operation will start. | | void | onAudioCodecError​(Exception audioCodecError) | Deprecated.

Called when an audio decoder encounters an error. | | void | onAudioDecoderInitialized​(String decoderName, long initializedTimestampMs, long initializationDurationMs) | Deprecated.

Called when a audio decoder is created. | | void | onAudioDecoderReleased​(String decoderName) | Deprecated.

Called when a audio decoder is released. | | void | onAudioDisabled​(DecoderCounters counters) | Deprecated.

Called when the audio renderer is disabled. | | void | onAudioEnabled​(DecoderCounters counters) | Deprecated.

Called when the audio renderer is enabled. | | void | onAudioInputFormatChanged​(Format format, DecoderReuseEvaluation decoderReuseEvaluation) | Deprecated.

Called when the format of the media being consumed by the audio renderer changes. | | void | onAudioPositionAdvancing​(long playoutStartSystemTimeMs) | Deprecated.

Called when the audio position has increased for the first time since the last pause or position reset. | | void | onAudioSinkError​(Exception audioSinkError) | Deprecated.

Called when AudioSink has encountered an error. | | void | onAudioUnderrun​(int bufferSize, long bufferSizeMs, long elapsedSinceLastFeedMs) | Deprecated.

Called when an audio underrun occurs. | | void | onDroppedFrames​(int count, long elapsedMs) | Deprecated.

Called to report the number of frames dropped by the video renderer. | | void | onRenderedFirstFrame​(Object output, long renderTimeMs) | Deprecated.

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 | onVideoCodecError​(Exception videoCodecError) | Deprecated.

Called when a video decoder encounters an error. | | void | onVideoDecoderInitialized​(String decoderName, long initializedTimestampMs, long initializationDurationMs) | Deprecated.

Called when a video decoder is created. | | void | onVideoDecoderReleased​(String decoderName) | Deprecated.

Called when a video decoder is released. | | void | onVideoDisabled​(DecoderCounters counters) | Deprecated.

Called when the video renderer is disabled. | | void | onVideoEnabled​(DecoderCounters counters) | Deprecated.

Called when the video renderer is enabled. | | void | onVideoFrameProcessingOffset​(long totalProcessingOffsetUs, int frameCount) | Deprecated.

Called to report the video processing offset of video frames processed by the video renderer. | | void | onVideoInputFormatChanged​(Format format, DecoderReuseEvaluation decoderReuseEvaluation) | Deprecated.

Called when the format of the media being consumed by the video renderer changes. | | void | release() | Deprecated.

Releases the collector. | | void | removeListener​(AnalyticsListener listener) | Deprecated.

Removes a previously added analytics event listener. | | void | setPlayer​(Player player, Looper looper) | Deprecated.

Sets the player for which data will be collected. | | void | updateMediaPeriodQueueInfo​(List<MediaSource.MediaPeriodId> queue, MediaSource.MediaPeriodId readingPeriod) | Deprecated.

Updates the playback queue information used for event association. |

- 

Methods inherited from interface com.google.android.exoplayer2.upstream.BandwidthMeter.EventListener

onBandwidthSample

- 

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

onDrmKeysLoaded, onDrmKeysRemoved, onDrmKeysRestored, onDrmSessionAcquired, onDrmSessionAcquired, onDrmSessionManagerError, onDrmSessionReleased

- 

Methods inherited from interface com.google.android.exoplayer2.source.MediaSourceEventListener

onDownstreamFormatChanged, onLoadCanceled, onLoadCompleted, onLoadError, onLoadStarted, onUpstreamDiscarded

- 

Methods inherited from interface com.google.android.exoplayer2.Player.Listener

onAudioAttributesChanged, onAudioSessionIdChanged, onAvailableCommandsChanged, onCues, onCues, onDeviceInfoChanged, onDeviceVolumeChanged, onEvents, onIsLoadingChanged, onIsPlayingChanged, onLoadingChanged, onMaxSeekToPreviousPositionChanged, onMediaItemTransition, onMediaMetadataChanged, onMetadata, onPlaybackParametersChanged, onPlaybackStateChanged, onPlaybackSuppressionReasonChanged, onPlayerError, onPlayerErrorChanged, onPlayerStateChanged, onPlaylistMetadataChanged, onPlayWhenReadyChanged, onPositionDiscontinuity, onPositionDiscontinuity, onRenderedFirstFrame, onRepeatModeChanged, onSeekBackIncrementChanged, onSeekForwardIncrementChanged, onShuffleModeEnabledChanged, onSkipSilenceEnabledChanged, onSurfaceSizeChanged, onTimelineChanged, onTracksChanged, onTrackSelectionParametersChanged, onVideoSizeChanged, onVolumeChanged

Method Detail

- 

addListener

void addListener​([AnalyticsListener](AnalyticsListener.html "interface in com.google.android.exoplayer2.analytics")listener)

Deprecated.

Adds a listener for analytics events. Parameters:listener - The listener to add.

- 

removeListener

void removeListener​([AnalyticsListener](AnalyticsListener.html "interface in com.google.android.exoplayer2.analytics")listener)

Deprecated.

Removes a previously added analytics event listener. Parameters:listener - The listener to remove.

- 

setPlayer

void setPlayer​([Player](../Player.html "interface in com.google.android.exoplayer2")player,[Looper](https://developer.android.com/reference/android/os/Looper.html "class or interface in android.os")looper)

Deprecated.

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:player - The Player for which data will be collected.looper - The Looper used for listener callbacks.

- 

release

void release()

Deprecated.

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

- 

updateMediaPeriodQueueInfo

void updateMediaPeriodQueueInfo​([List](https://developer.android.com/reference/java/util/List.html "class or interface in java.util")<[MediaSource.MediaPeriodId](../source/MediaSource.MediaPeriodId.html "class in com.google.android.exoplayer2.source")> queue,
                                @Nullable[MediaSource.MediaPeriodId](../source/MediaSource.MediaPeriodId.html "class in com.google.android.exoplayer2.source")readingPeriod)

Deprecated.

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:queue - The playback queue of media periods identified by their MediaSource.MediaPeriodId.readingPeriod - The media period in the queue that is currently being read by renderers, or null if the queue is empty.

- 

notifySeekStarted

void notifySeekStarted()

Deprecated.

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

- 

onAudioEnabled

void onAudioEnabled​([DecoderCounters](../decoder/DecoderCounters.html "class in com.google.android.exoplayer2.decoder")counters)

Deprecated.

Called when the audio renderer is enabled. Parameters:counters - DecoderCounters that will be updated by the audio renderer for as long as it remains enabled.

- 

onAudioDecoderInitialized

void onAudioDecoderInitialized​([String](https://developer.android.com/reference/java/lang/String.html "class or interface in java.lang")decoderName,
                               long initializedTimestampMs,
                               long initializationDurationMs)

Deprecated.

Called when a audio decoder is created. Parameters:decoderName - The audio decoder that was created.initializedTimestampMs - SystemClock.elapsedRealtime() when initialization finished.initializationDurationMs - The time taken to initialize the decoder in milliseconds.

- 

onAudioInputFormatChanged

void onAudioInputFormatChanged​([Format](../Format.html "class in com.google.android.exoplayer2")format,
                               @Nullable[DecoderReuseEvaluation](../decoder/DecoderReuseEvaluation.html "class in com.google.android.exoplayer2.decoder")decoderReuseEvaluation)

Deprecated.

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

- 

onAudioPositionAdvancing

void onAudioPositionAdvancing​(long playoutStartSystemTimeMs)

Deprecated.

Called when the audio position has increased for the first time since the last pause or position reset. Parameters:playoutStartSystemTimeMs - The approximate derived System.currentTimeMillis() at which playout started.

- 

onAudioUnderrun

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

Deprecated.

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

- 

onAudioDecoderReleased

void onAudioDecoderReleased​([String](https://developer.android.com/reference/java/lang/String.html "class or interface in java.lang")decoderName)

Deprecated.

Called when a audio decoder is released. Parameters:decoderName - The audio decoder that was released.

- 

onAudioDisabled

void onAudioDisabled​([DecoderCounters](../decoder/DecoderCounters.html "class in com.google.android.exoplayer2.decoder")counters)

Deprecated.

Called when the audio renderer is disabled. Parameters:counters - DecoderCounters that were updated by the audio renderer.

- 

onAudioSinkError

void onAudioSinkError​([Exception](https://developer.android.com/reference/java/lang/Exception.html "class or interface in java.lang")audioSinkError)

Deprecated.

Called when AudioSink has encountered an error.

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

Parameters:audioSinkError - The error that occurred. Typically an AudioSink.InitializationException, a AudioSink.WriteException, or an AudioSink.UnexpectedDiscontinuityException.

- 

onAudioCodecError

void onAudioCodecError​([Exception](https://developer.android.com/reference/java/lang/Exception.html "class or interface in java.lang")audioCodecError)

Deprecated.

Called when an audio decoder encounters an error. Parameters:audioCodecError - The error. Typically a MediaCodec.CodecException if the renderer uses MediaCodec, or a DecoderException if the renderer uses a software decoder.

- 

onVideoEnabled

void onVideoEnabled​([DecoderCounters](../decoder/DecoderCounters.html "class in com.google.android.exoplayer2.decoder")counters)

Deprecated.

Called when the video renderer is enabled. Parameters:counters - DecoderCounters that will be updated by the video renderer for as long as it remains enabled.

- 

onVideoDecoderInitialized

void onVideoDecoderInitialized​([String](https://developer.android.com/reference/java/lang/String.html "class or interface in java.lang")decoderName,
                               long initializedTimestampMs,
                               long initializationDurationMs)

Deprecated.

Called when a video decoder is created. Parameters:decoderName - The decoder that was created.initializedTimestampMs - SystemClock.elapsedRealtime() when initialization finished.initializationDurationMs - The time taken to initialize the decoder in milliseconds.

- 

onVideoInputFormatChanged

void onVideoInputFormatChanged​([Format](../Format.html "class in com.google.android.exoplayer2")format,
                               @Nullable[DecoderReuseEvaluation](../decoder/DecoderReuseEvaluation.html "class in com.google.android.exoplayer2.decoder")decoderReuseEvaluation)

Deprecated.

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

- 

onDroppedFrames

void onDroppedFrames​(int count,
                     long elapsedMs)

Deprecated.

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:count - The number of dropped frames.elapsedMs - The duration in milliseconds over which the frames were dropped. This duration is timed from when the renderer was started or from when dropped frames were last reported (whichever was more recent), and not from when the first of the reported drops occurred.

- 

onVideoDecoderReleased

void onVideoDecoderReleased​([String](https://developer.android.com/reference/java/lang/String.html "class or interface in java.lang")decoderName)

Deprecated.

Called when a video decoder is released. Parameters:decoderName - The video decoder that was released.

- 

onVideoDisabled

void onVideoDisabled​([DecoderCounters](../decoder/DecoderCounters.html "class in com.google.android.exoplayer2.decoder")counters)

Deprecated.

Called when the video renderer is disabled. Parameters:counters - DecoderCounters that were updated by the video renderer.

- 

onRenderedFirstFrame

void onRenderedFirstFrame​([Object](https://developer.android.com/reference/java/lang/Object.html "class or interface in java.lang")output,
                          long renderTimeMs)

Deprecated.

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:output - The output of the video renderer. Normally a Surface, however some video renderers may have other output types (e.g., a VideoDecoderOutputBufferRenderer).renderTimeMs - The SystemClock.elapsedRealtime() when the frame was rendered.

- 

onVideoFrameProcessingOffset

void onVideoFrameProcessingOffset​(long totalProcessingOffsetUs,
                                  int frameCount)

Deprecated.

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:totalProcessingOffsetUs - The sum of all video frame processing offset samples for the video frames processed by the renderer in microseconds.frameCount - The number of samples included in the totalProcessingOffsetUs.

- 

onVideoCodecError

void onVideoCodecError​([Exception](https://developer.android.com/reference/java/lang/Exception.html "class or interface in java.lang")videoCodecError)

Deprecated.

Called when a video decoder encounters an error.

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

Parameters:videoCodecError - The error. Typically a MediaCodec.CodecException if the renderer uses MediaCodec, or a DecoderException if the renderer uses a software decoder.