AnalyticsListener


public interface AnalyticsListener

Known direct subclasses
EventLogger

Logs events from Player and other core components using Log.

MediaMetricsListener

An AnalyticsListener that interacts with the Android MediaMetricsManager.

PlaybackStatsListener

AnalyticsListener to gather PlaybackStats from the player.


A listener for analytics events.

All events are recorded with an EventTime specifying the elapsed real time and media time at the time of the event.

All methods have no-op default implementations to allow selective overrides.

Listeners can choose to implement individual events (e.g. onIsPlayingChanged) or onEvents, which is called after one or more events occurred together.

Summary

Nested types

@UnstableApi
@Documented
@Retention(value = RetentionPolicy.SOURCE)
@Target(value = )
@IntDef(value = )
public annotation AnalyticsListener.EventFlags

Events that can be reported via onEvents.

Time information of an event.

A set of EventFlags.

Constants

default static final int

Audio attributes changed.

default static final int

The audio codec encountered an error.

default static final int

An audio renderer created a decoder.

default static final int

An audio renderer released a decoder.

default static final int

An audio renderer was disabled.

default static final int

An audio renderer was enabled.

default static final int

The format consumed by an audio renderer changed.

default static final int

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

default static final int

An audio session id was set.

default static final int

The audio sink encountered a non-fatal error.

default static final int

An audio track has been initialized.

default static final int

An audio track has been released.

default static final int

An audio underrun occurred.

default static final int

getAvailableCommands changed.

default static final int

The bandwidth estimate has been updated.

default static final int

getCurrentCues changed.

default static final int

getDeviceInfo changed.

default static final int

getDeviceVolume changed.

default static final int

The downstream format sent to renderers changed.

default static final int

DRM keys were loaded.

default static final int

DRM keys were removed.

default static final int

DRM keys were restored.

default static final int

A DRM session has been acquired.

default static final int

A non-fatal DRM session manager error occurred.

default static final int

A DRM session has been released.

default static final int

Video frames have been dropped.

default static final int

isLoading ()} changed.

default static final int

isPlaying changed.

default static final int

A source canceled loading data.

default static final int

A source started completed loading data.

default static final int

A source had a non-fatal error loading data.

default static final int

A source started loading data.

default static final int

getMaxSeekToPreviousPosition changed.

default static final int

getCurrentMediaItem changed or the player started repeating the current item.

default static final int

getMediaMetadata changed.

default static final int

Metadata associated with the current playback time was reported.

default static final int

getPlaybackParameters changed.

default static final int

getPlaybackState changed.

default static final int

getPlaybackSuppressionReason changed.

default static final int

getPlayerError changed.

default static final int

The player was released.

default static final int

getPlaylistMetadata changed.

default static final int

getPlayWhenReady changed.

default static final int

A position discontinuity occurred.

default static final int

The first frame has been rendered since setting the surface, since the renderer was reset or since the stream changed.

default static final int

A renderer changed its readiness for playback.

default static final int

getRepeatMode changed.

default static final int

getSeekBackIncrement changed.

default static final int

getSeekForwardIncrement changed.

default static final int

getShuffleModeEnabled changed.

default static final int

Skipping silences was enabled or disabled in the audio stream.

default static final int

The surface size changed.

default static final int

getCurrentTimeline changed.

default static final int

getCurrentTracks changed.

default static final int

getTrackSelectionParameters changed.

default static final int

Data was removed from the end of the media buffer.

default static final int

The video codec encountered an error.

default static final int

A video renderer created a decoder.

default static final int

A video renderer released a decoder.

default static final int

A video renderer was disabled.

default static final int

A video renderer was enabled.

default static final int

Video frame processing offset data has been reported.

default static final int

The format consumed by a video renderer changed.

default static final int

The video size changed.

default static final int

The volume changed.

Public methods

default void

Called when the audio attributes change.

default void
@UnstableApi
onAudioCodecError(
    AnalyticsListener.EventTime eventTime,
    Exception audioCodecError
)

Called when an audio decoder encounters an error.

default void
@UnstableApi
onAudioDecoderInitialized(
    AnalyticsListener.EventTime eventTime,
    String decoderName,
    long initializationDurationMs
)

This method is deprecated.

Use onAudioDecoderInitialized.

default void
@UnstableApi
onAudioDecoderInitialized(
    AnalyticsListener.EventTime eventTime,
    String decoderName,
    long initializedTimestampMs,
    long initializationDurationMs
)

Called when an audio renderer creates a decoder.

default void
@UnstableApi
onAudioDecoderReleased(
    AnalyticsListener.EventTime eventTime,
    String decoderName
)

Called when an audio renderer releases a decoder.

default void
@UnstableApi
onAudioDisabled(
    AnalyticsListener.EventTime eventTime,
    DecoderCounters decoderCounters
)

Called when an audio renderer is disabled.

default void
@UnstableApi
onAudioEnabled(
    AnalyticsListener.EventTime eventTime,
    DecoderCounters decoderCounters
)

Called when an audio renderer is enabled.

default void
@UnstableApi
onAudioInputFormatChanged(
    AnalyticsListener.EventTime eventTime,
    Format format,
    @Nullable DecoderReuseEvaluation decoderReuseEvaluation
)

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

default void
@UnstableApi
onAudioPositionAdvancing(
    AnalyticsListener.EventTime eventTime,
    long playoutStartSystemTimeMs
)

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

default void
@UnstableApi
onAudioSessionIdChanged(
    AnalyticsListener.EventTime eventTime,
    int audioSessionId
)

Called when the audio session ID changes.

default void
@UnstableApi
onAudioSinkError(
    AnalyticsListener.EventTime eventTime,
    Exception audioSinkError
)

Called when AudioSink has encountered an error.

default void

Called when an AudioTrack has been initialized.

default void

Called when an AudioTrack has been released.

default void
@UnstableApi
onAudioUnderrun(
    AnalyticsListener.EventTime eventTime,
    int bufferSize,
    long bufferSizeMs,
    long elapsedSinceLastFeedMs
)

Called when an audio underrun occurs.

default void

Called when the player's available commands changed.

default void
@UnstableApi
onBandwidthEstimate(
    AnalyticsListener.EventTime eventTime,
    int totalLoadTimeMs,
    long totalBytesLoaded,
    long bitrateEstimate
)

Called when the bandwidth estimate for the current data source has been updated.

default void

Called when there is a change in the CueGroup.

default void

This method is deprecated.

Use onCues instead.

default void

Called when the device information changes

default void
@UnstableApi
onDeviceVolumeChanged(
    AnalyticsListener.EventTime eventTime,
    int volume,
    boolean muted
)

