public class EventLogger implements AnalyticsListener


Logs events from Player and other core components using Log.

Summary

Public constructors

Creates an instance.

Creates an instance.

This method is deprecated.

Use EventLogger

This method is deprecated.

Use EventLogger

Public methods

void

Called when the audio attributes change.

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

Called when an audio renderer creates a decoder.

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

Called when an audio renderer releases a decoder.

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

Called when an audio renderer is disabled.

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

Called when an audio renderer is enabled.

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

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

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

Called when the audio session ID changes.

void

Called when an AudioTrack has been initialized.

void

Called when an AudioTrack has been released.

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

Called when an audio underrun occurs.

void

Called when the downstream format sent to the renderers changed.

void

Called each time drm keys are loaded.

void

Called each time offline drm keys are removed.

void

Called each time offline drm keys are restored.

void

Called each time a drm session is acquired.

void

Called when a drm error occurs.

void

Called each time a drm session is released.

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

Called after video frames have been dropped.

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

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

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

Called when the player starts or stops playing.

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

Called when a media source loading error occurred.

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

Called when playback transitions to a different media item.

void

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

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

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

void

Called when the playback parameters changed.

void

Called when the playback state changed.

void

Called when playback suppression reason changed.

void

Called when a fatal player error occurred.

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

Called when a position discontinuity occurred.

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

Called when a frame is rendered for the first time since setting the surface, or since the renderer was reset, or since the stream being rendered was changed.

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

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

void

Called when the repeat mode changed.

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

Called when the shuffle mode changed.

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

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

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

Called when the output surface size changed.

void

Called when the timeline changed.

void

Called when the tracks change.

void

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

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

Called when a video renderer creates a decoder.

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

Called when a video renderer releases a decoder.

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

Called when a video renderer is disabled.

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

Called when a video renderer is enabled.

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

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

void

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

void

Called when the volume changes.

Protected methods

void

Logs a debug message.

void

Logs an error message.

Inherited Constants

From androidx.media3.exoplayer.analytics.AnalyticsListener
static final int

Audio attributes changed.

static final int

The audio codec encountered an error.

static final int

An audio renderer created a decoder.

static final int

An audio renderer released a decoder.

static final int

An audio renderer was disabled.

static final int

An audio renderer was enabled.

static final int

The format consumed by an audio renderer changed.

static final int

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

static final int

An audio session id was set.

static final int

The audio sink encountered a non-fatal error.

static final int

An audio track has been initialized.

static final int

An audio track has been released.

static final int

An audio underrun occurred.

static final int

getAvailableCommands changed.

static final int

The bandwidth estimate has been updated.

static final int

getCurrentCues changed.

static final int

getDeviceInfo changed.

static final int

getDeviceVolume changed.

static final int

The downstream format sent to renderers changed.

static final int

DRM keys were loaded.

static final int

DRM keys were removed.

static final int

DRM keys were restored.

static final int

A DRM session has been acquired.

static final int

A non-fatal DRM session manager error occurred.

static final int

A DRM session has been released.

static final int

Video frames have been dropped.

static final int

isLoading ()} changed.

static final int

isPlaying changed.

static final int

A source canceled loading data.

static final int

A source started completed loading data.

static final int

A source had a non-fatal error loading data.

static final int

A source started loading data.

static final int

getMaxSeekToPreviousPosition changed.

static final int

getCurrentMediaItem changed or the player started repeating the current item.

static final int

getMediaMetadata changed.

static final int

Metadata associated with the current playback time was reported.

static final int

getPlaybackParameters changed.

static final int

getPlaybackState changed.

static final int

getPlaybackSuppressionReason changed.

static final int

getPlayerError changed.

static final int

The player was released.

static final int

getPlaylistMetadata changed.

static final int

getPlayWhenReady changed.

static final int

A position discontinuity occurred.

static final int

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

static final int

A renderer changed its readiness for playback.

static final int

getRepeatMode changed.

static final int

getSeekBackIncrement changed.

static final int

getSeekForwardIncrement changed.

static final int

getShuffleModeEnabled changed.

static final int

Skipping silences was enabled or disabled in the audio stream.

static final int

The surface size changed.

static final int

getCurrentTimeline changed.

static final int

getCurrentTracks changed.

static final int

getTrackSelectionParameters changed.

static final int

Data was removed from the end of the media buffer.

static final int

The video codec encountered an error.

static final int

A video renderer created a decoder.

static final int

A video renderer released a decoder.

static final int

