Interface AnalyticsListener
-
- All Known Implementing Classes:
EventLogger
,ExoHostedTest
,MediaMetricsListener
,PlaybackStatsListener
public interface AnalyticsListener
A listener for analytics events.All events are recorded with an
AnalyticsListener.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(EventTime, boolean)
) oronEvents(Player, Events)
, which is called after one or more events occurred together.
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static interface
AnalyticsListener.EventFlags
Events that can be reported viaonEvents(Player, Events)
.static class
AnalyticsListener.Events
A set ofAnalyticsListener.EventFlags
.static class
AnalyticsListener.EventTime
Time information of an event.
-
Field Summary
Fields Modifier and Type Field Description static int
EVENT_AUDIO_ATTRIBUTES_CHANGED
Audio attributes changed.static int
EVENT_AUDIO_CODEC_ERROR
The audio codec encountered an error.static int
EVENT_AUDIO_DECODER_INITIALIZED
An audio renderer created a decoder.static int
EVENT_AUDIO_DECODER_RELEASED
An audio renderer released a decoder.static int
EVENT_AUDIO_DISABLED
An audio renderer was disabled.static int
EVENT_AUDIO_ENABLED
An audio renderer was enabled.static int
EVENT_AUDIO_INPUT_FORMAT_CHANGED
The format consumed by an audio renderer changed.static int
EVENT_AUDIO_POSITION_ADVANCING
The audio position has increased for the first time since the last pause or position reset.static int
EVENT_AUDIO_SESSION_ID
An audio session id was set.static int
EVENT_AUDIO_SINK_ERROR
The audio sink encountered a non-fatal error.static int
EVENT_AUDIO_UNDERRUN
An audio underrun occurred.static int
EVENT_AVAILABLE_COMMANDS_CHANGED
Player.getAvailableCommands()
changed.static int
EVENT_BANDWIDTH_ESTIMATE
The bandwidth estimate has been updated.static int
EVENT_CUES
Player.getCurrentCues()
changed.static int
EVENT_DEVICE_INFO_CHANGED
Player.getDeviceInfo()
changed.static int
EVENT_DEVICE_VOLUME_CHANGED
Player.getDeviceVolume()
changed.static int
EVENT_DOWNSTREAM_FORMAT_CHANGED
The downstream format sent to renderers changed.static int
EVENT_DRM_KEYS_LOADED
DRM keys were loaded.static int
EVENT_DRM_KEYS_REMOVED
DRM keys were removed.static int
EVENT_DRM_KEYS_RESTORED
DRM keys were restored.static int
EVENT_DRM_SESSION_ACQUIRED
A DRM session has been acquired.static int
EVENT_DRM_SESSION_MANAGER_ERROR
A non-fatal DRM session manager error occurred.static int
EVENT_DRM_SESSION_RELEASED
A DRM session has been released.static int
EVENT_DROPPED_VIDEO_FRAMES
Video frames have been dropped.static int
EVENT_IS_LOADING_CHANGED
Player.isLoading()
()} changed.static int
EVENT_IS_PLAYING_CHANGED
Player.isPlaying()
changed.static int
EVENT_LOAD_CANCELED
A source canceled loading data.static int
EVENT_LOAD_COMPLETED
A source started completed loading data.static int
EVENT_LOAD_ERROR
A source had a non-fatal error loading data.static int
EVENT_LOAD_STARTED
A source started loading data.static int
EVENT_MAX_SEEK_TO_PREVIOUS_POSITION_CHANGED
static int
EVENT_MEDIA_ITEM_TRANSITION
Player.getCurrentMediaItem()
changed or the player started repeating the current item.static int
EVENT_MEDIA_METADATA_CHANGED
Player.getMediaMetadata()
changed.static int
EVENT_METADATA
Metadata associated with the current playback time was reported.static int
EVENT_PLAY_WHEN_READY_CHANGED
Player.getPlayWhenReady()
changed.static int
EVENT_PLAYBACK_PARAMETERS_CHANGED
Player.getPlaybackParameters()
changed.static int
EVENT_PLAYBACK_STATE_CHANGED
Player.getPlaybackState()
changed.static int
EVENT_PLAYBACK_SUPPRESSION_REASON_CHANGED
static int
EVENT_PLAYER_ERROR
Player.getPlayerError()
changed.static int
EVENT_PLAYER_RELEASED
The player was released.static int
EVENT_PLAYLIST_METADATA_CHANGED
Player.getPlaylistMetadata()
changed.static int
EVENT_POSITION_DISCONTINUITY
A position discontinuity occurred.static int
EVENT_RENDERED_FIRST_FRAME
The first frame has been rendered since setting the surface, since the renderer was reset or since the stream changed.static int
EVENT_REPEAT_MODE_CHANGED
Player.getRepeatMode()
changed.static int
EVENT_SEEK_BACK_INCREMENT_CHANGED
Player.getSeekBackIncrement()
changed.static int
EVENT_SEEK_FORWARD_INCREMENT_CHANGED
Player.getSeekForwardIncrement()
changed.static int
EVENT_SHUFFLE_MODE_ENABLED_CHANGED
Player.getShuffleModeEnabled()
changed.static int
EVENT_SKIP_SILENCE_ENABLED_CHANGED
Skipping silences was enabled or disabled in the audio stream.static int
EVENT_SURFACE_SIZE_CHANGED
The surface size changed.static int
EVENT_TIMELINE_CHANGED
Player.getCurrentTimeline()
changed.static int
EVENT_TRACK_SELECTION_PARAMETERS_CHANGED
Player.getTrackSelectionParameters()
changed.static int
EVENT_TRACKS_CHANGED
Player.getCurrentTracks()
changed.static int
EVENT_UPSTREAM_DISCARDED
Data was removed from the end of the media buffer.static int
EVENT_VIDEO_CODEC_ERROR
The video codec encountered an error.static int
EVENT_VIDEO_DECODER_INITIALIZED
A video renderer created a decoder.static int
EVENT_VIDEO_DECODER_RELEASED
A video renderer released a decoder.static int
EVENT_VIDEO_DISABLED
A video renderer was disabled.static int
EVENT_VIDEO_ENABLED
A video renderer was enabled.static int
EVENT_VIDEO_FRAME_PROCESSING_OFFSET
Video frame processing offset data has been reported.static int
EVENT_VIDEO_INPUT_FORMAT_CHANGED
The format consumed by a video renderer changed.static int
EVENT_VIDEO_SIZE_CHANGED
The video size changed.static int
EVENT_VOLUME_CHANGED
The volume changed.
-
Method Summary
All Methods Instance Methods Default Methods Deprecated Methods Modifier and Type Method Description default void
onAudioAttributesChanged(AnalyticsListener.EventTime eventTime, AudioAttributes audioAttributes)
Called when the audio attributes change.default void
onAudioCodecError(AnalyticsListener.EventTime eventTime, Exception audioCodecError)
Called when an audio decoder encounters an error.default void
onAudioDecoderInitialized(AnalyticsListener.EventTime eventTime, String decoderName, long initializationDurationMs)
Deprecated.default void
onAudioDecoderInitialized(AnalyticsListener.EventTime eventTime, String decoderName, long initializedTimestampMs, long initializationDurationMs)
Called when an audio renderer creates a decoder.default void
onAudioDecoderReleased(AnalyticsListener.EventTime eventTime, String decoderName)
Called when an audio renderer releases a decoder.default void
onAudioDisabled(AnalyticsListener.EventTime eventTime, DecoderCounters decoderCounters)
Called when an audio renderer is disabled.default void
onAudioEnabled(AnalyticsListener.EventTime eventTime, DecoderCounters decoderCounters)
Called when an audio renderer is enabled.default void
onAudioInputFormatChanged(AnalyticsListener.EventTime eventTime, Format format)
Deprecated.default void
onAudioInputFormatChanged(AnalyticsListener.EventTime eventTime, Format format, DecoderReuseEvaluation decoderReuseEvaluation)
Called when the format of the media being consumed by an audio renderer changes.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.default void
onAudioSessionIdChanged(AnalyticsListener.EventTime eventTime, int audioSessionId)
Called when the audio session ID changes.default void
onAudioSinkError(AnalyticsListener.EventTime eventTime, Exception audioSinkError)
Called whenAudioSink
has encountered an error.default void
onAudioUnderrun(AnalyticsListener.EventTime eventTime, int bufferSize, long bufferSizeMs, long elapsedSinceLastFeedMs)
Called when an audio underrun occurs.default void
onAvailableCommandsChanged(AnalyticsListener.EventTime eventTime, Player.Commands availableCommands)
Called when the player's available commands changed.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.default void
onCues(AnalyticsListener.EventTime eventTime, CueGroup cueGroup)
Called when there is a change in theCueGroup
.default void
onCues(AnalyticsListener.EventTime eventTime, List<Cue> cues)
Deprecated.UseonCues(EventTime, CueGroup)
instead.default void
onDecoderDisabled(AnalyticsListener.EventTime eventTime, int trackType, DecoderCounters decoderCounters)
Deprecated.default void
onDecoderEnabled(AnalyticsListener.EventTime eventTime, int trackType, DecoderCounters decoderCounters)
Deprecated.default void
onDecoderInitialized(AnalyticsListener.EventTime eventTime, int trackType, String decoderName, long initializationDurationMs)
default void
onDecoderInputFormatChanged(AnalyticsListener.EventTime eventTime, int trackType, Format format)
default void
onDeviceInfoChanged(AnalyticsListener.EventTime eventTime, DeviceInfo deviceInfo)
Called when the device information changesdefault void
onDeviceVolumeChanged(AnalyticsListener.EventTime eventTime, int volume, boolean muted)
Called when the device volume or mute state changes.default void
onDownstreamFormatChanged(AnalyticsListener.EventTime eventTime, MediaLoadData mediaLoadData)
Called when the downstream format sent to the renderers changed.default void
onDrmKeysLoaded(AnalyticsListener.EventTime eventTime)
Called each time drm keys are loaded.default void
onDrmKeysRemoved(AnalyticsListener.EventTime eventTime)
Called each time offline drm keys are removed.default void
onDrmKeysRestored(AnalyticsListener.EventTime eventTime)
Called each time offline drm keys are restored.default void
onDrmSessionAcquired(AnalyticsListener.EventTime eventTime)
Deprecated.ImplementonDrmSessionAcquired(EventTime, int)
instead.default void
onDrmSessionAcquired(AnalyticsListener.EventTime eventTime, @com.google.android.exoplayer2.drm.DrmSession.State int state)
Called each time a drm session is acquired.default void
onDrmSessionManagerError(AnalyticsListener.EventTime eventTime, Exception error)
Called when a drm error occurs.default void
onDrmSessionReleased(AnalyticsListener.EventTime eventTime)
Called each time a drm session is released.default void
onDroppedVideoFrames(AnalyticsListener.EventTime eventTime, int droppedFrames, long elapsedMs)
Called after video frames have been dropped.default void
onEvents(Player player, AnalyticsListener.Events events)
Called after one or more events occurred.default void
onIsLoadingChanged(AnalyticsListener.EventTime eventTime, boolean isLoading)
Called when the player starts or stops loading data from a source.default void
onIsPlayingChanged(AnalyticsListener.EventTime eventTime, boolean isPlaying)
Called when the player starts or stops playing.default void
onLoadCanceled(AnalyticsListener.EventTime eventTime, LoadEventInfo loadEventInfo, MediaLoadData mediaLoadData)
Called when a media source canceled loading data.default void
onLoadCompleted(AnalyticsListener.EventTime eventTime, LoadEventInfo loadEventInfo, MediaLoadData mediaLoadData)
Called when a media source completed loading data.default void
onLoadError(AnalyticsListener.EventTime eventTime, LoadEventInfo loadEventInfo, MediaLoadData mediaLoadData, IOException error, boolean wasCanceled)
Called when a media source loading error occurred.default void
onLoadingChanged(AnalyticsListener.EventTime eventTime, boolean isLoading)
Deprecated.UseonIsLoadingChanged(EventTime, boolean)
instead.default void
onLoadStarted(AnalyticsListener.EventTime eventTime, LoadEventInfo loadEventInfo, MediaLoadData mediaLoadData)
Called when a media source started loading data.default void
onMaxSeekToPreviousPositionChanged(AnalyticsListener.EventTime eventTime, long maxSeekToPreviousPositionMs)
Called when the maximum position for whichPlayer.seekToPrevious()
seeks to the previous window changes.default void
onMediaItemTransition(AnalyticsListener.EventTime eventTime, MediaItem mediaItem, @com.google.android.exoplayer2.Player.MediaItemTransitionReason int reason)
Called when playback transitions to a different media item.default void
onMediaMetadataChanged(AnalyticsListener.EventTime eventTime, MediaMetadata mediaMetadata)
Called when the combinedMediaMetadata
changes.default void
onMetadata(AnalyticsListener.EventTime eventTime, Metadata metadata)
Called when there isMetadata
associated with the current playback time.default void
onPlaybackParametersChanged(AnalyticsListener.EventTime eventTime, PlaybackParameters playbackParameters)
Called when the playback parameters changed.default void
onPlaybackStateChanged(AnalyticsListener.EventTime eventTime, @com.google.android.exoplayer2.Player.State int state)
Called when the playback state changed.default void
onPlaybackSuppressionReasonChanged(AnalyticsListener.EventTime eventTime, @com.google.android.exoplayer2.Player.PlaybackSuppressionReason int playbackSuppressionReason)
Called when playback suppression reason changed.default void
onPlayerError(AnalyticsListener.EventTime eventTime, PlaybackException error)
Called when a fatal player error occurred.default void
onPlayerErrorChanged(AnalyticsListener.EventTime eventTime, PlaybackException error)
Called when thePlaybackException
returned byPlayer.getPlayerError()
changes.default void
onPlayerReleased(AnalyticsListener.EventTime eventTime)
Called when thePlayer
is released.default void
onPlayerStateChanged(AnalyticsListener.EventTime eventTime, boolean playWhenReady, @com.google.android.exoplayer2.Player.State int playbackState)
Deprecated.default void
onPlaylistMetadataChanged(AnalyticsListener.EventTime eventTime, MediaMetadata playlistMetadata)
Called when the playlistMediaMetadata
changes.default void
onPlayWhenReadyChanged(AnalyticsListener.EventTime eventTime, boolean playWhenReady, @com.google.android.exoplayer2.Player.PlayWhenReadyChangeReason int reason)
Called when the value changed that indicates whether playback will proceed when ready.default void
onPositionDiscontinuity(AnalyticsListener.EventTime eventTime, @com.google.android.exoplayer2.Player.DiscontinuityReason int reason)
Deprecated.default void
onPositionDiscontinuity(AnalyticsListener.EventTime eventTime, Player.PositionInfo oldPosition, Player.PositionInfo newPosition, @com.google.android.exoplayer2.Player.DiscontinuityReason int reason)
Called when a position discontinuity occurred.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.default void
onRepeatModeChanged(AnalyticsListener.EventTime eventTime, @com.google.android.exoplayer2.Player.RepeatMode int repeatMode)
Called when the repeat mode changed.default void
onSeekBackIncrementChanged(AnalyticsListener.EventTime eventTime, long seekBackIncrementMs)
Called when the seek back increment changed.default void
onSeekForwardIncrementChanged(AnalyticsListener.EventTime eventTime, long seekForwardIncrementMs)
Called when the seek forward increment changed.default void
onSeekProcessed(AnalyticsListener.EventTime eventTime)
Deprecated.Seeks are processed without delay.default void
onSeekStarted(AnalyticsListener.EventTime eventTime)
Deprecated.UseonPositionDiscontinuity(EventTime, Player.PositionInfo, Player.PositionInfo, int)
instead, listening to changes withPlayer.DISCONTINUITY_REASON_SEEK
.default void
onShuffleModeChanged(AnalyticsListener.EventTime eventTime, boolean shuffleModeEnabled)
Called when the shuffle mode changed.default void
onSkipSilenceEnabledChanged(AnalyticsListener.EventTime eventTime, boolean skipSilenceEnabled)
Called when skipping silences is enabled or disabled in the audio stream.default void
onSurfaceSizeChanged(AnalyticsListener.EventTime eventTime, int width, int height)
Called when the output surface size changed.default void
onTimelineChanged(AnalyticsListener.EventTime eventTime, @com.google.android.exoplayer2.Player.TimelineChangeReason int reason)
Called when the timeline changed.default void
onTracksChanged(AnalyticsListener.EventTime eventTime, Tracks tracks)
Called when the tracks change.default void
onTrackSelectionParametersChanged(AnalyticsListener.EventTime eventTime, TrackSelectionParameters trackSelectionParameters)
Called when track selection parameters change.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.default void
onVideoCodecError(AnalyticsListener.EventTime eventTime, Exception videoCodecError)
Called when a video decoder encounters an error.default void
onVideoDecoderInitialized(AnalyticsListener.EventTime eventTime, String decoderName, long initializationDurationMs)
Deprecated.default void
onVideoDecoderInitialized(AnalyticsListener.EventTime eventTime, String decoderName, long initializedTimestampMs, long initializationDurationMs)
Called when a video renderer creates a decoder.default void
onVideoDecoderReleased(AnalyticsListener.EventTime eventTime, String decoderName)
Called when a video renderer releases a decoder.default void
onVideoDisabled(AnalyticsListener.EventTime eventTime, DecoderCounters decoderCounters)
Called when a video renderer is disabled.default void
onVideoEnabled(AnalyticsListener.EventTime eventTime, DecoderCounters decoderCounters)
Called when a video renderer is enabled.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.default void
onVideoInputFormatChanged(AnalyticsListener.EventTime eventTime, Format format)
Deprecated.default void
onVideoInputFormatChanged(AnalyticsListener.EventTime eventTime, Format format, DecoderReuseEvaluation decoderReuseEvaluation)
Called when the format of the media being consumed by a video renderer changes.default void
onVideoSizeChanged(AnalyticsListener.EventTime eventTime, int width, int height, int unappliedRotationDegrees, float pixelWidthHeightRatio)
Deprecated.ImplementonVideoSizeChanged(EventTime eventTime, VideoSize)
instead.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.default void
onVolumeChanged(AnalyticsListener.EventTime eventTime, float volume)
Called when the volume changes.
-
-
-
Field Detail
-
EVENT_TIMELINE_CHANGED
static final int EVENT_TIMELINE_CHANGED
Player.getCurrentTimeline()
changed.- See Also:
- Constant Field Values
-
EVENT_MEDIA_ITEM_TRANSITION
static final int EVENT_MEDIA_ITEM_TRANSITION
Player.getCurrentMediaItem()
changed or the player started repeating the current item.- See Also:
- Constant Field Values
-
EVENT_TRACKS_CHANGED
static final int EVENT_TRACKS_CHANGED
Player.getCurrentTracks()
changed.- See Also:
- Constant Field Values
-
EVENT_IS_LOADING_CHANGED
static final int EVENT_IS_LOADING_CHANGED
Player.isLoading()
()} changed.- See Also:
- Constant Field Values
-
EVENT_PLAYBACK_STATE_CHANGED
static final int EVENT_PLAYBACK_STATE_CHANGED
Player.getPlaybackState()
changed.- See Also:
- Constant Field Values
-
EVENT_PLAY_WHEN_READY_CHANGED
static final int EVENT_PLAY_WHEN_READY_CHANGED
Player.getPlayWhenReady()
changed.- See Also:
- Constant Field Values
-
EVENT_PLAYBACK_SUPPRESSION_REASON_CHANGED
static final int EVENT_PLAYBACK_SUPPRESSION_REASON_CHANGED
- See Also:
- Constant Field Values
-
EVENT_IS_PLAYING_CHANGED
static final int EVENT_IS_PLAYING_CHANGED
Player.isPlaying()
changed.- See Also:
- Constant Field Values
-
EVENT_REPEAT_MODE_CHANGED
static final int EVENT_REPEAT_MODE_CHANGED
Player.getRepeatMode()
changed.- See Also:
- Constant Field Values
-
EVENT_SHUFFLE_MODE_ENABLED_CHANGED
static final int EVENT_SHUFFLE_MODE_ENABLED_CHANGED
Player.getShuffleModeEnabled()
changed.- See Also:
- Constant Field Values
-
EVENT_PLAYER_ERROR
static final int EVENT_PLAYER_ERROR
Player.getPlayerError()
changed.- See Also:
- Constant Field Values
-
EVENT_POSITION_DISCONTINUITY
static final int EVENT_POSITION_DISCONTINUITY
A position discontinuity occurred. SeePlayer.Listener.onPositionDiscontinuity(Player.PositionInfo, Player.PositionInfo, int)
.- See Also:
- Constant Field Values
-
EVENT_PLAYBACK_PARAMETERS_CHANGED
static final int EVENT_PLAYBACK_PARAMETERS_CHANGED
Player.getPlaybackParameters()
changed.- See Also:
- Constant Field Values
-
EVENT_AVAILABLE_COMMANDS_CHANGED
static final int EVENT_AVAILABLE_COMMANDS_CHANGED
Player.getAvailableCommands()
changed.- See Also:
- Constant Field Values
-
EVENT_MEDIA_METADATA_CHANGED
static final int EVENT_MEDIA_METADATA_CHANGED
Player.getMediaMetadata()
changed.- See Also:
- Constant Field Values
-
EVENT_PLAYLIST_METADATA_CHANGED
static final int EVENT_PLAYLIST_METADATA_CHANGED
Player.getPlaylistMetadata()
changed.- See Also:
- Constant Field Values
-
EVENT_SEEK_BACK_INCREMENT_CHANGED
static final int EVENT_SEEK_BACK_INCREMENT_CHANGED
Player.getSeekBackIncrement()
changed.- See Also:
- Constant Field Values
-
EVENT_SEEK_FORWARD_INCREMENT_CHANGED
static final int EVENT_SEEK_FORWARD_INCREMENT_CHANGED
Player.getSeekForwardIncrement()
changed.- See Also:
- Constant Field Values
-
EVENT_MAX_SEEK_TO_PREVIOUS_POSITION_CHANGED
static final int EVENT_MAX_SEEK_TO_PREVIOUS_POSITION_CHANGED
- See Also:
- Constant Field Values
-
EVENT_TRACK_SELECTION_PARAMETERS_CHANGED
static final int EVENT_TRACK_SELECTION_PARAMETERS_CHANGED
Player.getTrackSelectionParameters()
changed.- See Also:
- Constant Field Values
-
EVENT_AUDIO_ATTRIBUTES_CHANGED
static final int EVENT_AUDIO_ATTRIBUTES_CHANGED
Audio attributes changed.- See Also:
- Constant Field Values
-
EVENT_AUDIO_SESSION_ID
static final int EVENT_AUDIO_SESSION_ID
An audio session id was set.- See Also:
- Constant Field Values
-
EVENT_VOLUME_CHANGED
static final int EVENT_VOLUME_CHANGED
The volume changed.- See Also:
- Constant Field Values
-
EVENT_SKIP_SILENCE_ENABLED_CHANGED
static final int EVENT_SKIP_SILENCE_ENABLED_CHANGED
Skipping silences was enabled or disabled in the audio stream.- See Also:
- Constant Field Values
-
EVENT_SURFACE_SIZE_CHANGED
static final int EVENT_SURFACE_SIZE_CHANGED
The surface size changed.- See Also:
- Constant Field Values
-
EVENT_VIDEO_SIZE_CHANGED
static final int EVENT_VIDEO_SIZE_CHANGED
The video size changed.- See Also:
- Constant Field Values
-
EVENT_RENDERED_FIRST_FRAME
static final int EVENT_RENDERED_FIRST_FRAME
The first frame has been rendered since setting the surface, since the renderer was reset or since the stream changed.- See Also:
- Constant Field Values
-
EVENT_METADATA
static final int EVENT_METADATA
Metadata associated with the current playback time was reported.- See Also:
- Constant Field Values
-
EVENT_CUES
static final int EVENT_CUES
Player.getCurrentCues()
changed.- See Also:
- Constant Field Values
-
EVENT_DEVICE_INFO_CHANGED
static final int EVENT_DEVICE_INFO_CHANGED
Player.getDeviceInfo()
changed.- See Also:
- Constant Field Values
-
EVENT_DEVICE_VOLUME_CHANGED
static final int EVENT_DEVICE_VOLUME_CHANGED
Player.getDeviceVolume()
changed.- See Also:
- Constant Field Values
-
EVENT_LOAD_STARTED
static final int EVENT_LOAD_STARTED
A source started loading data.- See Also:
- Constant Field Values
-
EVENT_LOAD_COMPLETED
static final int EVENT_LOAD_COMPLETED
A source started completed loading data.- See Also:
- Constant Field Values
-
EVENT_LOAD_CANCELED
static final int EVENT_LOAD_CANCELED
A source canceled loading data.- See Also:
- Constant Field Values
-
EVENT_LOAD_ERROR
static final int EVENT_LOAD_ERROR
A source had a non-fatal error loading data.- See Also:
- Constant Field Values
-
EVENT_DOWNSTREAM_FORMAT_CHANGED
static final int EVENT_DOWNSTREAM_FORMAT_CHANGED
The downstream format sent to renderers changed.- See Also:
- Constant Field Values
-
EVENT_UPSTREAM_DISCARDED
static final int EVENT_UPSTREAM_DISCARDED
Data was removed from the end of the media buffer.- See Also:
- Constant Field Values
-
EVENT_BANDWIDTH_ESTIMATE
static final int EVENT_BANDWIDTH_ESTIMATE
The bandwidth estimate has been updated.- See Also:
- Constant Field Values
-
EVENT_AUDIO_ENABLED
static final int EVENT_AUDIO_ENABLED
An audio renderer was enabled.- See Also:
- Constant Field Values
-
EVENT_AUDIO_DECODER_INITIALIZED
static final int EVENT_AUDIO_DECODER_INITIALIZED
An audio renderer created a decoder.- See Also:
- Constant Field Values
-
EVENT_AUDIO_INPUT_FORMAT_CHANGED
static final int EVENT_AUDIO_INPUT_FORMAT_CHANGED
The format consumed by an audio renderer changed.- See Also:
- Constant Field Values
-
EVENT_AUDIO_POSITION_ADVANCING
static final int EVENT_AUDIO_POSITION_ADVANCING
The audio position has increased for the first time since the last pause or position reset.- See Also:
- Constant Field Values
-
EVENT_AUDIO_UNDERRUN
static final int EVENT_AUDIO_UNDERRUN
An audio underrun occurred.- See Also:
- Constant Field Values
-
EVENT_AUDIO_DECODER_RELEASED
static final int EVENT_AUDIO_DECODER_RELEASED
An audio renderer released a decoder.- See Also:
- Constant Field Values
-
EVENT_AUDIO_DISABLED
static final int EVENT_AUDIO_DISABLED
An audio renderer was disabled.- See Also:
- Constant Field Values
-
EVENT_AUDIO_SINK_ERROR
static final int EVENT_AUDIO_SINK_ERROR
The audio sink encountered a non-fatal error.- See Also:
- Constant Field Values
-
EVENT_VIDEO_ENABLED
static final int EVENT_VIDEO_ENABLED
A video renderer was enabled.- See Also:
- Constant Field Values
-
EVENT_VIDEO_DECODER_INITIALIZED
static final int EVENT_VIDEO_DECODER_INITIALIZED
A video renderer created a decoder.- See Also:
- Constant Field Values
-
EVENT_VIDEO_INPUT_FORMAT_CHANGED
static final int EVENT_VIDEO_INPUT_FORMAT_CHANGED
The format consumed by a video renderer changed.- See Also:
- Constant Field Values
-
EVENT_DROPPED_VIDEO_FRAMES
static final int EVENT_DROPPED_VIDEO_FRAMES
Video frames have been dropped.- See Also:
- Constant Field Values
-
EVENT_VIDEO_DECODER_RELEASED
static final int EVENT_VIDEO_DECODER_RELEASED
A video renderer released a decoder.- See Also:
- Constant Field Values
-
EVENT_VIDEO_DISABLED
static final int EVENT_VIDEO_DISABLED
A video renderer was disabled.- See Also:
- Constant Field Values
-
EVENT_VIDEO_FRAME_PROCESSING_OFFSET
static final int EVENT_VIDEO_FRAME_PROCESSING_OFFSET
Video frame processing offset data has been reported.- See Also:
- Constant Field Values
-
EVENT_DRM_SESSION_ACQUIRED
static final int EVENT_DRM_SESSION_ACQUIRED
A DRM session has been acquired.- See Also:
- Constant Field Values
-
EVENT_DRM_KEYS_LOADED
static final int EVENT_DRM_KEYS_LOADED
DRM keys were loaded.- See Also:
- Constant Field Values
-
EVENT_DRM_SESSION_MANAGER_ERROR
static final int EVENT_DRM_SESSION_MANAGER_ERROR
A non-fatal DRM session manager error occurred.- See Also:
- Constant Field Values
-
EVENT_DRM_KEYS_RESTORED
static final int EVENT_DRM_KEYS_RESTORED
DRM keys were restored.- See Also:
- Constant Field Values
-
EVENT_DRM_KEYS_REMOVED
static final int EVENT_DRM_KEYS_REMOVED
DRM keys were removed.- See Also:
- Constant Field Values
-
EVENT_DRM_SESSION_RELEASED
static final int EVENT_DRM_SESSION_RELEASED
A DRM session has been released.- See Also:
- Constant Field Values
-
EVENT_PLAYER_RELEASED
static final int EVENT_PLAYER_RELEASED
The player was released.- See Also:
- Constant Field Values
-
EVENT_AUDIO_CODEC_ERROR
static final int EVENT_AUDIO_CODEC_ERROR
The audio codec encountered an error.- See Also:
- Constant Field Values
-
EVENT_VIDEO_CODEC_ERROR
static final int EVENT_VIDEO_CODEC_ERROR
The video codec encountered an error.- See Also:
- Constant Field Values
-
-
Method Detail
-
onPlayerStateChanged
@Deprecated default void onPlayerStateChanged(AnalyticsListener.EventTime eventTime, boolean playWhenReady, @State @com.google.android.exoplayer2.Player.State int playbackState)
Deprecated.
-
onPlaybackStateChanged
default void onPlaybackStateChanged(AnalyticsListener.EventTime eventTime, @State @com.google.android.exoplayer2.Player.State int state)
Called when the playback state changed.- Parameters:
eventTime
- The event time.state
- The newplayback state
.
-
onPlayWhenReadyChanged
default void onPlayWhenReadyChanged(AnalyticsListener.EventTime eventTime, boolean playWhenReady, @PlayWhenReadyChangeReason @com.google.android.exoplayer2.Player.PlayWhenReadyChangeReason int reason)
Called when the value changed that indicates whether playback will proceed when ready.- Parameters:
eventTime
- The event time.playWhenReady
- Whether playback will proceed when ready.reason
- Thereason
of the change.
-
onPlaybackSuppressionReasonChanged
default void onPlaybackSuppressionReasonChanged(AnalyticsListener.EventTime eventTime, @PlaybackSuppressionReason @com.google.android.exoplayer2.Player.PlaybackSuppressionReason int playbackSuppressionReason)
Called when playback suppression reason changed.- Parameters:
eventTime
- The event time.playbackSuppressionReason
- The newPlayer.PlaybackSuppressionReason
.
-
onIsPlayingChanged
default void onIsPlayingChanged(AnalyticsListener.EventTime eventTime, boolean isPlaying)
Called when the player starts or stops playing.- Parameters:
eventTime
- The event time.isPlaying
- Whether the player is playing.
-
onTimelineChanged
default void onTimelineChanged(AnalyticsListener.EventTime eventTime, @TimelineChangeReason @com.google.android.exoplayer2.Player.TimelineChangeReason int reason)
Called when the timeline changed.- Parameters:
eventTime
- The event time.reason
- The reason for the timeline change.
-
onMediaItemTransition
default void onMediaItemTransition(AnalyticsListener.EventTime eventTime, @Nullable MediaItem mediaItem, @MediaItemTransitionReason @com.google.android.exoplayer2.Player.MediaItemTransitionReason int reason)
Called when playback transitions to a different media item.- Parameters:
eventTime
- The event time.mediaItem
- The media item.reason
- The reason for the media item transition.
-
onPositionDiscontinuity
@Deprecated default void onPositionDiscontinuity(AnalyticsListener.EventTime eventTime, @DiscontinuityReason @com.google.android.exoplayer2.Player.DiscontinuityReason int reason)
Deprecated.
-
onPositionDiscontinuity
default void onPositionDiscontinuity(AnalyticsListener.EventTime eventTime, Player.PositionInfo oldPosition, Player.PositionInfo newPosition, @DiscontinuityReason @com.google.android.exoplayer2.Player.DiscontinuityReason int reason)
Called when a position discontinuity occurred.- Parameters:
eventTime
- The event time.oldPosition
- The position before the discontinuity.newPosition
- The position after the discontinuity.reason
- The reason for the position discontinuity.
-
onSeekStarted
@Deprecated default void onSeekStarted(AnalyticsListener.EventTime eventTime)
Deprecated.UseonPositionDiscontinuity(EventTime, Player.PositionInfo, Player.PositionInfo, int)
instead, listening to changes withPlayer.DISCONTINUITY_REASON_SEEK
.
-
onSeekProcessed
@Deprecated default void onSeekProcessed(AnalyticsListener.EventTime eventTime)
Deprecated.Seeks are processed without delay. UseonPositionDiscontinuity(EventTime, int)
with reasonPlayer.DISCONTINUITY_REASON_SEEK
instead.
-
onPlaybackParametersChanged
default void onPlaybackParametersChanged(AnalyticsListener.EventTime eventTime, PlaybackParameters playbackParameters)
Called when the playback parameters changed.- Parameters:
eventTime
- The event time.playbackParameters
- The new playback parameters.
-
onSeekBackIncrementChanged
default void onSeekBackIncrementChanged(AnalyticsListener.EventTime eventTime, long seekBackIncrementMs)
Called when the seek back increment changed.- Parameters:
eventTime
- The event time.seekBackIncrementMs
- The seek back increment, in milliseconds.
-
onSeekForwardIncrementChanged
default void onSeekForwardIncrementChanged(AnalyticsListener.EventTime eventTime, long seekForwardIncrementMs)
Called when the seek forward increment changed.- Parameters:
eventTime
- The event time.seekForwardIncrementMs
- The seek forward increment, in milliseconds.
-
onMaxSeekToPreviousPositionChanged
default void onMaxSeekToPreviousPositionChanged(AnalyticsListener.EventTime eventTime, long maxSeekToPreviousPositionMs)
Called when the maximum position for whichPlayer.seekToPrevious()
seeks to the previous window changes.- Parameters:
eventTime
- The event time.maxSeekToPreviousPositionMs
- The maximum seek to previous position, in milliseconds.
-
onRepeatModeChanged
default void onRepeatModeChanged(AnalyticsListener.EventTime eventTime, @RepeatMode @com.google.android.exoplayer2.Player.RepeatMode int repeatMode)
Called when the repeat mode changed.- Parameters:
eventTime
- The event time.repeatMode
- The new repeat mode.
-
onShuffleModeChanged
default void onShuffleModeChanged(AnalyticsListener.EventTime eventTime, boolean shuffleModeEnabled)
Called when the shuffle mode changed.- Parameters:
eventTime
- The event time.shuffleModeEnabled
- Whether the shuffle mode is enabled.
-
onIsLoadingChanged
default void onIsLoadingChanged(AnalyticsListener.EventTime eventTime, boolean isLoading)
Called when the player starts or stops loading data from a source.- Parameters:
eventTime
- The event time.isLoading
- Whether the player is loading.
-
onLoadingChanged
@Deprecated default void onLoadingChanged(AnalyticsListener.EventTime eventTime, boolean isLoading)
Deprecated.UseonIsLoadingChanged(EventTime, boolean)
instead.
-
onAvailableCommandsChanged
default void onAvailableCommandsChanged(AnalyticsListener.EventTime eventTime, Player.Commands availableCommands)
Called when the player's available commands changed.- Parameters:
eventTime
- The event time.availableCommands
- The available commands.
-
onPlayerError
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 ofPlaybackException
to this method in order to include more information about the error.- Parameters:
eventTime
- The event time.error
- The error.
-
onPlayerErrorChanged
default void onPlayerErrorChanged(AnalyticsListener.EventTime eventTime, @Nullable PlaybackException error)
Called when thePlaybackException
returned byPlayer.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
- The event time.error
- The new error, or null if the error is being cleared.
-
onTracksChanged
default void onTracksChanged(AnalyticsListener.EventTime eventTime, Tracks tracks)
Called when the tracks change.- Parameters:
eventTime
- The event time.tracks
- The tracks. Never null, but may be of length zero.
-
onTrackSelectionParametersChanged
default void onTrackSelectionParametersChanged(AnalyticsListener.EventTime eventTime, TrackSelectionParameters trackSelectionParameters)
Called when track selection parameters change.- Parameters:
eventTime
- The event time.trackSelectionParameters
- The newTrackSelectionParameters
.
-
onMediaMetadataChanged
default void onMediaMetadataChanged(AnalyticsListener.EventTime eventTime, MediaMetadata mediaMetadata)
Called when the combinedMediaMetadata
changes.The provided
MediaMetadata
is a combination of theMediaItem.mediaMetadata
and the static and dynamic metadata from thetrack selections' formats
andMetadataOutput.onMetadata(Metadata)
.- Parameters:
eventTime
- The event time.mediaMetadata
- The combinedMediaMetadata
.
-
onPlaylistMetadataChanged
default void onPlaylistMetadataChanged(AnalyticsListener.EventTime eventTime, MediaMetadata playlistMetadata)
Called when the playlistMediaMetadata
changes.- Parameters:
eventTime
- The event time.playlistMetadata
- The playlistMediaMetadata
.
-
onLoadStarted
default void onLoadStarted(AnalyticsListener.EventTime eventTime, LoadEventInfo loadEventInfo, MediaLoadData mediaLoadData)
Called when a media source started loading data.- Parameters:
eventTime
- The event time.loadEventInfo
- TheLoadEventInfo
defining the load event.mediaLoadData
- TheMediaLoadData
defining the data being loaded.
-
onLoadCompleted
default void onLoadCompleted(AnalyticsListener.EventTime eventTime, LoadEventInfo loadEventInfo, MediaLoadData mediaLoadData)
Called when a media source completed loading data.- Parameters:
eventTime
- The event time.loadEventInfo
- TheLoadEventInfo
defining the load event.mediaLoadData
- TheMediaLoadData
defining the data being loaded.
-
onLoadCanceled
default void onLoadCanceled(AnalyticsListener.EventTime eventTime, LoadEventInfo loadEventInfo, MediaLoadData mediaLoadData)
Called when a media source canceled loading data.- Parameters:
eventTime
- The event time.loadEventInfo
- TheLoadEventInfo
defining the load event.mediaLoadData
- TheMediaLoadData
defining the data being loaded.
-
onLoadError
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.
Player.Listener.onPlayerError(com.google.android.exoplayer2.PlaybackException)
is the appropriate place to implement such behavior. This method is called to provide the application with an opportunity to log the error if it wishes to do so.- Parameters:
eventTime
- The event time.loadEventInfo
- TheLoadEventInfo
defining the load event.mediaLoadData
- TheMediaLoadData
defining the data being loaded.error
- The load error.wasCanceled
- Whether the load was canceled as a result of the error.
-
onDownstreamFormatChanged
default void onDownstreamFormatChanged(AnalyticsListener.EventTime eventTime, MediaLoadData mediaLoadData)
Called when the downstream format sent to the renderers changed.- Parameters:
eventTime
- The event time.mediaLoadData
- TheMediaLoadData
defining the newly selected media data.
-
onUpstreamDiscarded
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:
eventTime
- The event time.mediaLoadData
- TheMediaLoadData
defining the media being discarded.
-
onBandwidthEstimate
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:
eventTime
- The event time.totalLoadTimeMs
- The total time spend loading this update is based on, in milliseconds.totalBytesLoaded
- The total bytes loaded this update is based on.bitrateEstimate
- The bandwidth estimate, in bits per second.
-
onMetadata
default void onMetadata(AnalyticsListener.EventTime eventTime, Metadata metadata)
Called when there isMetadata
associated with the current playback time.- Parameters:
eventTime
- The event time.metadata
- The metadata.
-
onCues
@Deprecated default void onCues(AnalyticsListener.EventTime eventTime, List<Cue> cues)
Deprecated.UseonCues(EventTime, CueGroup)
instead.Called when there is a change in theCues
.Both
onCues(EventTime, List)
andonCues(EventTime, CueGroup)
are called when there is a change in the cues. You should only implement one or the other.- Parameters:
eventTime
- The event time.cues
- TheCues
.
-
onCues
default void onCues(AnalyticsListener.EventTime eventTime, CueGroup cueGroup)
Called when there is a change in theCueGroup
.Both
onCues(EventTime, List)
andonCues(EventTime, CueGroup)
are called when there is a change in the cues. You should only implement one or the other.- Parameters:
eventTime
- The event time.cueGroup
- TheCueGroup
.
-
onDecoderEnabled
@Deprecated default void onDecoderEnabled(AnalyticsListener.EventTime eventTime, int trackType, DecoderCounters decoderCounters)
Deprecated.
-
onDecoderInitialized
@Deprecated default void onDecoderInitialized(AnalyticsListener.EventTime eventTime, int trackType, String decoderName, long initializationDurationMs)
-
onDecoderInputFormatChanged
@Deprecated default void onDecoderInputFormatChanged(AnalyticsListener.EventTime eventTime, int trackType, Format format)
-
onDecoderDisabled
@Deprecated default void onDecoderDisabled(AnalyticsListener.EventTime eventTime, int trackType, DecoderCounters decoderCounters)
Deprecated.
-
onAudioEnabled
default void onAudioEnabled(AnalyticsListener.EventTime eventTime, DecoderCounters decoderCounters)
Called when an audio renderer is enabled.- Parameters:
eventTime
- The event time.decoderCounters
-DecoderCounters
that will be updated by the renderer for as long as it remains enabled.
-
onAudioDecoderInitialized
default void onAudioDecoderInitialized(AnalyticsListener.EventTime eventTime, String decoderName, long initializedTimestampMs, long initializationDurationMs)
Called when an audio renderer creates a decoder.- Parameters:
eventTime
- The event time.decoderName
- The decoder that was created.initializedTimestampMs
-SystemClock.elapsedRealtime()
when initialization finished.initializationDurationMs
- The time taken to initialize the decoder in milliseconds.
-
onAudioDecoderInitialized
@Deprecated default void onAudioDecoderInitialized(AnalyticsListener.EventTime eventTime, String decoderName, long initializationDurationMs)
Deprecated.
-
onAudioInputFormatChanged
@Deprecated default void onAudioInputFormatChanged(AnalyticsListener.EventTime eventTime, Format format)
Deprecated.
-
onAudioInputFormatChanged
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:
eventTime
- The event time.format
- The new format.decoderReuseEvaluation
- The result of the evaluation to determine whether an existing decoder instance can be reused for the new format, ornull
if the renderer did not have a decoder.
-
onAudioPositionAdvancing
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:
eventTime
- The event time.playoutStartSystemTimeMs
- The approximate derivedSystem.currentTimeMillis()
at which playout started.
-
onAudioUnderrun
default void onAudioUnderrun(AnalyticsListener.EventTime eventTime, int bufferSize, long bufferSizeMs, long elapsedSinceLastFeedMs)
Called when an audio underrun occurs.- Parameters:
eventTime
- The event time.bufferSize
- The size of the audio output buffer, in bytes.bufferSizeMs
- The size of the audio output buffer, in milliseconds, if it contains PCM encoded audio.C.TIME_UNSET
if the output buffer contains non-PCM encoded audio.elapsedSinceLastFeedMs
- The time since audio was last written to the output buffer.
-
onAudioDecoderReleased
default void onAudioDecoderReleased(AnalyticsListener.EventTime eventTime, String decoderName)
Called when an audio renderer releases a decoder.- Parameters:
eventTime
- The event time.decoderName
- The decoder that was released.
-
onAudioDisabled
default void onAudioDisabled(AnalyticsListener.EventTime eventTime, DecoderCounters decoderCounters)
Called when an audio renderer is disabled.- Parameters:
eventTime
- The event time.decoderCounters
-DecoderCounters
that were updated by the renderer.
-
onAudioSessionIdChanged
default void onAudioSessionIdChanged(AnalyticsListener.EventTime eventTime, int audioSessionId)
Called when the audio session ID changes.- Parameters:
eventTime
- The event time.audioSessionId
- The audio session ID.
-
onAudioAttributesChanged
default void onAudioAttributesChanged(AnalyticsListener.EventTime eventTime, AudioAttributes audioAttributes)
Called when the audio attributes change.- Parameters:
eventTime
- The event time.audioAttributes
- The audio attributes.
-
onSkipSilenceEnabledChanged
default void onSkipSilenceEnabledChanged(AnalyticsListener.EventTime eventTime, boolean skipSilenceEnabled)
Called when skipping silences is enabled or disabled in the audio stream.- Parameters:
eventTime
- The event time.skipSilenceEnabled
- Whether skipping silences in the audio stream is enabled.
-
onAudioSinkError
default void onAudioSinkError(AnalyticsListener.EventTime eventTime, Exception audioSinkError)
Called whenAudioSink
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.
Player.Listener.onPlayerError(com.google.android.exoplayer2.PlaybackException)
is the appropriate place to implement such behavior. This method is called to provide the application with an opportunity to log the error if it wishes to do so.- Parameters:
eventTime
- The event time.audioSinkError
- The error that occurred. Typically anAudioSink.InitializationException
, aAudioSink.WriteException
, or anAudioSink.UnexpectedDiscontinuityException
.
-
onAudioCodecError
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.
Player.Listener.onPlayerError(com.google.android.exoplayer2.PlaybackException)
is the appropriate place to implement such behavior. This method is called to provide the application with an opportunity to log the error if it wishes to do so.- Parameters:
eventTime
- The event time.audioCodecError
- The error. Typically aMediaCodec.CodecException
if the renderer usesMediaCodec
, or aDecoderException
if the renderer uses a software decoder.
-
onVolumeChanged
default void onVolumeChanged(AnalyticsListener.EventTime eventTime, float volume)
Called when the volume changes.- Parameters:
eventTime
- The event time.volume
- The new volume, with 0 being silence and 1 being unity gain.
-
onDeviceInfoChanged
default void onDeviceInfoChanged(AnalyticsListener.EventTime eventTime, DeviceInfo deviceInfo)
Called when the device information changes- Parameters:
eventTime
- The event time.deviceInfo
- The newDeviceInfo
.
-
onDeviceVolumeChanged
default void onDeviceVolumeChanged(AnalyticsListener.EventTime eventTime, int volume, boolean muted)
Called when the device volume or mute state changes.- Parameters:
eventTime
- The event time.volume
- The new device volume, with 0 being silence and 1 being unity gain.muted
- Whether the device is muted.
-
onVideoEnabled
default void onVideoEnabled(AnalyticsListener.EventTime eventTime, DecoderCounters decoderCounters)
Called when a video renderer is enabled.- Parameters:
eventTime
- The event time.decoderCounters
-DecoderCounters
that will be updated by the renderer for as long as it remains enabled.
-
onVideoDecoderInitialized
default void onVideoDecoderInitialized(AnalyticsListener.EventTime eventTime, String decoderName, long initializedTimestampMs, long initializationDurationMs)
Called when a video renderer creates a decoder.- Parameters:
eventTime
- The event time.decoderName
- The decoder that was created.initializedTimestampMs
-SystemClock.elapsedRealtime()
when initialization finished.initializationDurationMs
- The time taken to initialize the decoder in milliseconds.
-
onVideoDecoderInitialized
@Deprecated default void onVideoDecoderInitialized(AnalyticsListener.EventTime eventTime, String decoderName, long initializationDurationMs)
Deprecated.
-
onVideoInputFormatChanged
@Deprecated default void onVideoInputFormatChanged(AnalyticsListener.EventTime eventTime, Format format)
Deprecated.
-
onVideoInputFormatChanged
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:
eventTime
- The event time.format
- The new format.decoderReuseEvaluation
- The result of the evaluation to determine whether an existing decoder instance can be reused for the new format, ornull
if the renderer did not have a decoder.
-
onDroppedVideoFrames
default void onDroppedVideoFrames(AnalyticsListener.EventTime eventTime, int droppedFrames, long elapsedMs)
Called after video frames have been dropped.- Parameters:
eventTime
- The event time.droppedFrames
- The number of dropped frames since the last call to this method.elapsedMs
- The duration in milliseconds over which the frames were dropped. This duration is timed from when the renderer was started or from when dropped frames were last reported (whichever was more recent), and not from when the first of the reported drops occurred.
-
onVideoDecoderReleased
default void onVideoDecoderReleased(AnalyticsListener.EventTime eventTime, String decoderName)
Called when a video renderer releases a decoder.- Parameters:
eventTime
- The event time.decoderName
- The decoder that was released.
-
onVideoDisabled
default void onVideoDisabled(AnalyticsListener.EventTime eventTime, DecoderCounters decoderCounters)
Called when a video renderer is disabled.- Parameters:
eventTime
- The event time.decoderCounters
-DecoderCounters
that were updated by the renderer.
-
onVideoFrameProcessingOffset
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:
eventTime
- The event time.totalProcessingOffsetUs
- The sum of the video frame processing offsets for frames rendered since the last call to this method.frameCount
- The number to samples included intotalProcessingOffsetUs
.
-
onVideoCodecError
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.
Player.Listener.onPlayerError(com.google.android.exoplayer2.PlaybackException)
is the appropriate place to implement such behavior. This method is called to provide the application with an opportunity to log the error if it wishes to do so.- Parameters:
eventTime
- The event time.videoCodecError
- The error. Typically aMediaCodec.CodecException
if the renderer usesMediaCodec
, or aDecoderException
if the renderer uses a software decoder.
-
onRenderedFirstFrame
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:
eventTime
- The event time.output
- The output to which a frame has been rendered. Normally aSurface
, however may also be other output types (e.g., aVideoDecoderOutputBufferRenderer
).renderTimeMs
-SystemClock.elapsedRealtime()
when the first frame was rendered.
-
onVideoSizeChanged
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:
eventTime
- The event time.videoSize
- The new size of the video.
-
onVideoSizeChanged
@Deprecated default void onVideoSizeChanged(AnalyticsListener.EventTime eventTime, int width, int height, int unappliedRotationDegrees, float pixelWidthHeightRatio)
Deprecated.ImplementonVideoSizeChanged(EventTime eventTime, VideoSize)
instead.
-
onSurfaceSizeChanged
default void onSurfaceSizeChanged(AnalyticsListener.EventTime eventTime, int width, int height)
Called when the output surface size changed.- Parameters:
eventTime
- The event time.width
- The surface width in pixels. May beC.LENGTH_UNSET
if unknown, or 0 if the video is not rendered onto a surface.height
- The surface height in pixels. May beC.LENGTH_UNSET
if unknown, or 0 if the video is not rendered onto a surface.
-
onDrmSessionAcquired
@Deprecated default void onDrmSessionAcquired(AnalyticsListener.EventTime eventTime)
Deprecated.ImplementonDrmSessionAcquired(EventTime, int)
instead.
-
onDrmSessionAcquired
default void onDrmSessionAcquired(AnalyticsListener.EventTime eventTime, @State @com.google.android.exoplayer2.drm.DrmSession.State int state)
Called each time a drm session is acquired.- Parameters:
eventTime
- The event time.state
- TheDrmSession.State
of the session when the acquisition completed.
-
onDrmKeysLoaded
default void onDrmKeysLoaded(AnalyticsListener.EventTime eventTime)
Called each time drm keys are loaded.- Parameters:
eventTime
- The event time.
-
onDrmSessionManagerError
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.
Player.Listener.onPlayerError(com.google.android.exoplayer2.PlaybackException)
is the appropriate place to implement such behavior. This method is called to provide the application with an opportunity to log the error if it wishes to do so.- Parameters:
eventTime
- The event time.error
- The error.
-
onDrmKeysRestored
default void onDrmKeysRestored(AnalyticsListener.EventTime eventTime)
Called each time offline drm keys are restored.- Parameters:
eventTime
- The event time.
-
onDrmKeysRemoved
default void onDrmKeysRemoved(AnalyticsListener.EventTime eventTime)
Called each time offline drm keys are removed.- Parameters:
eventTime
- The event time.
-
onDrmSessionReleased
default void onDrmSessionReleased(AnalyticsListener.EventTime eventTime)
Called each time a drm session is released.- Parameters:
eventTime
- The event time.
-
onPlayerReleased
default void onPlayerReleased(AnalyticsListener.EventTime eventTime)
Called when thePlayer
is released.- Parameters:
eventTime
- The event time.
-
onEvents
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:
- They intend to trigger the same logic for multiple events (e.g. when updating a UI for
both
onPlaybackStateChanged(EventTime, int)
andonPlayWhenReadyChanged(EventTime, boolean, int)
). - They need access to the
Player
object to trigger further events (e.g. to callPlayer.seekTo(long)
after aonMediaItemTransition(EventTime, MediaItem, int)
). - They intend to use multiple state values together or in combination with
Player
getter methods. For example usingPlayer.getCurrentMediaItemIndex()
with thetimeline
provided inonTimelineChanged(EventTime, int)
is only safe from within this method. - They are interested in events that logically happened together (e.g
onPlaybackStateChanged(EventTime, int)
toPlayer.STATE_BUFFERING
because ofonMediaItemTransition(EventTime, MediaItem, int)
).
- Parameters:
player
- ThePlayer
.events
- TheAnalyticsListener.Events
that occurred in this iteration.
- They intend to trigger the same logic for multiple events (e.g. when updating a UI for
both
-
-