Called when the device volume or mute state changes.

default void

Called when the downstream format sent to the renderers changed.

default void

Called each time drm keys are loaded.

default void

Called each time offline drm keys are removed.

default void

Called each time offline drm keys are restored.

default void

This method is deprecated.

Implement onDrmSessionAcquired instead.

default void

Called each time a drm session is acquired.

default void

Called when a drm error occurs.

default void

Called each time a drm session is released.

default void
@UnstableApi
onDroppedVideoFrames(
    AnalyticsListener.EventTime eventTime,
    int droppedFrames,
    long elapsedMs
)

Called after video frames have been dropped.

default void

Called after one or more events occurred.

default void
@UnstableApi
onIsLoadingChanged(
    AnalyticsListener.EventTime eventTime,
    boolean isLoading
)

Called when the player starts or stops loading data from a source.

default void
@UnstableApi
onIsPlayingChanged(
    AnalyticsListener.EventTime eventTime,
    boolean isPlaying
)

Called when the player starts or stops playing.

default void
@UnstableApi
onLoadCanceled(
    AnalyticsListener.EventTime eventTime,
    LoadEventInfo loadEventInfo,
    MediaLoadData mediaLoadData
)

Called when a media source canceled loading data.

default void
@UnstableApi
onLoadCompleted(
    AnalyticsListener.EventTime eventTime,
    LoadEventInfo loadEventInfo,
    MediaLoadData mediaLoadData
)

Called when a media source completed loading data.

default void
@UnstableApi
onLoadError(
    AnalyticsListener.EventTime eventTime,
    LoadEventInfo loadEventInfo,
    MediaLoadData mediaLoadData,
    IOException error,
    boolean wasCanceled
)

Called when a media source loading error occurred.

default void
@UnstableApi
onLoadStarted(
    AnalyticsListener.EventTime eventTime,
    LoadEventInfo loadEventInfo,
    MediaLoadData mediaLoadData
)

Called when a media source started loading data.

default void
@UnstableApi
onLoadingChanged(
    AnalyticsListener.EventTime eventTime,
    boolean isLoading
)

This method is deprecated.

Use onIsLoadingChanged instead.

default void
@UnstableApi
onMaxSeekToPreviousPositionChanged(
    AnalyticsListener.EventTime eventTime,
    long maxSeekToPreviousPositionMs
)

Called when the maximum position for which seekToPrevious seeks to the previous window changes.

default void

Called when playback transitions to a different media item.

default void

Called when the combined MediaMetadata changes.

default void

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

default void
@UnstableApi
onPlayWhenReadyChanged(
    AnalyticsListener.EventTime eventTime,
    boolean playWhenReady,
    @Player.PlayWhenReadyChangeReason int reason
)

Called when the value changed that indicates whether playback will proceed when ready.

default void

Called when the playback parameters changed.

default void

Called when the playback state changed.

default void

Called when playback suppression reason changed.

default void

Called when a fatal player error occurred.

default void

Called when the PlaybackException returned by getPlayerError changes.

default void

Called when the Player is released.

default void
@UnstableApi
onPlayerStateChanged(
    AnalyticsListener.EventTime eventTime,
    boolean playWhenReady,
    @Player.State int playbackState
)

This method is deprecated.

Use onPlaybackStateChanged and onPlayWhenReadyChanged instead.

default void

Called when the playlist MediaMetadata changes.

default void

This method is deprecated.

Use onPositionDiscontinuity instead.

default void
@UnstableApi
onPositionDiscontinuity(
    AnalyticsListener.EventTime eventTime,
    Player.PositionInfo oldPosition,
    Player.PositionInfo newPosition,
    @Player.DiscontinuityReason int reason
)

Called when a position discontinuity occurred.

default void
@UnstableApi
onRenderedFirstFrame(
    AnalyticsListener.EventTime eventTime,
    Object output,
    long renderTimeMs
)

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
@UnstableApi
onRendererReadyChanged(
    AnalyticsListener.EventTime eventTime,
    int rendererIndex,
    @C.TrackType int rendererTrackType,
    boolean isRendererReady
)

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

default void

Called when the repeat mode changed.

default void
@UnstableApi
onSeekBackIncrementChanged(
    AnalyticsListener.EventTime eventTime,
    long seekBackIncrementMs
)

Called when the seek back increment changed.

default void
@UnstableApi
onSeekForwardIncrementChanged(
    AnalyticsListener.EventTime eventTime,
    long seekForwardIncrementMs
)

Called when the seek forward increment changed.

default void

This method is deprecated.

Use onPositionDiscontinuity instead, listening to changes with DISCONTINUITY_REASON_SEEK.

default void
@UnstableApi
onShuffleModeChanged(
    AnalyticsListener.EventTime eventTime,
    boolean shuffleModeEnabled
)

Called when the shuffle mode changed.

default void
@UnstableApi
onSkipSilenceEnabledChanged(
    AnalyticsListener.EventTime eventTime,
    boolean skipSilenceEnabled
)

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

default void
@UnstableApi
onSurfaceSizeChanged(
    AnalyticsListener.EventTime eventTime,
    int width,
    int height
)

Called when the output surface size changed.

default void

Called when the timeline changed.

default void

Called when track selection parameters change.

default void

Called when the tracks change.

default void

Called when data is removed from the back of a media buffer, typically so that it can be re-buffered in a different format.

default void
@UnstableApi
onVideoCodecError(
    AnalyticsListener.EventTime eventTime,
    Exception videoCodecError
)

Called when a video decoder encounters an error.

default void
@UnstableApi
onVideoDecoderInitialized(
    AnalyticsListener.EventTime eventTime,
    String decoderName,
    long initializationDurationMs
)

This method is deprecated.

Use onVideoDecoderInitialized.

default void
@UnstableApi
onVideoDecoderInitialized(
    AnalyticsListener.EventTime eventTime,
    String decoderName,
    long initializedTimestampMs,
    long initializationDurationMs
)

Called when a video renderer creates a decoder.

default void
@UnstableApi
onVideoDecoderReleased(
    AnalyticsListener.EventTime eventTime,
    String decoderName
)

Called when a video renderer releases a decoder.

default void
@UnstableApi
onVideoDisabled(
    AnalyticsListener.EventTime eventTime,
    DecoderCounters decoderCounters
)

Called when a video renderer is disabled.

default void
@UnstableApi
onVideoEnabled(
    AnalyticsListener.EventTime eventTime,
    DecoderCounters decoderCounters
)

Called when a video renderer is enabled.