A video renderer was disabled.

static final int

A video renderer was enabled.

static final int

Video frame processing offset data has been reported.

static final int

The format consumed by a video renderer changed.

static final int

The video size changed.

static final int

The volume changed.

Inherited methods

From androidx.media3.exoplayer.analytics.AnalyticsListener
void
@UnstableApi
onAudioCodecError(
    AnalyticsListener.EventTime eventTime,
    Exception audioCodecError
)

Called when an audio decoder encounters an error.

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

This method is deprecated.

Use onAudioDecoderInitialized.

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

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

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

Called when AudioSink has encountered an error.

void

Called when the player's available commands changed.

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

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

void

Called when there is a change in the CueGroup.

void

This method is deprecated.

Use onCues instead.

void

Called when the device information changes

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

Called when the device volume or mute state changes.

void

This method is deprecated.

Implement onDrmSessionAcquired instead.

void

Called after one or more events occurred.

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

Called when a media source canceled loading data.

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

Called when a media source completed loading data.

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

Called when a media source started loading data.

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

This method is deprecated.

Use onIsLoadingChanged instead.

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

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

void

Called when the combined MediaMetadata changes.

void

Called when the PlaybackException returned by getPlayerError changes.

void

Called when the Player is released.

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

This method is deprecated.

Use onPlaybackStateChanged and onPlayWhenReadyChanged instead.

void

Called when the playlist MediaMetadata changes.

void

This method is deprecated.

Use onPositionDiscontinuity instead.

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

Called when the seek back increment changed.

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

Called when the seek forward increment changed.

void

This method is deprecated.

Use onPositionDiscontinuity instead, listening to changes with DISCONTINUITY_REASON_SEEK.

void

Called when track selection parameters change.

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

Called when a video decoder encounters an error.

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

This method is deprecated.

Use onVideoDecoderInitialized.

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

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

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

This method is deprecated.

Implement onVideoSizeChanged instead.

Public constructors

EventLogger

public EventLogger()

Creates an instance.

EventLogger

public EventLogger(String tag)

Creates an instance.

Parameters
String tag

The tag used for logging.

EventLogger

@UnstableApi
public EventLogger(@Nullable MappingTrackSelector trackSelector)

Creates an instance.

Parameters
@Nullable MappingTrackSelector trackSelector

This parameter is ignored.

EventLogger

@UnstableApi
public EventLogger(@Nullable MappingTrackSelector trackSelector, String tag)

Creates an instance.

Parameters
@Nullable MappingTrackSelector trackSelector

This parameter is ignored.

String tag

The tag used for logging.

Public methods

onAudioAttributesChanged

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

Called when the audio attributes change.

Parameters
AnalyticsListener.EventTime eventTime

The event time.

AudioAttributes audioAttributes

The audio attributes.

onAudioDecoderInitialized

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

Called when an audio renderer creates a decoder.

Parameters
AnalyticsListener.EventTime eventTime

The event time.

String decoderName

The decoder that was created.

long initializedTimestampMs

elapsedRealtime when initialization finished.

long initializationDurationMs

The time taken to initialize the decoder in milliseconds.

onAudioDecoderReleased

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

Called when an audio renderer releases a decoder.

Parameters
AnalyticsListener.EventTime eventTime

The event time.

String decoderName

The decoder that was released.

onAudioDisabled

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

Called when an audio renderer is disabled.

Parameters
AnalyticsListener.EventTime eventTime

The event time.

DecoderCounters decoderCounters

DecoderCounters that were updated by the renderer.

onAudioEnabled

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

Called when an audio renderer is enabled.

Parameters
AnalyticsListener.EventTime eventTime

The event time.

DecoderCounters decoderCounters

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

onAudioInputFormatChanged

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

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

Parameters
AnalyticsListener.EventTime eventTime

The event time.

Format format

The new format.

@Nullable DecoderReuseEvaluation decoderReuseEvaluation

The result of the evaluation to determine whether an existing decoder instance can be reused for the new format, or null if the renderer did not have a decoder.

onAudioSessionIdChanged

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

Called when the audio session ID changes.

Parameters
AnalyticsListener.EventTime eventTime

The event time.

int audioSessionId

The audio session ID.

onAudioTrackInitialized

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

Called when an AudioTrack has been initialized.

Parameters
AnalyticsListener.EventTime eventTime

The event time.

AudioSink.AudioTrackConfig audioTrackConfig

The AudioSink.AudioTrackConfig of the initialized .

onAudioTrackReleased

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

