AnalyticsListener


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 = )
annotation AnalyticsListener.EventFlags

Events that can be reported via onEvents.

Time information of an event.

A set of EventFlags.

Constants

const Int

Audio attributes changed.

const Int

The audio codec encountered an error.

const Int

An audio renderer created a decoder.

const Int

An audio renderer released a decoder.

const Int

An audio renderer was disabled.

const Int

An audio renderer was enabled.

const Int

The format consumed by an audio renderer changed.

const Int

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

const Int

An audio session id was set.

const Int

The audio sink encountered a non-fatal error.

const Int

An audio track has been initialized.

const Int

An audio track has been released.

const Int

An audio underrun occurred.

const Int

getAvailableCommands changed.

const Int

The bandwidth estimate has been updated.

const Int

getCurrentCues changed.

const Int

getDeviceInfo changed.

const Int

getDeviceVolume changed.

const Int

The downstream format sent to renderers changed.

const Int

DRM keys were loaded.

const Int

DRM keys were removed.

const Int

DRM keys were restored.

const Int

A DRM session has been acquired.

const Int

A non-fatal DRM session manager error occurred.

const Int

A DRM session has been released.

const Int

Video frames have been dropped.

const Int

isLoading ()} changed.

const Int

isPlaying changed.

const Int

A source canceled loading data.

const Int

A source started completed loading data.

const Int

A source had a non-fatal error loading data.

const Int

A source started loading data.

const Int

getMaxSeekToPreviousPosition changed.

const Int

getCurrentMediaItem changed or the player started repeating the current item.

const Int

getMediaMetadata changed.

const Int

Metadata associated with the current playback time was reported.

const Int

getPlaybackParameters changed.

const Int

getPlaybackState changed.

const Int

getPlaybackSuppressionReason changed.

const Int

getPlayerError changed.

const Int

The player was released.

const Int

getPlaylistMetadata changed.

const Int

getPlayWhenReady changed.

const Int

A position discontinuity occurred.

const Int

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

const Int

A renderer changed its readiness for playback.

const Int

getRepeatMode changed.

const Int

getSeekBackIncrement changed.

const Int

getSeekForwardIncrement changed.

const Int

getShuffleModeEnabled changed.

const Int

Skipping silences was enabled or disabled in the audio stream.

const Int

The surface size changed.

const Int

getCurrentTimeline changed.

const Int

getCurrentTracks changed.

const Int

getTrackSelectionParameters changed.

const Int

Data was removed from the end of the media buffer.

const Int

The video codec encountered an error.

const Int

A video renderer created a decoder.

const Int

A video renderer released a decoder.

const Int

A video renderer was disabled.

const Int

A video renderer was enabled.

const Int

Video frame processing offset data has been reported.

const Int

The format consumed by a video renderer changed.

const Int

The video size changed.

const Int

The volume changed.

Public functions

Unit
@UnstableApi
onAudioAttributesChanged(
    eventTime: AnalyticsListener.EventTime!,
    audioAttributes: AudioAttributes!
)

Called when the audio attributes change.

Unit
@UnstableApi
onAudioCodecError(
    eventTime: AnalyticsListener.EventTime!,
    audioCodecError: Exception!
)

Called when an audio decoder encounters an error.

Unit
@UnstableApi
onAudioDecoderInitialized(
    eventTime: AnalyticsListener.EventTime!,
    decoderName: String!,
    initializationDurationMs: Long
)

This function is deprecated.

Use onAudioDecoderInitialized.

Unit
@UnstableApi
onAudioDecoderInitialized(
    eventTime: AnalyticsListener.EventTime!,
    decoderName: String!,
    initializedTimestampMs: Long,
    initializationDurationMs: Long
)

Called when an audio renderer creates a decoder.

Unit
@UnstableApi
onAudioDecoderReleased(
    eventTime: AnalyticsListener.EventTime!,
    decoderName: String!
)

Called when an audio renderer releases a decoder.

Unit
@UnstableApi
onAudioDisabled(
    eventTime: AnalyticsListener.EventTime!,
    decoderCounters: DecoderCounters!
)

Called when an audio renderer is disabled.

Unit
@UnstableApi
onAudioEnabled(
    eventTime: AnalyticsListener.EventTime!,
    decoderCounters: DecoderCounters!
)

Called when an audio renderer is enabled.

Unit
@UnstableApi
onAudioInputFormatChanged(
    eventTime: AnalyticsListener.EventTime!,
    format: Format!,
    decoderReuseEvaluation: DecoderReuseEvaluation?
)

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

Unit
@UnstableApi
onAudioPositionAdvancing(
    eventTime: AnalyticsListener.EventTime!,
    playoutStartSystemTimeMs: Long
)

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

Unit
@UnstableApi
onAudioSessionIdChanged(
    eventTime: AnalyticsListener.EventTime!,
    audioSessionId: Int
)

Called when the audio session ID changes.

Unit
@UnstableApi
onAudioSinkError(
    eventTime: AnalyticsListener.EventTime!,
    audioSinkError: Exception!
)

Called when AudioSink has encountered an error.

Unit

Called when an AudioTrack has been initialized.

Unit

Called when an AudioTrack has been released.

Unit
@UnstableApi
onAudioUnderrun(
    eventTime: AnalyticsListener.EventTime!,
    bufferSize: Int,
    bufferSizeMs: Long,
    elapsedSinceLastFeedMs: Long
)

Called when an audio underrun occurs.

Unit
@UnstableApi
onAvailableCommandsChanged(
    eventTime: AnalyticsListener.EventTime!,
    availableCommands: Player.Commands!
)

Called when the player's available commands changed.

Unit
@UnstableApi
onBandwidthEstimate(
    eventTime: AnalyticsListener.EventTime!,
    totalLoadTimeMs: Int,
    totalBytesLoaded: Long,
    bitrateEstimate: Long
)

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

Unit

Called when there is a change in the CueGroup.

Unit

This function is deprecated.

Use onCues instead.

Unit
@UnstableApi
onDeviceInfoChanged(
    eventTime: AnalyticsListener.EventTime!,
    deviceInfo: DeviceInfo!
)

Called when the device information changes

Unit
@UnstableApi
onDeviceVolumeChanged(
    eventTime: AnalyticsListener.EventTime!,
    volume: Int,
    muted: Boolean
)

Called when the device volume or mute state changes.

Unit

Called when the downstream format sent to the renderers changed.

Unit

Called each time drm keys are loaded.

Unit

Called each time offline drm keys are removed.

Unit

Called each time offline drm keys are restored.