default void
@UnstableApi
onVideoFrameProcessingOffset(
    AnalyticsListener.EventTime eventTime,
    long totalProcessingOffsetUs,
    int frameCount
)

Called when there is an update to the video frame processing offset reported by a video renderer.

default void
@UnstableApi
onVideoInputFormatChanged(
    AnalyticsListener.EventTime eventTime,
    Format format,
    @Nullable DecoderReuseEvaluation decoderReuseEvaluation
)

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

default void

Called before a frame is rendered for the first time since setting the surface, and each time there's a change in the size or pixel aspect ratio of the video being rendered.

default void
@UnstableApi
onVideoSizeChanged(
    AnalyticsListener.EventTime eventTime,
    int width,
    int height,
    int unappliedRotationDegrees,
    float pixelWidthHeightRatio
)

This method is deprecated.

Implement onVideoSizeChanged instead.

default void

Called when the volume changes.

Constants

EVENT_AUDIO_ATTRIBUTES_CHANGED

@UnstableApi
default static final int EVENT_AUDIO_ATTRIBUTES_CHANGED = 20

Audio attributes changed.

EVENT_AUDIO_CODEC_ERROR

@UnstableApi
default static final int EVENT_AUDIO_CODEC_ERROR = 1029

The audio codec encountered an error.

EVENT_AUDIO_DECODER_INITIALIZED

@UnstableApi
default static final int EVENT_AUDIO_DECODER_INITIALIZED = 1008

An audio renderer created a decoder.

EVENT_AUDIO_DECODER_RELEASED

@UnstableApi
default static final int EVENT_AUDIO_DECODER_RELEASED = 1012

An audio renderer released a decoder.

EVENT_AUDIO_DISABLED

@UnstableApi
default static final int EVENT_AUDIO_DISABLED = 1013

An audio renderer was disabled.

EVENT_AUDIO_ENABLED

@UnstableApi
default static final int EVENT_AUDIO_ENABLED = 1007

An audio renderer was enabled.

EVENT_AUDIO_INPUT_FORMAT_CHANGED

@UnstableApi
default static final int EVENT_AUDIO_INPUT_FORMAT_CHANGED = 1009

The format consumed by an audio renderer changed.

EVENT_AUDIO_POSITION_ADVANCING

@UnstableApi
default static final int EVENT_AUDIO_POSITION_ADVANCING = 1010

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

EVENT_AUDIO_SESSION_ID

@UnstableApi
default static final int EVENT_AUDIO_SESSION_ID = 21

An audio session id was set.

EVENT_AUDIO_SINK_ERROR

@UnstableApi
default static final int EVENT_AUDIO_SINK_ERROR = 1014

The audio sink encountered a non-fatal error.

EVENT_AUDIO_TRACK_INITIALIZED

@UnstableApi
default static final int EVENT_AUDIO_TRACK_INITIALIZED = 1031

An audio track has been initialized.

EVENT_AUDIO_TRACK_RELEASED

@UnstableApi
default static final int EVENT_AUDIO_TRACK_RELEASED = 1032

An audio track has been released.

EVENT_AUDIO_UNDERRUN

@UnstableApi
default static final int EVENT_AUDIO_UNDERRUN = 1011

An audio underrun occurred.

EVENT_AVAILABLE_COMMANDS_CHANGED

@UnstableApi
default static final int EVENT_AVAILABLE_COMMANDS_CHANGED = 13

getAvailableCommands changed.

EVENT_BANDWIDTH_ESTIMATE

@UnstableApi
default static final int EVENT_BANDWIDTH_ESTIMATE = 1006

The bandwidth estimate has been updated.

EVENT_CUES

@UnstableApi
default static final int EVENT_CUES = 27

getCurrentCues changed.

EVENT_DEVICE_INFO_CHANGED

@UnstableApi
default static final int EVENT_DEVICE_INFO_CHANGED = 29

getDeviceInfo changed.

EVENT_DEVICE_VOLUME_CHANGED

@UnstableApi
default static final int EVENT_DEVICE_VOLUME_CHANGED = 30

getDeviceVolume changed.

EVENT_DOWNSTREAM_FORMAT_CHANGED

@UnstableApi
default static final int EVENT_DOWNSTREAM_FORMAT_CHANGED = 1004

The downstream format sent to renderers changed.

EVENT_DRM_KEYS_LOADED

@UnstableApi
default static final int EVENT_DRM_KEYS_LOADED = 1023

DRM keys were loaded.

EVENT_DRM_KEYS_REMOVED

@UnstableApi
default static final int EVENT_DRM_KEYS_REMOVED = 1026

DRM keys were removed.

EVENT_DRM_KEYS_RESTORED

@UnstableApi
default static final int EVENT_DRM_KEYS_RESTORED = 1025

DRM keys were restored.

EVENT_DRM_SESSION_ACQUIRED

@UnstableApi
default static final int EVENT_DRM_SESSION_ACQUIRED = 1022

A DRM session has been acquired.

EVENT_DRM_SESSION_MANAGER_ERROR

@UnstableApi
default static final int EVENT_DRM_SESSION_MANAGER_ERROR = 1024

A non-fatal DRM session manager error occurred.

EVENT_DRM_SESSION_RELEASED

@UnstableApi
default static final int EVENT_DRM_SESSION_RELEASED = 1027

A DRM session has been released.

EVENT_DROPPED_VIDEO_FRAMES

@UnstableApi
default static final int EVENT_DROPPED_VIDEO_FRAMES = 1018

Video frames have been dropped.

EVENT_IS_LOADING_CHANGED

@UnstableApi
default static final int EVENT_IS_LOADING_CHANGED = 3

isLoading ()} changed.

EVENT_IS_PLAYING_CHANGED

@UnstableApi
default static final int EVENT_IS_PLAYING_CHANGED = 7

isPlaying changed.

EVENT_LOAD_CANCELED

@UnstableApi
default static final int EVENT_LOAD_CANCELED = 1002

A source canceled loading data.

EVENT_LOAD_COMPLETED

@UnstableApi
default static final int EVENT_LOAD_COMPLETED = 1001

A source started completed loading data.

EVENT_LOAD_ERROR

@UnstableApi
default static final int EVENT_LOAD_ERROR = 1003

A source had a non-fatal error loading data.

EVENT_LOAD_STARTED

@UnstableApi
default static final int EVENT_LOAD_STARTED = 1000

A source started loading data.

EVENT_MAX_SEEK_TO_PREVIOUS_POSITION_CHANGED

@UnstableApi
default static final int EVENT_MAX_SEEK_TO_PREVIOUS_POSITION_CHANGED = 18

getMaxSeekToPreviousPosition changed.