Called when an AudioTrack has been released.

Parameters
AnalyticsListener.EventTime eventTime

The event time.

AudioSink.AudioTrackConfig audioTrackConfig

The AudioSink.AudioTrackConfig of the released .

onAudioUnderrun

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

Called when an audio underrun occurs.

Parameters
AnalyticsListener.EventTime eventTime

The event time.

int bufferSize

The size of the audio output buffer, in bytes.

long bufferSizeMs

The size of the audio output buffer, in milliseconds, if it contains PCM encoded audio. TIME_UNSET if the output buffer contains non-PCM encoded audio.

long elapsedSinceLastFeedMs

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

onDownstreamFormatChanged

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

Called when the downstream format sent to the renderers changed.

Parameters
AnalyticsListener.EventTime eventTime

The event time.

MediaLoadData mediaLoadData

The MediaLoadData defining the newly selected media data.

onDrmKeysLoaded

@UnstableApi
public void onDrmKeysLoaded(AnalyticsListener.EventTime eventTime)

Called each time drm keys are loaded.

Parameters
AnalyticsListener.EventTime eventTime

The event time.

onDrmKeysRemoved

@UnstableApi
public void onDrmKeysRemoved(AnalyticsListener.EventTime eventTime)

Called each time offline drm keys are removed.

Parameters
AnalyticsListener.EventTime eventTime

The event time.

onDrmKeysRestored

@UnstableApi
public void onDrmKeysRestored(AnalyticsListener.EventTime eventTime)

Called each time offline drm keys are restored.

Parameters
AnalyticsListener.EventTime eventTime

The event time.

onDrmSessionAcquired

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

Called each time a drm session is acquired.

Parameters
AnalyticsListener.EventTime eventTime

The event time.

@DrmSession.State int state

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

onDrmSessionManagerError

@UnstableApi
public void onDrmSessionManagerError(
    AnalyticsListener.EventTime eventTime,
    Exception error
)

Called when a drm error occurs.

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

Parameters
AnalyticsListener.EventTime eventTime

The event time.

Exception error

The error.

onDrmSessionReleased

@UnstableApi
public void onDrmSessionReleased(AnalyticsListener.EventTime eventTime)

Called each time a drm session is released.

Parameters
AnalyticsListener.EventTime eventTime

The event time.

onDroppedVideoFrames

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

Called after video frames have been dropped.

Parameters
AnalyticsListener.EventTime eventTime

The event time.

int droppedFrames

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

long elapsedMs

The duration in milliseconds over which the frames were dropped. This duration is timed from when the renderer was started or from when dropped frames were last reported (whichever was more recent), and not from when the first of the reported drops occurred.

onIsLoadingChanged

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

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

Parameters
AnalyticsListener.EventTime eventTime

The event time.

boolean isLoading

Whether the player is loading.

onIsPlayingChanged

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

Called when the player starts or stops playing.

Parameters
AnalyticsListener.EventTime eventTime

The event time.

boolean isPlaying

Whether the player is playing.

onLoadError

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

Called when a media source loading error occurred.

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

Parameters
AnalyticsListener.EventTime eventTime

The event time.

LoadEventInfo loadEventInfo

The LoadEventInfo defining the load event.

MediaLoadData mediaLoadData

The MediaLoadData defining the data being loaded.

IOException error

The load error.

boolean wasCanceled

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

onMediaItemTransition

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

Called when playback transitions to a different media item.

Parameters
AnalyticsListener.EventTime eventTime

The event time.

@Nullable MediaItem mediaItem

The media item.

int reason

The reason for the media item transition.

onMetadata

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

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

Parameters
AnalyticsListener.EventTime eventTime

The event time.

Metadata metadata

The metadata.

onPlayWhenReadyChanged

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

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

Parameters
AnalyticsListener.EventTime eventTime

The event time.

boolean playWhenReady

Whether playback will proceed when ready.

@Player.PlayWhenReadyChangeReason int reason

The reason of the change.

onPlaybackParametersChanged

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

Called when the playback parameters changed.

Parameters
AnalyticsListener.EventTime eventTime

The event time.

PlaybackParameters playbackParameters

The new playback parameters.

onPlaybackStateChanged

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

Called when the playback state changed.

Parameters
AnalyticsListener.EventTime eventTime

The event time.

@Player.State int state

The new playback state.

onPlaybackSuppressionReasonChanged

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

Called when playback suppression reason changed.

Parameters
AnalyticsListener.EventTime eventTime