Unit

This function is deprecated.

Implement onDrmSessionAcquired instead.

Unit

Called each time a drm session is acquired.

Unit

Called when a drm error occurs.

Unit

Called each time a drm session is released.

Unit
@UnstableApi
onDroppedVideoFrames(
    eventTime: AnalyticsListener.EventTime!,
    droppedFrames: Int,
    elapsedMs: Long
)

Called after video frames have been dropped.

Unit

Called after one or more events occurred.

Unit
@UnstableApi
onIsLoadingChanged(
    eventTime: AnalyticsListener.EventTime!,
    isLoading: Boolean
)

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

Unit
@UnstableApi
onIsPlayingChanged(
    eventTime: AnalyticsListener.EventTime!,
    isPlaying: Boolean
)

Called when the player starts or stops playing.

Unit
@UnstableApi
onLoadCanceled(
    eventTime: AnalyticsListener.EventTime!,
    loadEventInfo: LoadEventInfo!,
    mediaLoadData: MediaLoadData!
)

Called when a media source canceled loading data.

Unit
@UnstableApi
onLoadCompleted(
    eventTime: AnalyticsListener.EventTime!,
    loadEventInfo: LoadEventInfo!,
    mediaLoadData: MediaLoadData!
)

Called when a media source completed loading data.

Unit
@UnstableApi
onLoadError(
    eventTime: AnalyticsListener.EventTime!,
    loadEventInfo: LoadEventInfo!,
    mediaLoadData: MediaLoadData!,
    error: IOException!,
    wasCanceled: Boolean
)

Called when a media source loading error occurred.

Unit
@UnstableApi
onLoadStarted(
    eventTime: AnalyticsListener.EventTime!,
    loadEventInfo: LoadEventInfo!,
    mediaLoadData: MediaLoadData!
)

Called when a media source started loading data.

Unit
@UnstableApi
onLoadingChanged(
    eventTime: AnalyticsListener.EventTime!,
    isLoading: Boolean
)

This function is deprecated.

Use onIsLoadingChanged instead.

Unit
@UnstableApi
onMaxSeekToPreviousPositionChanged(
    eventTime: AnalyticsListener.EventTime!,
    maxSeekToPreviousPositionMs: Long
)

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

Unit

Called when playback transitions to a different media item.

Unit
@UnstableApi
onMediaMetadataChanged(
    eventTime: AnalyticsListener.EventTime!,
    mediaMetadata: MediaMetadata!
)

Called when the combined MediaMetadata changes.

Unit

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

Unit
@UnstableApi
onPlayWhenReadyChanged(
    eventTime: AnalyticsListener.EventTime!,
    playWhenReady: Boolean,
    @Player.PlayWhenReadyChangeReason reason: Int
)

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

Unit

Called when the playback parameters changed.

Unit

Called when the playback state changed.

Unit

Called when playback suppression reason changed.

Unit

Called when a fatal player error occurred.

Unit

Called when the PlaybackException returned by getPlayerError changes.

Unit

Called when the Player is released.

Unit
@UnstableApi
onPlayerStateChanged(
    eventTime: AnalyticsListener.EventTime!,
    playWhenReady: Boolean,
    @Player.State playbackState: Int
)

This function is deprecated.

Use onPlaybackStateChanged and onPlayWhenReadyChanged instead.

Unit
@UnstableApi
onPlaylistMetadataChanged(
    eventTime: AnalyticsListener.EventTime!,
    playlistMetadata: MediaMetadata!
)

Called when the playlist MediaMetadata changes.

Unit

This function is deprecated.

Use onPositionDiscontinuity instead.

Unit
@UnstableApi
onPositionDiscontinuity(
    eventTime: AnalyticsListener.EventTime!,
    oldPosition: Player.PositionInfo!,
    newPosition: Player.PositionInfo!,
    @Player.DiscontinuityReason reason: Int
)

Called when a position discontinuity occurred.

Unit
@UnstableApi
onRenderedFirstFrame(
    eventTime: AnalyticsListener.EventTime!,
    output: Any!,
    renderTimeMs: Long
)

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.

Unit
@UnstableApi
onRendererReadyChanged(
    eventTime: AnalyticsListener.EventTime!,
    rendererIndex: Int,
    @C.TrackType rendererTrackType: Int,
    isRendererReady: Boolean
)

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

Unit

Called when the repeat mode changed.

Unit
@UnstableApi
onSeekBackIncrementChanged(
    eventTime: AnalyticsListener.EventTime!,
    seekBackIncrementMs: Long
)

Called when the seek back increment changed.

Unit
@UnstableApi
onSeekForwardIncrementChanged(
    eventTime: AnalyticsListener.EventTime!,
    seekForwardIncrementMs: Long
)

Called when the seek forward increment changed.

Unit

This function is deprecated.

Use onPositionDiscontinuity instead, listening to changes with DISCONTINUITY_REASON_SEEK.

Unit
@UnstableApi
onShuffleModeChanged(
    eventTime: AnalyticsListener.EventTime!,
    shuffleModeEnabled: Boolean
)

Called when the shuffle mode changed.

Unit
@UnstableApi
onSkipSilenceEnabledChanged(
    eventTime: AnalyticsListener.EventTime!,
    skipSilenceEnabled: Boolean
)

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

Unit
@UnstableApi
onSurfaceSizeChanged(
    eventTime: AnalyticsListener.EventTime!,
    width: Int,
    height: Int
)

Called when the output surface size changed.

Unit

Called when the timeline changed.

Unit

Called when track selection parameters change.

Unit

Called when the tracks change.