EVENT_MEDIA_ITEM_TRANSITION

@UnstableApi
default static final int EVENT_MEDIA_ITEM_TRANSITION = 1

getCurrentMediaItem changed or the player started repeating the current item.

EVENT_MEDIA_METADATA_CHANGED

@UnstableApi
default static final int EVENT_MEDIA_METADATA_CHANGED = 14

getMediaMetadata changed.

EVENT_METADATA

@UnstableApi
default static final int EVENT_METADATA = 28

Metadata associated with the current playback time was reported.

EVENT_PLAYBACK_PARAMETERS_CHANGED

@UnstableApi
default static final int EVENT_PLAYBACK_PARAMETERS_CHANGED = 12

getPlaybackParameters changed.

EVENT_PLAYBACK_STATE_CHANGED

@UnstableApi
default static final int EVENT_PLAYBACK_STATE_CHANGED = 4

getPlaybackState changed.

EVENT_PLAYBACK_SUPPRESSION_REASON_CHANGED

@UnstableApi
default static final int EVENT_PLAYBACK_SUPPRESSION_REASON_CHANGED = 6

getPlaybackSuppressionReason changed.

EVENT_PLAYER_ERROR

@UnstableApi
default static final int EVENT_PLAYER_ERROR = 10

getPlayerError changed.

EVENT_PLAYER_RELEASED

@UnstableApi
default static final int EVENT_PLAYER_RELEASED = 1028

The player was released.

EVENT_PLAYLIST_METADATA_CHANGED

@UnstableApi
default static final int EVENT_PLAYLIST_METADATA_CHANGED = 15

getPlaylistMetadata changed.

EVENT_PLAY_WHEN_READY_CHANGED

@UnstableApi
default static final int EVENT_PLAY_WHEN_READY_CHANGED = 5

getPlayWhenReady changed.

EVENT_POSITION_DISCONTINUITY

@UnstableApi
default static final int EVENT_POSITION_DISCONTINUITY = 11

A position discontinuity occurred. See onPositionDiscontinuity.

EVENT_RENDERED_FIRST_FRAME

@UnstableApi
default static final int EVENT_RENDERED_FIRST_FRAME = 26

The first frame has been rendered since setting the surface, since the renderer was reset or since the stream changed.

EVENT_RENDERER_READY_CHANGED

@UnstableApi
default static final int EVENT_RENDERER_READY_CHANGED = 1033

A renderer changed its readiness for playback.

EVENT_REPEAT_MODE_CHANGED

@UnstableApi
default static final int EVENT_REPEAT_MODE_CHANGED = 8

getRepeatMode changed.

EVENT_SEEK_BACK_INCREMENT_CHANGED

@UnstableApi
default static final int EVENT_SEEK_BACK_INCREMENT_CHANGED = 16

getSeekBackIncrement changed.

EVENT_SEEK_FORWARD_INCREMENT_CHANGED

@UnstableApi
default static final int EVENT_SEEK_FORWARD_INCREMENT_CHANGED = 17

getSeekForwardIncrement changed.

EVENT_SHUFFLE_MODE_ENABLED_CHANGED

@UnstableApi
default static final int EVENT_SHUFFLE_MODE_ENABLED_CHANGED = 9

getShuffleModeEnabled changed.

EVENT_SKIP_SILENCE_ENABLED_CHANGED

@UnstableApi
default static final int EVENT_SKIP_SILENCE_ENABLED_CHANGED = 23

Skipping silences was enabled or disabled in the audio stream.

EVENT_SURFACE_SIZE_CHANGED

@UnstableApi
default static final int EVENT_SURFACE_SIZE_CHANGED = 24

The surface size changed.

EVENT_TIMELINE_CHANGED

@UnstableApi
default static final int EVENT_TIMELINE_CHANGED = 0

getCurrentTimeline changed.

EVENT_TRACKS_CHANGED

@UnstableApi
default static final int EVENT_TRACKS_CHANGED = 2

getCurrentTracks changed.

EVENT_TRACK_SELECTION_PARAMETERS_CHANGED

@UnstableApi
default static final int EVENT_TRACK_SELECTION_PARAMETERS_CHANGED = 19

getTrackSelectionParameters changed.

EVENT_UPSTREAM_DISCARDED

@UnstableApi
default static final int EVENT_UPSTREAM_DISCARDED = 1005

Data was removed from the end of the media buffer.

EVENT_VIDEO_CODEC_ERROR

@UnstableApi
default static final int EVENT_VIDEO_CODEC_ERROR = 1030

The video codec encountered an error.

EVENT_VIDEO_DECODER_INITIALIZED

@UnstableApi
default static final int EVENT_VIDEO_DECODER_INITIALIZED = 1016

A video renderer created a decoder.

EVENT_VIDEO_DECODER_RELEASED

@UnstableApi
default static final int EVENT_VIDEO_DECODER_RELEASED = 1019

A video renderer released a decoder.

EVENT_VIDEO_DISABLED

@UnstableApi
default static final int EVENT_VIDEO_DISABLED = 1020

A video renderer was disabled.

EVENT_VIDEO_ENABLED

@UnstableApi
default static final int EVENT_VIDEO_ENABLED = 1015

A video renderer was enabled.

EVENT_VIDEO_FRAME_PROCESSING_OFFSET

@UnstableApi
default static final int EVENT_VIDEO_FRAME_PROCESSING_OFFSET = 1021

Video frame processing offset data has been reported.

EVENT_VIDEO_INPUT_FORMAT_CHANGED

@UnstableApi
default static final int EVENT_VIDEO_INPUT_FORMAT_CHANGED = 1017

The format consumed by a video renderer changed.

EVENT_VIDEO_SIZE_CHANGED

@UnstableApi
default static final int EVENT_VIDEO_SIZE_CHANGED = 25

The video size changed.

EVENT_VOLUME_CHANGED

@UnstableApi
default static final int EVENT_VOLUME_CHANGED = 22

The volume changed.

Public methods

onAudioAttributesChanged

@UnstableApi
default void onAudioAttributesChanged(
    AnalyticsListener.EventTime eventTime,
    AudioAttributes audioAttributes
)

Called when the audio attributes change.

Parameters
AnalyticsListener.EventTime eventTime

The event time.

AudioAttributes audioAttributes

The audio attributes.

onAudioCodecError

@UnstableApi
default void onAudioCodecError(
    AnalyticsListener.EventTime eventTime,
    Exception audioCodecError
)

Called when an audio 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. onPlayerError 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
AnalyticsListener.EventTime eventTime

The event time.

Exception audioCodecError

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

onAudioDecoderInitialized