The event time.

@Player.PlaybackSuppressionReason int playbackSuppressionReason

The new PlaybackSuppressionReason.

onPlayerError

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

Called when a fatal player error occurred.

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

Parameters
AnalyticsListener.EventTime eventTime

The event time.

PlaybackException error

The error.

onPositionDiscontinuity

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

Called when a position discontinuity occurred.

Parameters
AnalyticsListener.EventTime eventTime

The event time.

Player.PositionInfo oldPosition

The position before the discontinuity.

Player.PositionInfo newPosition

The position after the discontinuity.

@Player.DiscontinuityReason int reason

The reason for the position discontinuity.

onRenderedFirstFrame

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

Called when a frame is rendered for the first time since setting the surface, or since the renderer was reset, or since the stream being rendered was changed.

Parameters
AnalyticsListener.EventTime eventTime

The event time.

Object output

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

long renderTimeMs

elapsedRealtime when the first frame was rendered.

onRendererReadyChanged

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

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

Parameters
AnalyticsListener.EventTime eventTime

The event time.

int rendererIndex

The index of the renderer in the instance.

@C.TrackType int rendererTrackType

The C.TrackType of the renderer.

boolean isRendererReady

Whether the renderer allows playback to be ready.

onRepeatModeChanged

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

Called when the repeat mode changed.

Parameters
AnalyticsListener.EventTime eventTime

The event time.

@Player.RepeatMode int repeatMode

The new repeat mode.

onShuffleModeChanged

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

Called when the shuffle mode changed.

Parameters
AnalyticsListener.EventTime eventTime

The event time.

boolean shuffleModeEnabled

Whether the shuffle mode is enabled.

onSkipSilenceEnabledChanged

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

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

Parameters
AnalyticsListener.EventTime eventTime

The event time.

boolean skipSilenceEnabled

Whether skipping silences in the audio stream is enabled.

onSurfaceSizeChanged

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

Called when the output surface size changed.

Parameters
AnalyticsListener.EventTime eventTime

The event time.

int width

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

int height

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

onTimelineChanged

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

Called when the timeline changed.

Parameters
AnalyticsListener.EventTime eventTime

The event time.

@Player.TimelineChangeReason int reason

The reason for the timeline change.

onTracksChanged

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

Called when the tracks change.

Parameters
AnalyticsListener.EventTime eventTime

The event time.

Tracks tracks

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

onUpstreamDiscarded

@UnstableApi
public void onUpstreamDiscarded(
    AnalyticsListener.EventTime eventTime,
    MediaLoadData mediaLoadData
)

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

Parameters
AnalyticsListener.EventTime eventTime

The event time.

MediaLoadData mediaLoadData

The MediaLoadData defining the media being discarded.

onVideoDecoderInitialized

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

Called when a video renderer creates a decoder.

Parameters
AnalyticsListener.EventTime eventTime

The event time.

String decoderName

The decoder that was created.

long initializedTimestampMs

elapsedRealtime when initialization finished.

long initializationDurationMs

The time taken to initialize the decoder in milliseconds.

onVideoDecoderReleased

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

Called when a video renderer releases a decoder.

Parameters
AnalyticsListener.EventTime eventTime

The event time.

String decoderName

The decoder that was released.

onVideoDisabled

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

Called when a video renderer is disabled.

Parameters
AnalyticsListener.EventTime eventTime

The event time.

DecoderCounters decoderCounters

DecoderCounters that were updated by the renderer.

onVideoEnabled

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

Called when a video renderer is enabled.

Parameters
AnalyticsListener.EventTime eventTime

The event time.

DecoderCounters decoderCounters

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

onVideoInputFormatChanged

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

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

Parameters
AnalyticsListener.EventTime eventTime

The event time.

Format format

The new format.

@Nullable DecoderReuseEvaluation decoderReuseEvaluation

The result of the evaluation to determine whether an existing decoder instance can be reused for the new format, or null if the renderer did not have a decoder.

onVideoSizeChanged

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

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

Parameters
AnalyticsListener.EventTime eventTime

The event time.

VideoSize videoSize

The new size of the video.

onVolumeChanged

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

Called when the volume changes.

Parameters
AnalyticsListener.EventTime eventTime

The event time.

float volume

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

Protected methods

logd

@UnstableApi
protected void logd(String msg)

Logs a debug message.

Parameters
String msg

The message to log.

loge

@UnstableApi
protected void loge(String msg)

Logs an error message.

Parameters
String msg

The message to log.