Unit
@UnstableApi
onUpstreamDiscarded(
    eventTime: AnalyticsListener.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.

Unit
@UnstableApi
onVideoCodecError(
    eventTime: AnalyticsListener.EventTime!,
    videoCodecError: Exception!
)

Called when a video decoder encounters an error.

Unit
@UnstableApi
onVideoDecoderInitialized(
    eventTime: AnalyticsListener.EventTime!,
    decoderName: String!,
    initializationDurationMs: Long
)

This function is deprecated.

Use onVideoDecoderInitialized.

Unit
@UnstableApi
onVideoDecoderInitialized(
    eventTime: AnalyticsListener.EventTime!,
    decoderName: String!,
    initializedTimestampMs: Long,
    initializationDurationMs: Long
)

Called when a video renderer creates a decoder.

Unit
@UnstableApi
onVideoDecoderReleased(
    eventTime: AnalyticsListener.EventTime!,
    decoderName: String!
)

Called when a video renderer releases a decoder.

Unit
@UnstableApi
onVideoDisabled(
    eventTime: AnalyticsListener.EventTime!,
    decoderCounters: DecoderCounters!
)

Called when a video renderer is disabled.

Unit
@UnstableApi
onVideoEnabled(
    eventTime: AnalyticsListener.EventTime!,
    decoderCounters: DecoderCounters!
)

Called when a video renderer is enabled.

Unit
@UnstableApi
onVideoFrameProcessingOffset(
    eventTime: AnalyticsListener.EventTime!,
    totalProcessingOffsetUs: Long,
    frameCount: Int
)

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

Unit
@UnstableApi
onVideoInputFormatChanged(
    eventTime: AnalyticsListener.EventTime!,
    format: Format!,
    decoderReuseEvaluation: DecoderReuseEvaluation?
)

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

Unit
@UnstableApi
onVideoSizeChanged(
    eventTime: AnalyticsListener.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.

Unit
@UnstableApi
onVideoSizeChanged(
    eventTime: AnalyticsListener.EventTime!,
    width: Int,
    height: Int,
    unappliedRotationDegrees: Int,
    pixelWidthHeightRatio: Float
)

This function is deprecated.

Implement onVideoSizeChanged instead.

Unit

Called when the volume changes.

Constants

EVENT_AUDIO_ATTRIBUTES_CHANGED

@UnstableApi
const val EVENT_AUDIO_ATTRIBUTES_CHANGED = 20: Int

Audio attributes changed.

EVENT_AUDIO_CODEC_ERROR

@UnstableApi
const val EVENT_AUDIO_CODEC_ERROR = 1029: Int

The audio codec encountered an error.

EVENT_AUDIO_DECODER_INITIALIZED

@UnstableApi
const val EVENT_AUDIO_DECODER_INITIALIZED = 1008: Int

An audio renderer created a decoder.

EVENT_AUDIO_DECODER_RELEASED

@UnstableApi
const val EVENT_AUDIO_DECODER_RELEASED = 1012: Int

An audio renderer released a decoder.

EVENT_AUDIO_DISABLED

@UnstableApi
const val EVENT_AUDIO_DISABLED = 1013: Int

An audio renderer was disabled.

EVENT_AUDIO_ENABLED

@UnstableApi
const val EVENT_AUDIO_ENABLED = 1007: Int

An audio renderer was enabled.

EVENT_AUDIO_INPUT_FORMAT_CHANGED

@UnstableApi
const val EVENT_AUDIO_INPUT_FORMAT_CHANGED = 1009: Int

The format consumed by an audio renderer changed.

EVENT_AUDIO_POSITION_ADVANCING

@UnstableApi
const val EVENT_AUDIO_POSITION_ADVANCING = 1010: Int

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

EVENT_AUDIO_SESSION_ID

@UnstableApi
const val EVENT_AUDIO_SESSION_ID = 21: Int

An audio session id was set.

EVENT_AUDIO_SINK_ERROR

@UnstableApi
const val EVENT_AUDIO_SINK_ERROR = 1014: Int

The audio sink encountered a non-fatal error.

EVENT_AUDIO_TRACK_INITIALIZED

@UnstableApi
const val EVENT_AUDIO_TRACK_INITIALIZED = 1031: Int

An audio track has been initialized.

EVENT_AUDIO_TRACK_RELEASED

@UnstableApi
const val EVENT_AUDIO_TRACK_RELEASED = 1032: Int

An audio track has been released.

EVENT_AUDIO_UNDERRUN

@UnstableApi
const val EVENT_AUDIO_UNDERRUN = 1011: Int

An audio underrun occurred.

EVENT_AVAILABLE_COMMANDS_CHANGED

@UnstableApi
const val EVENT_AVAILABLE_COMMANDS_CHANGED = 13: Int

getAvailableCommands changed.

EVENT_BANDWIDTH_ESTIMATE

@UnstableApi
const val EVENT_BANDWIDTH_ESTIMATE = 1006: Int

The bandwidth estimate has been updated.

EVENT_CUES

@UnstableApi
const val EVENT_CUES = 27: Int

getCurrentCues changed.

EVENT_DEVICE_INFO_CHANGED

@UnstableApi
const val EVENT_DEVICE_INFO_CHANGED = 29: Int

getDeviceInfo changed.

EVENT_DEVICE_VOLUME_CHANGED

@UnstableApi
const val EVENT_DEVICE_VOLUME_CHANGED = 30: Int

getDeviceVolume changed.

EVENT_DOWNSTREAM_FORMAT_CHANGED

@UnstableApi
const val EVENT_DOWNSTREAM_FORMAT_CHANGED = 1004: Int

The downstream format sent to renderers changed.

EVENT_DRM_KEYS_LOADED

@UnstableApi
const val EVENT_DRM_KEYS_LOADED = 1023: Int

DRM keys were loaded.

EVENT_DRM_KEYS_REMOVED

@UnstableApi
const val EVENT_DRM_KEYS_REMOVED = 1026: Int

DRM keys were removed.

EVENT_DRM_KEYS_RESTORED

@UnstableApi
const val EVENT_DRM_KEYS_RESTORED = 1025: Int

DRM keys were restored.

EVENT_DRM_SESSION_ACQUIRED

@UnstableApi
const val EVENT_DRM_SESSION_ACQUIRED = 1022: Int

A DRM session has been acquired.

EVENT_DRM_SESSION_MANAGER_ERROR

@UnstableApi
const val EVENT_DRM_SESSION_MANAGER_ERROR = 1024: Int

A non-fatal DRM session manager error occurred.

EVENT_DRM_SESSION_RELEASED

@UnstableApi
const val EVENT_DRM_SESSION_RELEASED = 1027: Int

A DRM session has been released.

EVENT_DROPPED_VIDEO_FRAMES

@UnstableApi
const val EVENT_DROPPED_VIDEO_FRAMES = 1018: Int

Video frames have been dropped.

EVENT_IS_LOADING_CHANGED

@UnstableApi
const val EVENT_IS_LOADING_CHANGED = 3: Int

isLoading ()} changed.

EVENT_IS_PLAYING_CHANGED

@UnstableApi
const val EVENT_IS_PLAYING_CHANGED = 7: Int

isPlaying changed.

EVENT_LOAD_CANCELED

@UnstableApi
const val EVENT_LOAD_CANCELED = 1002: Int

A source canceled loading data.

EVENT_LOAD_COMPLETED

@UnstableApi
const val EVENT_LOAD_COMPLETED = 1001: Int

A source started completed loading data.

EVENT_LOAD_ERROR

@UnstableApi
const val EVENT_LOAD_ERROR = 1003: Int

A source had a non-fatal error loading data.

EVENT_LOAD_STARTED

@UnstableApi
const val EVENT_LOAD_STARTED = 1000: Int

A source started loading data.

EVENT_MAX_SEEK_TO_PREVIOUS_POSITION_CHANGED

@UnstableApi
const val EVENT_MAX_SEEK_TO_PREVIOUS_POSITION_CHANGED = 18: Int

getMaxSeekToPreviousPosition changed.

EVENT_MEDIA_ITEM_TRANSITION

@UnstableApi
const val EVENT_MEDIA_ITEM_TRANSITION = 1: Int

getCurrentMediaItem changed or the player started repeating the current item.

EVENT_MEDIA_METADATA_CHANGED

@UnstableApi
const val EVENT_MEDIA_METADATA_CHANGED = 14: Int

getMediaMetadata changed.

EVENT_METADATA

@UnstableApi
const val EVENT_METADATA = 28: Int

Metadata associated with the current playback time was reported.

EVENT_PLAYBACK_PARAMETERS_CHANGED

@UnstableApi
const val EVENT_PLAYBACK_PARAMETERS_CHANGED = 12: Int

getPlaybackParameters changed.

EVENT_PLAYBACK_STATE_CHANGED

@UnstableApi
const val EVENT_PLAYBACK_STATE_CHANGED = 4: Int

getPlaybackState changed.

EVENT_PLAYBACK_SUPPRESSION_REASON_CHANGED

@UnstableApi
const val EVENT_PLAYBACK_SUPPRESSION_REASON_CHANGED = 6: Int

getPlaybackSuppressionReason changed.

EVENT_PLAYER_ERROR

@UnstableApi
const val EVENT_PLAYER_ERROR = 10: Int

getPlayerError changed.

EVENT_PLAYER_RELEASED

@UnstableApi
const val EVENT_PLAYER_RELEASED = 1028: Int

The player was released.

EVENT_PLAYLIST_METADATA_CHANGED

@UnstableApi
const val EVENT_PLAYLIST_METADATA_CHANGED = 15: Int

getPlaylistMetadata changed.

EVENT_PLAY_WHEN_READY_CHANGED

@UnstableApi
const val EVENT_PLAY_WHEN_READY_CHANGED = 5: Int

getPlayWhenReady changed.

EVENT_POSITION_DISCONTINUITY

@UnstableApi
const val EVENT_POSITION_DISCONTINUITY = 11: Int

A position discontinuity occurred. See onPositionDiscontinuity.

EVENT_RENDERED_FIRST_FRAME

@UnstableApi
const val EVENT_RENDERED_FIRST_FRAME = 26: Int

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
const val EVENT_RENDERER_READY_CHANGED = 1033: Int

A renderer changed its readiness for playback.

EVENT_REPEAT_MODE_CHANGED

@UnstableApi
const val EVENT_REPEAT_MODE_CHANGED = 8: Int

getRepeatMode changed.

EVENT_SEEK_BACK_INCREMENT_CHANGED

@UnstableApi
const val EVENT_SEEK_BACK_INCREMENT_CHANGED = 16: Int

getSeekBackIncrement changed.

EVENT_SEEK_FORWARD_INCREMENT_CHANGED

@UnstableApi
const val EVENT_SEEK_FORWARD_INCREMENT_CHANGED = 17: Int

getSeekForwardIncrement changed.

EVENT_SHUFFLE_MODE_ENABLED_CHANGED

@UnstableApi
const val EVENT_SHUFFLE_MODE_ENABLED_CHANGED = 9: Int

getShuffleModeEnabled changed.

EVENT_SKIP_SILENCE_ENABLED_CHANGED

@UnstableApi
const val EVENT_SKIP_SILENCE_ENABLED_CHANGED = 23: Int

Skipping silences was enabled or disabled in the audio stream.

EVENT_SURFACE_SIZE_CHANGED

@UnstableApi
const val EVENT_SURFACE_SIZE_CHANGED = 24: Int

The surface size changed.

EVENT_TIMELINE_CHANGED

@UnstableApi
const val EVENT_TIMELINE_CHANGED = 0: Int

getCurrentTimeline changed.

EVENT_TRACKS_CHANGED

@UnstableApi
const val EVENT_TRACKS_CHANGED = 2: Int

getCurrentTracks changed.

EVENT_TRACK_SELECTION_PARAMETERS_CHANGED

@UnstableApi
const val EVENT_TRACK_SELECTION_PARAMETERS_CHANGED = 19: Int

getTrackSelectionParameters changed.

EVENT_UPSTREAM_DISCARDED

@UnstableApi
const val EVENT_UPSTREAM_DISCARDED = 1005: Int

Data was removed from the end of the media buffer.

EVENT_VIDEO_CODEC_ERROR

@UnstableApi
const val EVENT_VIDEO_CODEC_ERROR = 1030: Int

The video codec encountered an error.

EVENT_VIDEO_DECODER_INITIALIZED

@UnstableApi
const val EVENT_VIDEO_DECODER_INITIALIZED = 1016: Int

A video renderer created a decoder.

EVENT_VIDEO_DECODER_RELEASED

@UnstableApi
const val EVENT_VIDEO_DECODER_RELEASED = 1019: Int

A video renderer released a decoder.

EVENT_VIDEO_DISABLED

@UnstableApi
const val EVENT_VIDEO_DISABLED = 1020: Int

A video renderer was disabled.

EVENT_VIDEO_ENABLED

@UnstableApi
const val EVENT_VIDEO_ENABLED = 1015: Int

A video renderer was enabled.

EVENT_VIDEO_FRAME_PROCESSING_OFFSET

@UnstableApi
const val EVENT_VIDEO_FRAME_PROCESSING_OFFSET = 1021: Int

Video frame processing offset data has been reported.

EVENT_VIDEO_INPUT_FORMAT_CHANGED

@UnstableApi
const val EVENT_VIDEO_INPUT_FORMAT_CHANGED = 1017: Int

The format consumed by a video renderer changed.

EVENT_VIDEO_SIZE_CHANGED

@UnstableApi
const val EVENT_VIDEO_SIZE_CHANGED = 25: Int

The video size changed.

EVENT_VOLUME_CHANGED

@UnstableApi
const val EVENT_VOLUME_CHANGED = 22: Int

The volume changed.

Public functions

onAudioAttributesChanged

@UnstableApi
fun onAudioAttributesChanged(
    eventTime: AnalyticsListener.EventTime!,
    audioAttributes: AudioAttributes!
): Unit

Called when the audio attributes change.

Parameters
eventTime: AnalyticsListener.EventTime!

The event time.

audioAttributes: AudioAttributes!

The audio attributes.

onAudioCodecError

@UnstableApi
fun onAudioCodecError(
    eventTime: AnalyticsListener.EventTime!,
    audioCodecError: Exception!
): Unit

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

The event time.

audioCodecError: Exception!

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

onAudioDecoderInitialized

@UnstableApi
fun onAudioDecoderInitialized(
    eventTime: AnalyticsListener.EventTime!,
    decoderName: String!,
    initializationDurationMs: Long
): Unit

onAudioDecoderInitialized

@UnstableApi
fun onAudioDecoderInitialized(
    eventTime: AnalyticsListener.EventTime!,
    decoderName: String!,
    initializedTimestampMs: Long,
    initializationDurationMs: Long
): Unit

Called when an audio renderer creates a decoder.

Parameters
eventTime: AnalyticsListener.EventTime!

The event time.

decoderName: String!

The decoder that was created.

initializedTimestampMs: Long

elapsedRealtime when initialization finished.

initializationDurationMs: Long

The time taken to initialize the decoder in milliseconds.

onAudioDecoderReleased

@UnstableApi
fun onAudioDecoderReleased(
    eventTime: AnalyticsListener.EventTime!,
    decoderName: String!
): Unit

Called when an audio renderer releases a decoder.

Parameters
eventTime: AnalyticsListener.EventTime!

The event time.

decoderName: String!

The decoder that was released.

onAudioDisabled

@UnstableApi
fun onAudioDisabled(
    eventTime: AnalyticsListener.EventTime!,
    decoderCounters: DecoderCounters!
): Unit

Called when an audio renderer is disabled.

Parameters
eventTime: AnalyticsListener.EventTime!

The event time.

decoderCounters: DecoderCounters!

DecoderCounters that were updated by the renderer.

onAudioEnabled

@UnstableApi
fun onAudioEnabled(
    eventTime: AnalyticsListener.EventTime!,
    decoderCounters: DecoderCounters!
): Unit

Called when an audio renderer is enabled.

Parameters
eventTime: AnalyticsListener.EventTime!

The event time.

decoderCounters: DecoderCounters!

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

onAudioInputFormatChanged

@UnstableApi
fun onAudioInputFormatChanged(
    eventTime: AnalyticsListener.EventTime!,
    format: Format!,
    decoderReuseEvaluation: DecoderReuseEvaluation?
): Unit

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

Parameters
eventTime: AnalyticsListener.EventTime!

The event time.

format: Format!

The new format.

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
fun onAudioPositionAdvancing(
    eventTime: AnalyticsListener.EventTime!,
    playoutStartSystemTimeMs: Long
): Unit

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

Parameters
eventTime: AnalyticsListener.EventTime!

The event time.

playoutStartSystemTimeMs: Long

The approximate derived currentTimeMillis at which playout started.

onAudioSessionIdChanged

@UnstableApi
fun onAudioSessionIdChanged(
    eventTime: AnalyticsListener.EventTime!,
    audioSessionId: Int
): Unit

Called when the audio session ID changes.

Parameters
eventTime: AnalyticsListener.EventTime!

The event time.

audioSessionId: Int

The audio session ID.

onAudioSinkError

@UnstableApi
fun onAudioSinkError(
    eventTime: AnalyticsListener.EventTime!,
    audioSinkError: Exception!
): Unit

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

The event time.

audioSinkError: Exception!

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

onAudioTrackInitialized

@UnstableApi
fun onAudioTrackInitialized(
    eventTime: AnalyticsListener.EventTime!,
    audioTrackConfig: AudioSink.AudioTrackConfig!
): Unit

Called when an AudioTrack has been initialized.

Parameters
eventTime: AnalyticsListener.EventTime!

The event time.

audioTrackConfig: AudioSink.AudioTrackConfig!

The AudioSink.AudioTrackConfig of the initialized .

onAudioTrackReleased

@UnstableApi
fun onAudioTrackReleased(
    eventTime: AnalyticsListener.EventTime!,
    audioTrackConfig: AudioSink.AudioTrackConfig!
): Unit

Called when an AudioTrack has been released.

Parameters
eventTime: AnalyticsListener.EventTime!

The event time.

audioTrackConfig: AudioSink.AudioTrackConfig!

The AudioSink.AudioTrackConfig of the released .

onAudioUnderrun

@UnstableApi
fun onAudioUnderrun(
    eventTime: AnalyticsListener.EventTime!,
    bufferSize: Int,
    bufferSizeMs: Long,
    elapsedSinceLastFeedMs: Long
): Unit

Called when an audio underrun occurs.

Parameters
eventTime: AnalyticsListener.EventTime!

The event time.

bufferSize: Int

The size of the audio output buffer, in bytes.

bufferSizeMs: Long

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.

elapsedSinceLastFeedMs: Long

The time since audio was last written to the output buffer.

onAvailableCommandsChanged

@UnstableApi
fun onAvailableCommandsChanged(
    eventTime: AnalyticsListener.EventTime!,
    availableCommands: Player.Commands!
): Unit

Called when the player's available commands changed.

Parameters
eventTime: AnalyticsListener.EventTime!

The event time.

availableCommands: Player.Commands!

The available commands.

onBandwidthEstimate

@UnstableApi
fun onBandwidthEstimate(
    eventTime: AnalyticsListener.EventTime!,
    totalLoadTimeMs: Int,
    totalBytesLoaded: Long,
    bitrateEstimate: Long
): Unit

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

Parameters
eventTime: AnalyticsListener.EventTime!

The event time.

totalLoadTimeMs: Int

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

totalBytesLoaded: Long

The total bytes loaded this update is based on.

bitrateEstimate: Long

The bandwidth estimate, in bits per second.

onCues

@UnstableApi
fun onCues(eventTime: AnalyticsListener.EventTime!, cueGroup: CueGroup!): Unit

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

The event time.

cueGroup: CueGroup!

The CueGroup.

onCues

@UnstableApi
fun onCues(eventTime: AnalyticsListener.EventTime!, cues: (Mutable)List<Cue!>!): Unit

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

The event time.

cues: (Mutable)List<Cue!>!

The Cues.

onDeviceInfoChanged

@UnstableApi
fun onDeviceInfoChanged(
    eventTime: AnalyticsListener.EventTime!,
    deviceInfo: DeviceInfo!
): Unit

Called when the device information changes

Parameters
eventTime: AnalyticsListener.EventTime!

The event time.

deviceInfo: DeviceInfo!

The new DeviceInfo.

onDeviceVolumeChanged

@UnstableApi
fun onDeviceVolumeChanged(
    eventTime: AnalyticsListener.EventTime!,
    volume: Int,
    muted: Boolean
): Unit

Called when the device volume or mute state changes.

Parameters
eventTime: AnalyticsListener.EventTime!

The event time.

volume: Int

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

muted: Boolean

Whether the device is muted.

onDownstreamFormatChanged

@UnstableApi
fun onDownstreamFormatChanged(
    eventTime: AnalyticsListener.EventTime!,
    mediaLoadData: MediaLoadData!
): Unit

Called when the downstream format sent to the renderers changed.

Parameters
eventTime: AnalyticsListener.EventTime!

The event time.

mediaLoadData: MediaLoadData!

The MediaLoadData defining the newly selected media data.

onDrmKeysLoaded

@UnstableApi
fun onDrmKeysLoaded(eventTime: AnalyticsListener.EventTime!): Unit

Called each time drm keys are loaded.

Parameters
eventTime: AnalyticsListener.EventTime!

The event time.

onDrmKeysRemoved

@UnstableApi
fun onDrmKeysRemoved(eventTime: AnalyticsListener.EventTime!): Unit

Called each time offline drm keys are removed.

Parameters
eventTime: AnalyticsListener.EventTime!

The event time.

onDrmKeysRestored

@UnstableApi
fun onDrmKeysRestored(eventTime: AnalyticsListener.EventTime!): Unit

Called each time offline drm keys are restored.

Parameters
eventTime: AnalyticsListener.EventTime!

The event time.

onDrmSessionAcquired

@UnstableApi
fun onDrmSessionAcquired(eventTime: AnalyticsListener.EventTime!): Unit

onDrmSessionAcquired

@UnstableApi
fun onDrmSessionAcquired(
    eventTime: AnalyticsListener.EventTime!,
    @DrmSession.State state: Int
): Unit

Called each time a drm session is acquired.

Parameters
eventTime: AnalyticsListener.EventTime!

The event time.

@DrmSession.State state: Int

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

onDrmSessionManagerError

@UnstableApi
fun onDrmSessionManagerError(
    eventTime: AnalyticsListener.EventTime!,
    error: Exception!
): Unit

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

The event time.

error: Exception!

The error.

onDrmSessionReleased

@UnstableApi
fun onDrmSessionReleased(eventTime: AnalyticsListener.EventTime!): Unit

Called each time a drm session is released.

Parameters
eventTime: AnalyticsListener.EventTime!

The event time.

onDroppedVideoFrames

@UnstableApi
fun onDroppedVideoFrames(
    eventTime: AnalyticsListener.EventTime!,
    droppedFrames: Int,
    elapsedMs: Long
): Unit

Called after video frames have been dropped.

Parameters
eventTime: AnalyticsListener.EventTime!

The event time.

droppedFrames: Int

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

elapsedMs: Long

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
fun onEvents(player: Player!, events: AnalyticsListener.Events!): Unit

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.

events: AnalyticsListener.Events!

The Events that occurred in this iteration.

onIsLoadingChanged

@UnstableApi
fun onIsLoadingChanged(
    eventTime: AnalyticsListener.EventTime!,
    isLoading: Boolean
): Unit

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

Parameters
eventTime: AnalyticsListener.EventTime!

The event time.

isLoading: Boolean

Whether the player is loading.

onIsPlayingChanged

@UnstableApi
fun onIsPlayingChanged(
    eventTime: AnalyticsListener.EventTime!,
    isPlaying: Boolean
): Unit

Called when the player starts or stops playing.

Parameters
eventTime: AnalyticsListener.EventTime!

The event time.

isPlaying: Boolean

Whether the player is playing.

onLoadCanceled

@UnstableApi
fun onLoadCanceled(
    eventTime: AnalyticsListener.EventTime!,
    loadEventInfo: LoadEventInfo!,
    mediaLoadData: MediaLoadData!
): Unit

Called when a media source canceled loading data.

Parameters
eventTime: AnalyticsListener.EventTime!

The event time.

loadEventInfo: LoadEventInfo!

The LoadEventInfo defining the load event.

mediaLoadData: MediaLoadData!

The MediaLoadData defining the data being loaded.

onLoadCompleted

@UnstableApi
fun onLoadCompleted(
    eventTime: AnalyticsListener.EventTime!,
    loadEventInfo: LoadEventInfo!,
    mediaLoadData: MediaLoadData!
): Unit

Called when a media source completed loading data.

Parameters
eventTime: AnalyticsListener.EventTime!

The event time.

loadEventInfo: LoadEventInfo!

The LoadEventInfo defining the load event.

mediaLoadData: MediaLoadData!

The MediaLoadData defining the data being loaded.

onLoadError

@UnstableApi
fun onLoadError(
    eventTime: AnalyticsListener.EventTime!,
    loadEventInfo: LoadEventInfo!,
    mediaLoadData: MediaLoadData!,
    error: IOException!,
    wasCanceled: Boolean
): Unit

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

The event time.

loadEventInfo: LoadEventInfo!

The LoadEventInfo defining the load event.

mediaLoadData: MediaLoadData!

The MediaLoadData defining the data being loaded.

error: IOException!

The load error.

wasCanceled: Boolean

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

onLoadStarted

@UnstableApi
fun onLoadStarted(
    eventTime: AnalyticsListener.EventTime!,
    loadEventInfo: LoadEventInfo!,
    mediaLoadData: MediaLoadData!
): Unit

Called when a media source started loading data.

Parameters
eventTime: AnalyticsListener.EventTime!

The event time.

loadEventInfo: LoadEventInfo!

The LoadEventInfo defining the load event.

mediaLoadData: MediaLoadData!

The MediaLoadData defining the data being loaded.

onLoadingChanged

@UnstableApi
fun onLoadingChanged(
    eventTime: AnalyticsListener.EventTime!,
    isLoading: Boolean
): Unit

onMaxSeekToPreviousPositionChanged

@UnstableApi
fun onMaxSeekToPreviousPositionChanged(
    eventTime: AnalyticsListener.EventTime!,
    maxSeekToPreviousPositionMs: Long
): Unit

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

Parameters
eventTime: AnalyticsListener.EventTime!

The event time.

maxSeekToPreviousPositionMs: Long

The maximum seek to previous position, in milliseconds.

onMediaItemTransition

@UnstableApi
fun onMediaItemTransition(
    eventTime: AnalyticsListener.EventTime!,
    mediaItem: MediaItem?,
    @Player.MediaItemTransitionReason reason: Int
): Unit

Called when playback transitions to a different media item.

Parameters
eventTime: AnalyticsListener.EventTime!

The event time.

mediaItem: MediaItem?

The media item.

@Player.MediaItemTransitionReason reason: Int

The reason for the media item transition.

onMediaMetadataChanged

@UnstableApi
fun onMediaMetadataChanged(
    eventTime: AnalyticsListener.EventTime!,
    mediaMetadata: MediaMetadata!
): Unit

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

The event time.

mediaMetadata: MediaMetadata!

The combined MediaMetadata.

onMetadata

@UnstableApi
fun onMetadata(eventTime: AnalyticsListener.EventTime!, metadata: Metadata!): Unit

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

Parameters
eventTime: AnalyticsListener.EventTime!

The event time.

metadata: Metadata!

The metadata.

onPlayWhenReadyChanged

@UnstableApi
fun onPlayWhenReadyChanged(
    eventTime: AnalyticsListener.EventTime!,
    playWhenReady: Boolean,
    @Player.PlayWhenReadyChangeReason reason: Int
): Unit

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

Parameters
eventTime: AnalyticsListener.EventTime!

The event time.

playWhenReady: Boolean

Whether playback will proceed when ready.

@Player.PlayWhenReadyChangeReason reason: Int

The reason of the change.

onPlaybackParametersChanged

@UnstableApi
fun onPlaybackParametersChanged(
    eventTime: AnalyticsListener.EventTime!,
    playbackParameters: PlaybackParameters!
): Unit

Called when the playback parameters changed.

Parameters
eventTime: AnalyticsListener.EventTime!

The event time.

playbackParameters: PlaybackParameters!

The new playback parameters.

onPlaybackStateChanged

@UnstableApi
fun onPlaybackStateChanged(
    eventTime: AnalyticsListener.EventTime!,
    @Player.State state: Int
): Unit

Called when the playback state changed.

Parameters
eventTime: AnalyticsListener.EventTime!

The event time.

@Player.State state: Int

The new playback state.

onPlaybackSuppressionReasonChanged

@UnstableApi
fun onPlaybackSuppressionReasonChanged(
    eventTime: AnalyticsListener.EventTime!,
    @Player.PlaybackSuppressionReason playbackSuppressionReason: Int
): Unit

Called when playback suppression reason changed.

Parameters
eventTime: AnalyticsListener.EventTime!

The event time.

@Player.PlaybackSuppressionReason playbackSuppressionReason: Int

The new PlaybackSuppressionReason.

onPlayerError

@UnstableApi
fun onPlayerError(
    eventTime: AnalyticsListener.EventTime!,
    error: PlaybackException!
): Unit

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

The event time.

error: PlaybackException!

The error.

onPlayerErrorChanged

@UnstableApi
fun onPlayerErrorChanged(
    eventTime: AnalyticsListener.EventTime!,
    error: PlaybackException?
): Unit

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

The event time.

error: PlaybackException?

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

onPlayerReleased

@UnstableApi
fun onPlayerReleased(eventTime: AnalyticsListener.EventTime!): Unit

Called when the Player is released.

Parameters
eventTime: AnalyticsListener.EventTime!

The event time.

onPlayerStateChanged

@UnstableApi
fun onPlayerStateChanged(
    eventTime: AnalyticsListener.EventTime!,
    playWhenReady: Boolean,
    @Player.State playbackState: Int
): Unit

onPlaylistMetadataChanged

@UnstableApi
fun onPlaylistMetadataChanged(
    eventTime: AnalyticsListener.EventTime!,
    playlistMetadata: MediaMetadata!
): Unit

Called when the playlist MediaMetadata changes.

Parameters
eventTime: AnalyticsListener.EventTime!

The event time.

playlistMetadata: MediaMetadata!

The playlist MediaMetadata.

onPositionDiscontinuity

@UnstableApi
fun onPositionDiscontinuity(
    eventTime: AnalyticsListener.EventTime!,
    @Player.DiscontinuityReason reason: Int
): Unit

onPositionDiscontinuity

@UnstableApi
fun onPositionDiscontinuity(
    eventTime: AnalyticsListener.EventTime!,
    oldPosition: Player.PositionInfo!,
    newPosition: Player.PositionInfo!,
    @Player.DiscontinuityReason reason: Int
): Unit

Called when a position discontinuity occurred.

Parameters
eventTime: AnalyticsListener.EventTime!

The event time.

oldPosition: Player.PositionInfo!

The position before the discontinuity.

newPosition: Player.PositionInfo!

The position after the discontinuity.

@Player.DiscontinuityReason reason: Int

The reason for the position discontinuity.

onRenderedFirstFrame

@UnstableApi
fun onRenderedFirstFrame(
    eventTime: AnalyticsListener.EventTime!,
    output: Any!,
    renderTimeMs: Long
): Unit

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

The event time.

output: Any!

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

renderTimeMs: Long

elapsedRealtime when the first frame was rendered.

onRendererReadyChanged

@UnstableApi
fun onRendererReadyChanged(
    eventTime: AnalyticsListener.EventTime!,
    rendererIndex: Int,
    @C.TrackType rendererTrackType: Int,
    isRendererReady: Boolean
): Unit

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

Parameters
eventTime: AnalyticsListener.EventTime!

The event time.

rendererIndex: Int

The index of the renderer in the instance.

@C.TrackType rendererTrackType: Int

The C.TrackType of the renderer.

isRendererReady: Boolean

Whether the renderer allows playback to be ready.

onRepeatModeChanged

@UnstableApi
fun onRepeatModeChanged(
    eventTime: AnalyticsListener.EventTime!,
    @Player.RepeatMode repeatMode: Int
): Unit

Called when the repeat mode changed.

Parameters
eventTime: AnalyticsListener.EventTime!

The event time.

@Player.RepeatMode repeatMode: Int

The new repeat mode.

onSeekBackIncrementChanged

@UnstableApi
fun onSeekBackIncrementChanged(
    eventTime: AnalyticsListener.EventTime!,
    seekBackIncrementMs: Long
): Unit

Called when the seek back increment changed.

Parameters
eventTime: AnalyticsListener.EventTime!

The event time.

seekBackIncrementMs: Long

The seek back increment, in milliseconds.

onSeekForwardIncrementChanged

@UnstableApi
fun onSeekForwardIncrementChanged(
    eventTime: AnalyticsListener.EventTime!,
    seekForwardIncrementMs: Long
): Unit

Called when the seek forward increment changed.

Parameters
eventTime: AnalyticsListener.EventTime!

The event time.

seekForwardIncrementMs: Long

The seek forward increment, in milliseconds.

onSeekStarted

@UnstableApi
fun onSeekStarted(eventTime: AnalyticsListener.EventTime!): Unit

onShuffleModeChanged

@UnstableApi
fun onShuffleModeChanged(
    eventTime: AnalyticsListener.EventTime!,
    shuffleModeEnabled: Boolean
): Unit

Called when the shuffle mode changed.

Parameters
eventTime: AnalyticsListener.EventTime!

The event time.

shuffleModeEnabled: Boolean

Whether the shuffle mode is enabled.

onSkipSilenceEnabledChanged

@UnstableApi
fun onSkipSilenceEnabledChanged(
    eventTime: AnalyticsListener.EventTime!,
    skipSilenceEnabled: Boolean
): Unit

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

Parameters
eventTime: AnalyticsListener.EventTime!

The event time.

skipSilenceEnabled: Boolean

Whether skipping silences in the audio stream is enabled.

onSurfaceSizeChanged

@UnstableApi
fun onSurfaceSizeChanged(
    eventTime: AnalyticsListener.EventTime!,
    width: Int,
    height: Int
): Unit

Called when the output surface size changed.

Parameters
eventTime: AnalyticsListener.EventTime!

The event time.

width: Int

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

height: Int

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

onTimelineChanged

@UnstableApi
fun onTimelineChanged(
    eventTime: AnalyticsListener.EventTime!,
    @Player.TimelineChangeReason reason: Int
): Unit

Called when the timeline changed.

Parameters
eventTime: AnalyticsListener.EventTime!

The event time.

@Player.TimelineChangeReason reason: Int

The reason for the timeline change.

onTrackSelectionParametersChanged

@UnstableApi
fun onTrackSelectionParametersChanged(
    eventTime: AnalyticsListener.EventTime!,
    trackSelectionParameters: TrackSelectionParameters!
): Unit

Called when track selection parameters change.

Parameters
eventTime: AnalyticsListener.EventTime!

The event time.

trackSelectionParameters: TrackSelectionParameters!

The new TrackSelectionParameters.

onTracksChanged

@UnstableApi
fun onTracksChanged(eventTime: AnalyticsListener.EventTime!, tracks: Tracks!): Unit

Called when the tracks change.

Parameters
eventTime: AnalyticsListener.EventTime!

The event time.

tracks: Tracks!

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

onUpstreamDiscarded

@UnstableApi
fun onUpstreamDiscarded(
    eventTime: AnalyticsListener.EventTime!,
    mediaLoadData: MediaLoadData!
): Unit

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

The event time.

mediaLoadData: MediaLoadData!

The MediaLoadData defining the media being discarded.

onVideoCodecError

@UnstableApi
fun onVideoCodecError(
    eventTime: AnalyticsListener.EventTime!,
    videoCodecError: Exception!
): Unit

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

The event time.

videoCodecError: Exception!

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

onVideoDecoderInitialized

@UnstableApi
fun onVideoDecoderInitialized(
    eventTime: AnalyticsListener.EventTime!,
    decoderName: String!,
    initializationDurationMs: Long
): Unit

onVideoDecoderInitialized

@UnstableApi
fun onVideoDecoderInitialized(
    eventTime: AnalyticsListener.EventTime!,
    decoderName: String!,
    initializedTimestampMs: Long,
    initializationDurationMs: Long
): Unit

Called when a video renderer creates a decoder.

Parameters
eventTime: AnalyticsListener.EventTime!

The event time.

decoderName: String!

The decoder that was created.

initializedTimestampMs: Long

elapsedRealtime when initialization finished.

initializationDurationMs: Long

The time taken to initialize the decoder in milliseconds.

onVideoDecoderReleased

@UnstableApi
fun onVideoDecoderReleased(
    eventTime: AnalyticsListener.EventTime!,
    decoderName: String!
): Unit

Called when a video renderer releases a decoder.

Parameters
eventTime: AnalyticsListener.EventTime!

The event time.

decoderName: String!

The decoder that was released.

onVideoDisabled

@UnstableApi
fun onVideoDisabled(
    eventTime: AnalyticsListener.EventTime!,
    decoderCounters: DecoderCounters!
): Unit

Called when a video renderer is disabled.

Parameters
eventTime: AnalyticsListener.EventTime!

The event time.

decoderCounters: DecoderCounters!

DecoderCounters that were updated by the renderer.

onVideoEnabled

@UnstableApi
fun onVideoEnabled(
    eventTime: AnalyticsListener.EventTime!,
    decoderCounters: DecoderCounters!
): Unit

Called when a video renderer is enabled.

Parameters
eventTime: AnalyticsListener.EventTime!

The event time.

decoderCounters: DecoderCounters!

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

onVideoFrameProcessingOffset

@UnstableApi
fun onVideoFrameProcessingOffset(
    eventTime: AnalyticsListener.EventTime!,
    totalProcessingOffsetUs: Long,
    frameCount: Int
): Unit

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

The event time.

totalProcessingOffsetUs: Long

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

frameCount: Int

The number to samples included in totalProcessingOffsetUs.

onVideoInputFormatChanged

@UnstableApi
fun onVideoInputFormatChanged(
    eventTime: AnalyticsListener.EventTime!,
    format: Format!,
    decoderReuseEvaluation: DecoderReuseEvaluation?
): Unit

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

Parameters
eventTime: AnalyticsListener.EventTime!

The event time.

format: Format!

The new format.

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
fun onVideoSizeChanged(
    eventTime: AnalyticsListener.EventTime!,
    videoSize: VideoSize!
): Unit

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

The event time.

videoSize: VideoSize!

The new size of the video.

onVideoSizeChanged

@UnstableApi
fun onVideoSizeChanged(
    eventTime: AnalyticsListener.EventTime!,
    width: Int,
    height: Int,
    unappliedRotationDegrees: Int,
    pixelWidthHeightRatio: Float
): Unit

onVolumeChanged

@UnstableApi
fun onVolumeChanged(eventTime: AnalyticsListener.EventTime!, volume: Float): Unit

Called when the volume changes.

Parameters
eventTime: AnalyticsListener.EventTime!

The event time.

volume: Float

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