@UnstableApi
default void onAudioDecoderInitialized(
    AnalyticsListener.EventTime eventTime,
    String decoderName,
    long initializationDurationMs
)

onAudioDecoderInitialized

@UnstableApi
default void onAudioDecoderInitialized(
    AnalyticsListener.EventTime eventTime,
    String decoderName,
    long initializedTimestampMs,
    long initializationDurationMs
)

Called when an audio renderer creates a decoder.

Parameters
AnalyticsListener.EventTime eventTime

The event time.

String decoderName

The decoder that was created.

long initializedTimestampMs

elapsedRealtime when initialization finished.

long initializationDurationMs

The time taken to initialize the decoder in milliseconds.

onAudioDecoderReleased

@UnstableApi
default void onAudioDecoderReleased(
    AnalyticsListener.EventTime eventTime,
    String decoderName
)

Called when an audio renderer releases a decoder.

Parameters
AnalyticsListener.EventTime eventTime

The event time.

String decoderName

The decoder that was released.

onAudioDisabled

@UnstableApi
default void onAudioDisabled(
    AnalyticsListener.EventTime eventTime,
    DecoderCounters decoderCounters
)

Called when an audio renderer is disabled.

Parameters
AnalyticsListener.EventTime eventTime

The event time.

DecoderCounters decoderCounters

DecoderCounters that were updated by the renderer.

onAudioEnabled

@UnstableApi
default void onAudioEnabled(
    AnalyticsListener.EventTime eventTime,
    DecoderCounters decoderCounters
)

Called when an audio renderer is enabled.

Parameters
AnalyticsListener.EventTime eventTime

The event time.

DecoderCounters decoderCounters

DecoderCounters that will be updated by the renderer for as long as it remains enabled.

onAudioInputFormatChanged

@UnstableApi
default void onAudioInputFormatChanged(
    AnalyticsListener.EventTime eventTime,
    Format format,
    @Nullable DecoderReuseEvaluation decoderReuseEvaluation
)

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

Parameters
AnalyticsListener.EventTime eventTime

The event time.

Format format

The new format.

@Nullable 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

@UnstableApi
default void onAudioPositionAdvancing(
    AnalyticsListener.EventTime eventTime,
    long playoutStartSystemTimeMs
)

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

Parameters
AnalyticsListener.EventTime eventTime

The event time.

long playoutStartSystemTimeMs

The approximate derived currentTimeMillis at which playout started.

onAudioSessionIdChanged

@UnstableApi
default void onAudioSessionIdChanged(
    AnalyticsListener.EventTime eventTime,
    int audioSessionId
)

Called when the audio session ID changes.

Parameters
AnalyticsListener.EventTime eventTime

The event time.

int audioSessionId

The audio session ID.

onAudioSinkError

@UnstableApi
default void onAudioSinkError(
    AnalyticsListener.EventTime eventTime,
    Exception audioSinkError
)

Called when AudioSink has encountered 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. onPlayerError 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
AnalyticsListener.EventTime eventTime

The event time.

Exception audioSinkError

The error that occurred. Typically an , a AudioSink.WriteException, or an .

onAudioTrackInitialized

@UnstableApi
default void onAudioTrackInitialized(
    AnalyticsListener.EventTime eventTime,
    AudioSink.AudioTrackConfig audioTrackConfig
)

Called when an AudioTrack has been initialized.

Parameters
AnalyticsListener.EventTime eventTime

The event time.

AudioSink.AudioTrackConfig audioTrackConfig

The AudioSink.AudioTrackConfig of the initialized .

onAudioTrackReleased

@UnstableApi
default void onAudioTrackReleased(
    AnalyticsListener.EventTime eventTime,
    AudioSink.AudioTrackConfig audioTrackConfig
)

Called when an AudioTrack has been released.

Parameters
AnalyticsListener.EventTime eventTime

The event time.

AudioSink.AudioTrackConfig audioTrackConfig

The AudioSink.AudioTrackConfig of the released .

onAudioUnderrun

@UnstableApi
default void onAudioUnderrun(
    AnalyticsListener.EventTime eventTime,
    int bufferSize,
    long bufferSizeMs,
    long elapsedSinceLastFeedMs
)

Called when an audio underrun occurs.

Parameters
AnalyticsListener.EventTime eventTime

The event time.

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

@UnstableApi
default void onAvailableCommandsChanged(
    AnalyticsListener.EventTime eventTime,
    Player.Commands availableCommands
)

Called when the player's available commands changed.

Parameters
AnalyticsListener.EventTime eventTime

The event time.

Player.Commands availableCommands

The available commands.

onBandwidthEstimate

@UnstableApi
default void onBandwidthEstimate(
    AnalyticsListener.EventTime eventTime,
    int totalLoadTimeMs,
    long totalBytesLoaded,
    long bitrateEstimate
)

Called when the bandwidth estimate for the current data source has been updated.

Parameters
AnalyticsListener.EventTime eventTime

The event time.

int totalLoadTimeMs

The total time spend loading this update is based on, in milliseconds.

long totalBytesLoaded

The total bytes loaded this update is based on.

long bitrateEstimate

The bandwidth estimate, in bits per second.

onCues

@UnstableApi
default void onCues(AnalyticsListener.EventTime eventTime, CueGroup cueGroup)

Called when there is a change in the CueGroup.

Both onCues and onCues are called when there is a change in the cues. You should only implement one or the other.

Parameters
AnalyticsListener.EventTime eventTime

The event time.

CueGroup cueGroup

The CueGroup.

onCues

@UnstableApi
default void onCues(AnalyticsListener.EventTime eventTime, List<Cue> cues)

Called when there is a change in the Cues.

Both onCues and onCues are called when there is a change in the cues. You should only implement one or the other.

Parameters
AnalyticsListener.EventTime eventTime

The event time.

List<Cue> cues

The Cues.

onDeviceInfoChanged

@UnstableApi
default void onDeviceInfoChanged(
    AnalyticsListener.EventTime eventTime,
    DeviceInfo deviceInfo
)

Called when the device information changes

Parameters
AnalyticsListener.EventTime eventTime

The event time.

DeviceInfo deviceInfo

The new DeviceInfo.

onDeviceVolumeChanged

@UnstableApi
default void onDeviceVolumeChanged(
    AnalyticsListener.EventTime eventTime,
    int volume,
    boolean muted
)

Called when the device volume or mute state changes.

Parameters
AnalyticsListener.EventTime eventTime

The event time.

int volume

The new device volume, with 0 being silence and 1 being unity gain.

boolean muted

Whether the device is muted.

onDownstreamFormatChanged

@UnstableApi
default void onDownstreamFormatChanged(
    AnalyticsListener.EventTime eventTime,
    MediaLoadData mediaLoadData
)

Called when the downstream format sent to the renderers changed.

Parameters
AnalyticsListener.EventTime eventTime

The event time.

MediaLoadData mediaLoadData

The MediaLoadData defining the newly selected media data.

onDrmKeysLoaded

@UnstableApi
default void onDrmKeysLoaded(AnalyticsListener.EventTime eventTime)

Called each time drm keys are loaded.

Parameters
AnalyticsListener.EventTime eventTime

The event time.

onDrmKeysRemoved

@UnstableApi
default void onDrmKeysRemoved(AnalyticsListener.EventTime eventTime)

Called each time offline drm keys are removed.

Parameters
AnalyticsListener.EventTime eventTime

The event time.

onDrmKeysRestored

@UnstableApi
default void onDrmKeysRestored(AnalyticsListener.EventTime eventTime)

Called each time offline drm keys are restored.

Parameters
AnalyticsListener.EventTime eventTime

The event time.

onDrmSessionAcquired

@UnstableApi
default void onDrmSessionAcquired(AnalyticsListener.EventTime eventTime)

onDrmSessionAcquired

@UnstableApi
default void onDrmSessionAcquired(
    AnalyticsListener.EventTime eventTime,
    @DrmSession.State int state
)

Called each time a drm session is acquired.

Parameters
AnalyticsListener.EventTime eventTime

The event time.

@DrmSession.State int state

The DrmSession.State of the session when the acquisition completed.

onDrmSessionManagerError

@UnstableApi
default void onDrmSessionManagerError(
    AnalyticsListener.EventTime eventTime,
    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. Hence applications should not implement this method to display a user visible error or initiate an application level retry. onPlayerError 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
AnalyticsListener.EventTime eventTime

The event time.

Exception error

The error.

onDrmSessionReleased

@UnstableApi
default void onDrmSessionReleased(AnalyticsListener.EventTime eventTime)

Called each time a drm session is released.

Parameters
AnalyticsListener.EventTime eventTime

The event time.

onDroppedVideoFrames

@UnstableApi
default void onDroppedVideoFrames(
    AnalyticsListener.EventTime eventTime,
    int droppedFrames,
    long elapsedMs
)

Called after video frames have been dropped.

Parameters
AnalyticsListener.EventTime eventTime

The event time.

int droppedFrames

The number of dropped frames since the last call to this method.

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.

onEvents

@UnstableApi
default void onEvents(Player player, AnalyticsListener.Events events)

Called after one or more events occurred.

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

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

Parameters
Player player

The Player.

AnalyticsListener.Events events

The Events that occurred in this iteration.

onIsLoadingChanged

@UnstableApi
default void onIsLoadingChanged(
    AnalyticsListener.EventTime eventTime,
    boolean isLoading
)

Called when the player starts or stops loading data from a source.

Parameters
AnalyticsListener.EventTime eventTime

The event time.

boolean isLoading

Whether the player is loading.

onIsPlayingChanged

@UnstableApi
default void onIsPlayingChanged(
    AnalyticsListener.EventTime eventTime,
    boolean isPlaying
)

Called when the player starts or stops playing.

Parameters
AnalyticsListener.EventTime eventTime

The event time.

boolean isPlaying

Whether the player is playing.

onLoadCanceled

@UnstableApi
default void onLoadCanceled(
    AnalyticsListener.EventTime eventTime,
    LoadEventInfo loadEventInfo,
    MediaLoadData mediaLoadData
)

Called when a media source canceled loading data.

Parameters
AnalyticsListener.EventTime eventTime

The event time.

LoadEventInfo loadEventInfo

The LoadEventInfo defining the load event.

MediaLoadData mediaLoadData

The MediaLoadData defining the data being loaded.

onLoadCompleted

@UnstableApi
default void onLoadCompleted(
    AnalyticsListener.EventTime eventTime,
    LoadEventInfo loadEventInfo,
    MediaLoadData mediaLoadData
)

Called when a media source completed loading data.

Parameters
AnalyticsListener.EventTime eventTime

The event time.

LoadEventInfo loadEventInfo

The LoadEventInfo defining the load event.

MediaLoadData mediaLoadData

The MediaLoadData defining the data being loaded.

onLoadError

@UnstableApi
default void onLoadError(
    AnalyticsListener.EventTime eventTime,
    LoadEventInfo loadEventInfo,
    MediaLoadData mediaLoadData,
    IOException error,
    boolean wasCanceled
)

Called when a media source loading error occurred.

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. onPlayerError 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
AnalyticsListener.EventTime eventTime

The event time.

LoadEventInfo loadEventInfo

The LoadEventInfo defining the load event.

MediaLoadData mediaLoadData

The MediaLoadData defining the data being loaded.

IOException error

The load error.

boolean wasCanceled

Whether the load was canceled as a result of the error.

onLoadStarted

@UnstableApi
default void onLoadStarted(
    AnalyticsListener.EventTime eventTime,
    LoadEventInfo loadEventInfo,
    MediaLoadData mediaLoadData
)

Called when a media source started loading data.

Parameters
AnalyticsListener.EventTime eventTime

The event time.

LoadEventInfo loadEventInfo

The LoadEventInfo defining the load event.

MediaLoadData mediaLoadData

The MediaLoadData defining the data being loaded.

onLoadingChanged

@UnstableApi
default void onLoadingChanged(
    AnalyticsListener.EventTime eventTime,
    boolean isLoading
)

onMaxSeekToPreviousPositionChanged

@UnstableApi
default void onMaxSeekToPreviousPositionChanged(
    AnalyticsListener.EventTime eventTime,
    long maxSeekToPreviousPositionMs
)

Called when the maximum position for which seekToPrevious seeks to the previous window changes.

Parameters
AnalyticsListener.EventTime eventTime

The event time.

long maxSeekToPreviousPositionMs

The maximum seek to previous position, in milliseconds.

onMediaItemTransition

@UnstableApi
default void onMediaItemTransition(
    AnalyticsListener.EventTime eventTime,
    @Nullable MediaItem mediaItem,
    @Player.MediaItemTransitionReason int reason
)

Called when playback transitions to a different media item.

Parameters
AnalyticsListener.EventTime eventTime

The event time.

@Nullable MediaItem mediaItem

The media item.

@Player.MediaItemTransitionReason int reason

The reason for the media item transition.

onMediaMetadataChanged

@UnstableApi
default void onMediaMetadataChanged(
    AnalyticsListener.EventTime eventTime,
    MediaMetadata mediaMetadata
)

Called when the combined MediaMetadata changes.

The provided MediaMetadata is a combination of the mediaMetadata and the static and dynamic metadata from the track selections' formats and onMetadata.

Parameters
AnalyticsListener.EventTime eventTime

The event time.

MediaMetadata mediaMetadata

The combined MediaMetadata.

onMetadata

@UnstableApi
default void onMetadata(AnalyticsListener.EventTime eventTime, Metadata metadata)

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

Parameters
AnalyticsListener.EventTime eventTime

The event time.

Metadata metadata

The metadata.

onPlayWhenReadyChanged

@UnstableApi
default void onPlayWhenReadyChanged(
    AnalyticsListener.EventTime eventTime,
    boolean playWhenReady,
    @Player.PlayWhenReadyChangeReason int reason
)

Called when the value changed that indicates whether playback will proceed when ready.

Parameters
AnalyticsListener.EventTime eventTime

The event time.

boolean playWhenReady

Whether playback will proceed when ready.

@Player.PlayWhenReadyChangeReason int reason

The reason of the change.

onPlaybackParametersChanged

@UnstableApi
default void onPlaybackParametersChanged(
    AnalyticsListener.EventTime eventTime,
    PlaybackParameters playbackParameters
)

Called when the playback parameters changed.

Parameters
AnalyticsListener.EventTime eventTime

The event time.

PlaybackParameters playbackParameters

The new playback parameters.

onPlaybackStateChanged

@UnstableApi
default void onPlaybackStateChanged(
    AnalyticsListener.EventTime eventTime,
    @Player.State int state
)

Called when the playback state changed.

Parameters
AnalyticsListener.EventTime eventTime

The event time.

@Player.State int state

The new playback state.

onPlaybackSuppressionReasonChanged

@UnstableApi
default void onPlaybackSuppressionReasonChanged(
    AnalyticsListener.EventTime eventTime,
    @Player.PlaybackSuppressionReason int playbackSuppressionReason
)

Called when playback suppression reason changed.

Parameters
AnalyticsListener.EventTime eventTime

The event time.

@Player.PlaybackSuppressionReason int playbackSuppressionReason

The new PlaybackSuppressionReason.

onPlayerError

@UnstableApi
default void onPlayerError(
    AnalyticsListener.EventTime eventTime,
    PlaybackException error
)

Called when a fatal player error occurred.

Implementations of Player may pass an instance of a subclass of to this method in order to include more information about the error.

Parameters
AnalyticsListener.EventTime eventTime

The event time.

PlaybackException error

The error.

onPlayerErrorChanged

@UnstableApi
default void onPlayerErrorChanged(
    AnalyticsListener.EventTime eventTime,
    @Nullable PlaybackException error
)

Called when the PlaybackException returned by getPlayerError changes.

Implementations of Player may pass an instance of a subclass of PlaybackException to this method in order to include more information about the error.

Parameters
AnalyticsListener.EventTime eventTime

The event time.

@Nullable PlaybackException error

The new error, or null if the error is being cleared.

onPlayerReleased

@UnstableApi
default void onPlayerReleased(AnalyticsListener.EventTime eventTime)

Called when the Player is released.

Parameters
AnalyticsListener.EventTime eventTime

The event time.

onPlayerStateChanged

@UnstableApi
default void onPlayerStateChanged(
    AnalyticsListener.EventTime eventTime,
    boolean playWhenReady,
    @Player.State int playbackState
)

onPlaylistMetadataChanged

@UnstableApi
default void onPlaylistMetadataChanged(
    AnalyticsListener.EventTime eventTime,
    MediaMetadata playlistMetadata
)

Called when the playlist MediaMetadata changes.

Parameters
AnalyticsListener.EventTime eventTime

The event time.

MediaMetadata playlistMetadata

The playlist MediaMetadata.

onPositionDiscontinuity

@UnstableApi
default void onPositionDiscontinuity(
    AnalyticsListener.EventTime eventTime,
    @Player.DiscontinuityReason int reason
)

onPositionDiscontinuity

@UnstableApi
default void onPositionDiscontinuity(
    AnalyticsListener.EventTime eventTime,
    Player.PositionInfo oldPosition,
    Player.PositionInfo newPosition,
    @Player.DiscontinuityReason int reason
)

Called when a position discontinuity occurred.

Parameters
AnalyticsListener.EventTime eventTime

The event time.

Player.PositionInfo oldPosition

The position before the discontinuity.

Player.PositionInfo newPosition

The position after the discontinuity.

@Player.DiscontinuityReason int reason

The reason for the position discontinuity.

onRenderedFirstFrame

@UnstableApi
default void onRenderedFirstFrame(
    AnalyticsListener.EventTime eventTime,
    Object output,
    long renderTimeMs
)

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.

Parameters
AnalyticsListener.EventTime eventTime

The event time.

Object output

The output to which a frame has been rendered. Normally a Surface, however may also be other output types (e.g., a VideoDecoderOutputBufferRenderer).

long renderTimeMs

elapsedRealtime when the first frame was rendered.

onRendererReadyChanged

@UnstableApi
default void onRendererReadyChanged(
    AnalyticsListener.EventTime eventTime,
    int rendererIndex,
    @C.TrackType int rendererTrackType,
    boolean isRendererReady
)

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

Parameters
AnalyticsListener.EventTime eventTime

The event time.

int rendererIndex

The index of the renderer in the instance.

@C.TrackType int rendererTrackType

The C.TrackType of the renderer.

boolean isRendererReady

Whether the renderer allows playback to be ready.

onRepeatModeChanged

@UnstableApi
default void onRepeatModeChanged(
    AnalyticsListener.EventTime eventTime,
    @Player.RepeatMode int repeatMode
)

Called when the repeat mode changed.

Parameters
AnalyticsListener.EventTime eventTime

The event time.

@Player.RepeatMode int repeatMode

The new repeat mode.

onSeekBackIncrementChanged

@UnstableApi
default void onSeekBackIncrementChanged(
    AnalyticsListener.EventTime eventTime,
    long seekBackIncrementMs
)

Called when the seek back increment changed.

Parameters
AnalyticsListener.EventTime eventTime

The event time.

long seekBackIncrementMs

The seek back increment, in milliseconds.

onSeekForwardIncrementChanged

@UnstableApi
default void onSeekForwardIncrementChanged(
    AnalyticsListener.EventTime eventTime,
    long seekForwardIncrementMs
)

Called when the seek forward increment changed.

Parameters
AnalyticsListener.EventTime eventTime

The event time.

long seekForwardIncrementMs

The seek forward increment, in milliseconds.

onSeekStarted

@UnstableApi
default void onSeekStarted(AnalyticsListener.EventTime eventTime)

onShuffleModeChanged

@UnstableApi
default void onShuffleModeChanged(
    AnalyticsListener.EventTime eventTime,
    boolean shuffleModeEnabled
)

Called when the shuffle mode changed.

Parameters
AnalyticsListener.EventTime eventTime

The event time.

boolean shuffleModeEnabled

Whether the shuffle mode is enabled.

onSkipSilenceEnabledChanged

@UnstableApi
default void onSkipSilenceEnabledChanged(
    AnalyticsListener.EventTime eventTime,
    boolean skipSilenceEnabled
)

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

Parameters
AnalyticsListener.EventTime eventTime

The event time.

boolean skipSilenceEnabled

Whether skipping silences in the audio stream is enabled.

onSurfaceSizeChanged

@UnstableApi
default void onSurfaceSizeChanged(
    AnalyticsListener.EventTime eventTime,
    int width,
    int height
)

Called when the output surface size changed.

Parameters
AnalyticsListener.EventTime eventTime

The event time.

int width

The surface width in pixels. May be LENGTH_UNSET if unknown, or 0 if the video is not rendered onto a surface.

int height

The surface height in pixels. May be LENGTH_UNSET if unknown, or 0 if the video is not rendered onto a surface.

onTimelineChanged

@UnstableApi
default void onTimelineChanged(
    AnalyticsListener.EventTime eventTime,
    @Player.TimelineChangeReason int reason
)

Called when the timeline changed.

Parameters
AnalyticsListener.EventTime eventTime

The event time.

@Player.TimelineChangeReason int reason

The reason for the timeline change.

onTrackSelectionParametersChanged

@UnstableApi
default void onTrackSelectionParametersChanged(
    AnalyticsListener.EventTime eventTime,
    TrackSelectionParameters trackSelectionParameters
)

Called when track selection parameters change.

Parameters
AnalyticsListener.EventTime eventTime

The event time.

TrackSelectionParameters trackSelectionParameters

The new TrackSelectionParameters.

onTracksChanged

@UnstableApi
default void onTracksChanged(AnalyticsListener.EventTime eventTime, Tracks tracks)

Called when the tracks change.

Parameters
AnalyticsListener.EventTime eventTime

The event time.

Tracks tracks

The tracks. Never null, but may be of length zero.

onUpstreamDiscarded

@UnstableApi
default void onUpstreamDiscarded(
    AnalyticsListener.EventTime eventTime,
    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
AnalyticsListener.EventTime eventTime

The event time.

MediaLoadData mediaLoadData

The MediaLoadData defining the media being discarded.

onVideoCodecError

@UnstableApi
default void onVideoCodecError(
    AnalyticsListener.EventTime eventTime,
    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. onPlayerError 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
AnalyticsListener.EventTime eventTime

The event time.

Exception videoCodecError

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

onVideoDecoderInitialized

@UnstableApi
default void onVideoDecoderInitialized(
    AnalyticsListener.EventTime eventTime,
    String decoderName,
    long initializationDurationMs
)

onVideoDecoderInitialized

@UnstableApi
default void onVideoDecoderInitialized(
    AnalyticsListener.EventTime eventTime,
    String decoderName,
    long initializedTimestampMs,
    long initializationDurationMs
)

Called when a video renderer creates a decoder.

Parameters
AnalyticsListener.EventTime eventTime

The event time.

String decoderName

The decoder that was created.

long initializedTimestampMs

elapsedRealtime when initialization finished.

long initializationDurationMs

The time taken to initialize the decoder in milliseconds.

onVideoDecoderReleased

@UnstableApi
default void onVideoDecoderReleased(
    AnalyticsListener.EventTime eventTime,
    String decoderName
)

Called when a video renderer releases a decoder.

Parameters
AnalyticsListener.EventTime eventTime

The event time.

String decoderName

The decoder that was released.

onVideoDisabled

@UnstableApi
default void onVideoDisabled(
    AnalyticsListener.EventTime eventTime,
    DecoderCounters decoderCounters
)

Called when a video renderer is disabled.

Parameters
AnalyticsListener.EventTime eventTime

The event time.

DecoderCounters decoderCounters

DecoderCounters that were updated by the renderer.

onVideoEnabled

@UnstableApi
default void onVideoEnabled(
    AnalyticsListener.EventTime eventTime,
    DecoderCounters decoderCounters
)

Called when a video renderer is enabled.

Parameters
AnalyticsListener.EventTime eventTime

The event time.

DecoderCounters decoderCounters

DecoderCounters that will be updated by the renderer for as long as it remains enabled.

onVideoFrameProcessingOffset

@UnstableApi
default void onVideoFrameProcessingOffset(
    AnalyticsListener.EventTime eventTime,
    long totalProcessingOffsetUs,
    int frameCount
)

Called when there is an update to the video frame processing offset reported by a video renderer.

The processing offset for a video frame is the difference between the time at which the frame became available to render, and the time at which it was scheduled to be rendered. A positive value indicates the frame became available early enough, whereas a negative value indicates that the frame wasn't available until after the time at which it should have been rendered.

Parameters
AnalyticsListener.EventTime eventTime

The event time.

long totalProcessingOffsetUs

The sum of the video frame processing offsets for frames rendered since the last call to this method.

int frameCount

The number to samples included in totalProcessingOffsetUs.

onVideoInputFormatChanged

@UnstableApi
default void onVideoInputFormatChanged(
    AnalyticsListener.EventTime eventTime,
    Format format,
    @Nullable DecoderReuseEvaluation decoderReuseEvaluation
)

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

Parameters
AnalyticsListener.EventTime eventTime

The event time.

Format format

The new format.

@Nullable 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

@UnstableApi
default void onVideoSizeChanged(
    AnalyticsListener.EventTime eventTime,
    VideoSize videoSize
)

Called before a frame is rendered for the first time since setting the surface, and each time there's a change in the size or pixel aspect ratio of the video being rendered.

Parameters
AnalyticsListener.EventTime eventTime

The event time.

VideoSize videoSize

The new size of the video.

onVideoSizeChanged

@UnstableApi
default void onVideoSizeChanged(
    AnalyticsListener.EventTime eventTime,
    int width,
    int height,
    int unappliedRotationDegrees,
    float pixelWidthHeightRatio
)

onVolumeChanged

@UnstableApi
default void onVolumeChanged(AnalyticsListener.EventTime eventTime, float volume)

Called when the volume changes.

Parameters
AnalyticsListener.EventTime eventTime

The event time.

float volume

The new volume, with 0 being silence and 1 being unity gain.