Class DefaultAnalyticsCollector
- java.lang.Object
-
- com.google.android.exoplayer2.analytics.DefaultAnalyticsCollector
-
- All Implemented Interfaces:
AnalyticsCollector,DrmSessionEventListener,Player.Listener,MediaSourceEventListener,BandwidthMeter.EventListener
@Deprecated public class DefaultAnalyticsCollector extends Object implements AnalyticsCollector
Deprecated.com.google.android.exoplayer2 is deprecated. Please migrate to androidx.media3 (which contains the same ExoPlayer code). See the migration guide for more details, including a script to help with the migration.Data collector that forwards analytics events toAnalyticsListeners.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface com.google.android.exoplayer2.upstream.BandwidthMeter.EventListener
BandwidthMeter.EventListener.EventDispatcher
-
Nested classes/interfaces inherited from interface com.google.android.exoplayer2.drm.DrmSessionEventListener
DrmSessionEventListener.EventDispatcher
-
Nested classes/interfaces inherited from interface com.google.android.exoplayer2.source.MediaSourceEventListener
MediaSourceEventListener.EventDispatcher
-
-
Constructor Summary
Constructors Constructor Description DefaultAnalyticsCollector(Clock clock)Deprecated.Creates an analytics collector.
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description voidaddListener(AnalyticsListener listener)Deprecated.Adds a listener for analytics events.protected AnalyticsListener.EventTimegenerateCurrentPlayerMediaPeriodEventTime()Deprecated.Generates anAnalyticsListener.EventTimefor the currently playing item in the player.protected AnalyticsListener.EventTimegenerateEventTime(Timeline timeline, int windowIndex, MediaSource.MediaPeriodId mediaPeriodId)Deprecated.Returns a newAnalyticsListener.EventTimefor the specified timeline, window and media period id.voidnotifySeekStarted()Deprecated.Notify analytics collector that a seek operation will start.voidonAudioAttributesChanged(AudioAttributes audioAttributes)Deprecated.Called when the value ofPlayer.getAudioAttributes()changes.voidonAudioCodecError(Exception audioCodecError)Deprecated.Called when an audio decoder encounters an error.voidonAudioDecoderInitialized(String decoderName, long initializedTimestampMs, long initializationDurationMs)Deprecated.Called when a audio decoder is created.voidonAudioDecoderReleased(String decoderName)Deprecated.Called when a audio decoder is released.voidonAudioDisabled(DecoderCounters counters)Deprecated.Called when the audio renderer is disabled.voidonAudioEnabled(DecoderCounters counters)Deprecated.Called when the audio renderer is enabled.voidonAudioInputFormatChanged(Format format, DecoderReuseEvaluation decoderReuseEvaluation)Deprecated.Called when the format of the media being consumed by the audio renderer changes.voidonAudioPositionAdvancing(long playoutStartSystemTimeMs)Deprecated.Called when the audio position has increased for the first time since the last pause or position reset.voidonAudioSessionIdChanged(int audioSessionId)Deprecated.Called when the audio session ID changes.voidonAudioSinkError(Exception audioSinkError)Deprecated.Called whenAudioSinkhas encountered an error.voidonAudioUnderrun(int bufferSize, long bufferSizeMs, long elapsedSinceLastFeedMs)Deprecated.Called when an audio underrun occurs.voidonAvailableCommandsChanged(Player.Commands availableCommands)Deprecated.Called when the value returned fromPlayer.isCommandAvailable(int)changes for at least onePlayer.Command.voidonBandwidthSample(int elapsedMs, long bytesTransferred, long bitrateEstimate)Deprecated.Called periodically to indicate that bytes have been transferred or the estimated bitrate has changed.voidonCues(CueGroup cueGroup)Deprecated.Called when the value ofPlayer.getCurrentCues()changes.voidonCues(List<Cue> cues)Deprecated.Called when the value ofPlayer.getCurrentCues()changes.voidonDeviceInfoChanged(DeviceInfo deviceInfo)Deprecated.Called when the device information changesvoidonDeviceVolumeChanged(int volume, boolean muted)Deprecated.Called when the value ofPlayer.getDeviceVolume()orPlayer.isDeviceMuted()changes.voidonDownstreamFormatChanged(int windowIndex, MediaSource.MediaPeriodId mediaPeriodId, MediaLoadData mediaLoadData)Deprecated.Called when a downstream format change occurs (i.e.voidonDrmKeysLoaded(int windowIndex, MediaSource.MediaPeriodId mediaPeriodId)Deprecated.Called each time keys are loaded.voidonDrmKeysRemoved(int windowIndex, MediaSource.MediaPeriodId mediaPeriodId)Deprecated.Called each time offline keys are removed.voidonDrmKeysRestored(int windowIndex, MediaSource.MediaPeriodId mediaPeriodId)Deprecated.Called each time offline keys are restored.voidonDrmSessionAcquired(int windowIndex, MediaSource.MediaPeriodId mediaPeriodId, @com.google.android.exoplayer2.drm.DrmSession.State int state)Deprecated.Called each time a drm session is acquired.voidonDrmSessionManagerError(int windowIndex, MediaSource.MediaPeriodId mediaPeriodId, Exception error)Deprecated.Called when a drm error occurs.voidonDrmSessionReleased(int windowIndex, MediaSource.MediaPeriodId mediaPeriodId)Deprecated.Called each time a drm session is released.voidonDroppedFrames(int count, long elapsedMs)Deprecated.Called to report the number of frames dropped by the video renderer.voidonEvents(Player player, Player.Events events)Deprecated.Called when one or more player states changed.voidonIsLoadingChanged(boolean isLoading)Deprecated.Called when the player starts or stops loading the source.voidonIsPlayingChanged(boolean isPlaying)Deprecated.Called when the value ofPlayer.isPlaying()changes.voidonLoadCanceled(int windowIndex, MediaSource.MediaPeriodId mediaPeriodId, LoadEventInfo loadEventInfo, MediaLoadData mediaLoadData)Deprecated.Called when a load is canceled.voidonLoadCompleted(int windowIndex, MediaSource.MediaPeriodId mediaPeriodId, LoadEventInfo loadEventInfo, MediaLoadData mediaLoadData)Deprecated.Called when a load ends.voidonLoadError(int windowIndex, MediaSource.MediaPeriodId mediaPeriodId, LoadEventInfo loadEventInfo, MediaLoadData mediaLoadData, IOException error, boolean wasCanceled)Deprecated.Called when a load error occurs.voidonLoadingChanged(boolean isLoading)Deprecated.voidonLoadStarted(int windowIndex, MediaSource.MediaPeriodId mediaPeriodId, LoadEventInfo loadEventInfo, MediaLoadData mediaLoadData)Deprecated.Called when a load begins.voidonMaxSeekToPreviousPositionChanged(long maxSeekToPreviousPositionMs)Deprecated.Called when the value ofPlayer.getMaxSeekToPreviousPosition()changes.voidonMediaItemTransition(MediaItem mediaItem, @com.google.android.exoplayer2.Player.MediaItemTransitionReason int reason)Deprecated.Called when playback transitions to a media item or starts repeating a media item according to the currentrepeat mode.voidonMediaMetadataChanged(MediaMetadata mediaMetadata)Deprecated.Called when the value ofPlayer.getMediaMetadata()changes.voidonMetadata(Metadata metadata)Deprecated.Called when there is metadata associated with the current playback time.voidonPlaybackParametersChanged(PlaybackParameters playbackParameters)Deprecated.Called when the value ofPlayer.getPlaybackParameters()changes.voidonPlaybackStateChanged(@com.google.android.exoplayer2.Player.State int playbackState)Deprecated.Called when the value returned fromPlayer.getPlaybackState()changes.voidonPlaybackSuppressionReasonChanged(@com.google.android.exoplayer2.Player.PlaybackSuppressionReason int playbackSuppressionReason)Deprecated.Called when the value returned fromPlayer.getPlaybackSuppressionReason()changes.voidonPlayerError(PlaybackException error)Deprecated.Called when an error occurs.voidonPlayerErrorChanged(PlaybackException error)Deprecated.Called when thePlaybackExceptionreturned byPlayer.getPlayerError()changes.voidonPlayerStateChanged(boolean playWhenReady, @com.google.android.exoplayer2.Player.State int playbackState)Deprecated.voidonPlaylistMetadataChanged(MediaMetadata playlistMetadata)Deprecated.Called when the value ofPlayer.getPlaylistMetadata()changes.voidonPlayWhenReadyChanged(boolean playWhenReady, @com.google.android.exoplayer2.Player.PlayWhenReadyChangeReason int reason)Deprecated.Called when the value returned fromPlayer.getPlayWhenReady()changes.voidonPositionDiscontinuity(@com.google.android.exoplayer2.Player.DiscontinuityReason int reason)Deprecated.voidonPositionDiscontinuity(Player.PositionInfo oldPosition, Player.PositionInfo newPosition, @com.google.android.exoplayer2.Player.DiscontinuityReason int reason)Deprecated.Called when a position discontinuity occurs.voidonRenderedFirstFrame()Deprecated.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.voidonRenderedFirstFrame(Object output, long renderTimeMs)Deprecated.Called when a frame is rendered for the first time since setting the output, or since the renderer was reset, or since the stream being rendered was changed.voidonRepeatModeChanged(@com.google.android.exoplayer2.Player.RepeatMode int repeatMode)Deprecated.Called when the value ofPlayer.getRepeatMode()changes.voidonSeekBackIncrementChanged(long seekBackIncrementMs)Deprecated.Called when the value ofPlayer.getSeekBackIncrement()changes.voidonSeekForwardIncrementChanged(long seekForwardIncrementMs)Deprecated.Called when the value ofPlayer.getSeekForwardIncrement()changes.voidonShuffleModeEnabledChanged(boolean shuffleModeEnabled)Deprecated.Called when the value ofPlayer.getShuffleModeEnabled()changes.voidonSkipSilenceEnabledChanged(boolean skipSilenceEnabled)Deprecated.Called when skipping silences is enabled or disabled in the audio stream.voidonSurfaceSizeChanged(int width, int height)Deprecated.Called each time there's a change in the size of the surface onto which the video is being rendered.voidonTimelineChanged(Timeline timeline, @com.google.android.exoplayer2.Player.TimelineChangeReason int reason)Deprecated.Called when the value ofPlayer.getCurrentTimeline()changes.voidonTracksChanged(Tracks tracks)Deprecated.Called when the value ofPlayer.getCurrentTracks()changes.voidonTrackSelectionParametersChanged(TrackSelectionParameters parameters)Deprecated.Called when the value returned fromPlayer.getTrackSelectionParameters()changes.voidonUpstreamDiscarded(int windowIndex, MediaSource.MediaPeriodId mediaPeriodId, MediaLoadData mediaLoadData)Deprecated.Called when data is removed from the back of a media buffer, typically so that it can be re-buffered in a different format.voidonVideoCodecError(Exception videoCodecError)Deprecated.Called when a video decoder encounters an error.voidonVideoDecoderInitialized(String decoderName, long initializedTimestampMs, long initializationDurationMs)Deprecated.Called when a video decoder is created.voidonVideoDecoderReleased(String decoderName)Deprecated.Called when a video decoder is released.voidonVideoDisabled(DecoderCounters counters)Deprecated.Called when the video renderer is disabled.voidonVideoEnabled(DecoderCounters counters)Deprecated.Called when the video renderer is enabled.voidonVideoFrameProcessingOffset(long totalProcessingOffsetUs, int frameCount)Deprecated.Called to report the video processing offset of video frames processed by the video renderer.voidonVideoInputFormatChanged(Format format, DecoderReuseEvaluation decoderReuseEvaluation)Deprecated.Called when the format of the media being consumed by the video renderer changes.voidonVideoSizeChanged(VideoSize videoSize)Deprecated.Called each time whenPlayer.getVideoSize()changes.voidonVolumeChanged(float volume)Deprecated.Called when the value ofPlayer.getVolume()changes.voidrelease()Deprecated.Releases the collector.voidremoveListener(AnalyticsListener listener)Deprecated.Removes a previously added analytics event listener.protected voidsendEvent(AnalyticsListener.EventTime eventTime, int eventFlag, ListenerSet.Event<AnalyticsListener> eventInvocation)Deprecated.Sends an event to registered listeners.voidsetPlayer(Player player, Looper looper)Deprecated.Sets the player for which data will be collected.voidsetThrowsWhenUsingWrongThread(boolean throwsWhenUsingWrongThread)Deprecated.Do not use this method and ensure all calls are made from the correct thread.voidupdateMediaPeriodQueueInfo(List<MediaSource.MediaPeriodId> queue, MediaSource.MediaPeriodId readingPeriod)Deprecated.Updates the playback queue information used for event association.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface com.google.android.exoplayer2.drm.DrmSessionEventListener
onDrmSessionAcquired
-
-
-
-
Method Detail
-
setThrowsWhenUsingWrongThread
@Deprecated public void setThrowsWhenUsingWrongThread(boolean throwsWhenUsingWrongThread)
Deprecated.Do not use this method and ensure all calls are made from the correct thread.Sets whether methods throw when using the wrong thread.Do not use this method unless to support legacy use cases.
- Parameters:
throwsWhenUsingWrongThread- Whether to throw when using the wrong thread.
-
addListener
@CallSuper public void addListener(AnalyticsListener listener)
Deprecated.Description copied from interface:AnalyticsCollectorAdds a listener for analytics events.- Specified by:
addListenerin interfaceAnalyticsCollector- Parameters:
listener- The listener to add.
-
removeListener
@CallSuper public void removeListener(AnalyticsListener listener)
Deprecated.Description copied from interface:AnalyticsCollectorRemoves a previously added analytics event listener.- Specified by:
removeListenerin interfaceAnalyticsCollector- Parameters:
listener- The listener to remove.
-
setPlayer
@CallSuper public void setPlayer(Player player, Looper looper)
Deprecated.Description copied from interface:AnalyticsCollectorSets the player for which data will be collected. Must only be called if no player has been set yet or the current player is idle.- Specified by:
setPlayerin interfaceAnalyticsCollector- Parameters:
player- ThePlayerfor which data will be collected.looper- TheLooperused for listener callbacks.
-
release
@CallSuper public void release()
Deprecated.Description copied from interface:AnalyticsCollectorReleases the collector. Must be called after the player for which data is collected has been released.- Specified by:
releasein interfaceAnalyticsCollector
-
updateMediaPeriodQueueInfo
public final void updateMediaPeriodQueueInfo(List<MediaSource.MediaPeriodId> queue, @Nullable MediaSource.MediaPeriodId readingPeriod)
Deprecated.Description copied from interface:AnalyticsCollectorUpdates the playback queue information used for event association.Should only be called by the player controlling the queue and not from app code.
- Specified by:
updateMediaPeriodQueueInfoin interfaceAnalyticsCollector- Parameters:
queue- The playback queue of media periods identified by theirMediaSource.MediaPeriodId.readingPeriod- The media period in the queue that is currently being read by renderers, or null if the queue is empty.
-
notifySeekStarted
public final void notifySeekStarted()
Deprecated.Description copied from interface:AnalyticsCollectorNotify analytics collector that a seek operation will start. Should be called before the player adjusts its state and position to the seek.- Specified by:
notifySeekStartedin interfaceAnalyticsCollector
-
onAudioEnabled
public final void onAudioEnabled(DecoderCounters counters)
Deprecated.Description copied from interface:AnalyticsCollectorCalled when the audio renderer is enabled.- Specified by:
onAudioEnabledin interfaceAnalyticsCollector- Parameters:
counters-DecoderCountersthat will be updated by the audio renderer for as long as it remains enabled.
-
onAudioDecoderInitialized
public final void onAudioDecoderInitialized(String decoderName, long initializedTimestampMs, long initializationDurationMs)
Deprecated.Description copied from interface:AnalyticsCollectorCalled when a audio decoder is created.- Specified by:
onAudioDecoderInitializedin interfaceAnalyticsCollector- Parameters:
decoderName- The audio decoder that was created.initializedTimestampMs-SystemClock.elapsedRealtime()when initialization finished.initializationDurationMs- The time taken to initialize the decoder in milliseconds.
-
onAudioInputFormatChanged
public final void onAudioInputFormatChanged(Format format, @Nullable DecoderReuseEvaluation decoderReuseEvaluation)
Deprecated.Description copied from interface:AnalyticsCollectorCalled when the format of the media being consumed by the audio renderer changes.- Specified by:
onAudioInputFormatChangedin interfaceAnalyticsCollector- Parameters:
format- The new format.decoderReuseEvaluation- The result of the evaluation to determine whether an existing decoder instance can be reused for the new format, ornullif the renderer did not have a decoder.
-
onAudioPositionAdvancing
public final void onAudioPositionAdvancing(long playoutStartSystemTimeMs)
Deprecated.Description copied from interface:AnalyticsCollectorCalled when the audio position has increased for the first time since the last pause or position reset.- Specified by:
onAudioPositionAdvancingin interfaceAnalyticsCollector- Parameters:
playoutStartSystemTimeMs- The approximate derivedSystem.currentTimeMillis()at which playout started.
-
onAudioUnderrun
public final void onAudioUnderrun(int bufferSize, long bufferSizeMs, long elapsedSinceLastFeedMs)Deprecated.Description copied from interface:AnalyticsCollectorCalled when an audio underrun occurs.- Specified by:
onAudioUnderrunin interfaceAnalyticsCollector- Parameters:
bufferSize- The size of the audio output buffer, in bytes.bufferSizeMs- The size of the audio output buffer, in milliseconds, if it contains PCM encoded audio.C.TIME_UNSETif the output buffer contains non-PCM encoded audio.elapsedSinceLastFeedMs- The time since audio was last written to the output buffer.
-
onAudioDecoderReleased
public final void onAudioDecoderReleased(String decoderName)
Deprecated.Description copied from interface:AnalyticsCollectorCalled when a audio decoder is released.- Specified by:
onAudioDecoderReleasedin interfaceAnalyticsCollector- Parameters:
decoderName- The audio decoder that was released.
-
onAudioDisabled
public final void onAudioDisabled(DecoderCounters counters)
Deprecated.Description copied from interface:AnalyticsCollectorCalled when the audio renderer is disabled.- Specified by:
onAudioDisabledin interfaceAnalyticsCollector- Parameters:
counters-DecoderCountersthat were updated by the audio renderer.
-
onAudioSinkError
public final void onAudioSinkError(Exception audioSinkError)
Deprecated.Description copied from interface:AnalyticsCollectorCalled whenAudioSinkhas encountered an error.If the sink writes to a platform
AudioTrack, this will be called for allAudioTrackerrors.- Specified by:
onAudioSinkErrorin interfaceAnalyticsCollector- Parameters:
audioSinkError- The error that occurred. Typically anAudioSink.InitializationException, aAudioSink.WriteException, or anAudioSink.UnexpectedDiscontinuityException.
-
onAudioCodecError
public final void onAudioCodecError(Exception audioCodecError)
Deprecated.Description copied from interface:AnalyticsCollectorCalled when an audio decoder encounters an error.- Specified by:
onAudioCodecErrorin interfaceAnalyticsCollector- Parameters:
audioCodecError- The error. Typically aMediaCodec.CodecExceptionif the renderer usesMediaCodec, or aDecoderExceptionif the renderer uses a software decoder.
-
onVolumeChanged
public final void onVolumeChanged(float volume)
Deprecated.Description copied from interface:Player.ListenerCalled when the value ofPlayer.getVolume()changes.Player.Listener.onEvents(Player, Events)will also be called to report this event along with other events that happen in the sameLoopermessage queue iteration.- Specified by:
onVolumeChangedin interfacePlayer.Listener- Parameters:
volume- The new volume, with 0 being silence and 1 being unity gain.
-
onVideoEnabled
public final void onVideoEnabled(DecoderCounters counters)
Deprecated.Description copied from interface:AnalyticsCollectorCalled when the video renderer is enabled.- Specified by:
onVideoEnabledin interfaceAnalyticsCollector- Parameters:
counters-DecoderCountersthat will be updated by the video renderer for as long as it remains enabled.
-
onVideoDecoderInitialized
public final void onVideoDecoderInitialized(String decoderName, long initializedTimestampMs, long initializationDurationMs)
Deprecated.Description copied from interface:AnalyticsCollectorCalled when a video decoder is created.- Specified by:
onVideoDecoderInitializedin interfaceAnalyticsCollector- Parameters:
decoderName- The decoder that was created.initializedTimestampMs-SystemClock.elapsedRealtime()when initialization finished.initializationDurationMs- The time taken to initialize the decoder in milliseconds.
-
onVideoInputFormatChanged
public final void onVideoInputFormatChanged(Format format, @Nullable DecoderReuseEvaluation decoderReuseEvaluation)
Deprecated.Description copied from interface:AnalyticsCollectorCalled when the format of the media being consumed by the video renderer changes.- Specified by:
onVideoInputFormatChangedin interfaceAnalyticsCollector- Parameters:
format- The new format.decoderReuseEvaluation- The result of the evaluation to determine whether an existing decoder instance can be reused for the new format, ornullif the renderer did not have a decoder.
-
onDroppedFrames
public final void onDroppedFrames(int count, long elapsedMs)Deprecated.Description copied from interface:AnalyticsCollectorCalled to report the number of frames dropped by the video renderer. Dropped frames are reported whenever the renderer is stopped having dropped frames, and optionally, whenever the count reaches a specified threshold whilst the renderer is started.- Specified by:
onDroppedFramesin interfaceAnalyticsCollector- Parameters:
count- The number of dropped frames.elapsedMs- The duration in milliseconds over which the frames were dropped. This duration is timed from when the renderer was started or from when dropped frames were last reported (whichever was more recent), and not from when the first of the reported drops occurred.
-
onVideoDecoderReleased
public final void onVideoDecoderReleased(String decoderName)
Deprecated.Description copied from interface:AnalyticsCollectorCalled when a video decoder is released.- Specified by:
onVideoDecoderReleasedin interfaceAnalyticsCollector- Parameters:
decoderName- The video decoder that was released.
-
onVideoDisabled
public final void onVideoDisabled(DecoderCounters counters)
Deprecated.Description copied from interface:AnalyticsCollectorCalled when the video renderer is disabled.- Specified by:
onVideoDisabledin interfaceAnalyticsCollector- Parameters:
counters-DecoderCountersthat were updated by the video renderer.
-
onRenderedFirstFrame
public final void onRenderedFirstFrame(Object output, long renderTimeMs)
Deprecated.Description copied from interface:AnalyticsCollectorCalled when a frame is rendered for the first time since setting the output, or since the renderer was reset, or since the stream being rendered was changed.- Specified by:
onRenderedFirstFramein interfaceAnalyticsCollector- Parameters:
output- The output of the video renderer. Normally aSurface, however some video renderers may have other output types (e.g., aVideoDecoderOutputBufferRenderer).renderTimeMs- TheSystemClock.elapsedRealtime()when the frame was rendered.
-
onVideoFrameProcessingOffset
public final void onVideoFrameProcessingOffset(long totalProcessingOffsetUs, int frameCount)Deprecated.Description copied from interface:AnalyticsCollectorCalled to report the video processing offset of video frames processed by the video renderer.Video processing offset represents how early a video frame is processed compared to the player's current position. For each video frame, the offset is calculated as Pvf - Ppl where Pvf is the presentation timestamp of the video frame and Ppl is the current position of the player. Positive values indicate the frame was processed early enough whereas negative values indicate that the player's position had progressed beyond the frame's timestamp when the frame was processed (and the frame was probably dropped).
The renderer reports the sum of video processing offset samples (one sample per processed video frame: dropped, skipped or rendered) and the total number of samples.
- Specified by:
onVideoFrameProcessingOffsetin interfaceAnalyticsCollector- Parameters:
totalProcessingOffsetUs- The sum of all video frame processing offset samples for the video frames processed by the renderer in microseconds.frameCount- The number of samples included in thetotalProcessingOffsetUs.
-
onVideoCodecError
public final void onVideoCodecError(Exception videoCodecError)
Deprecated.Description copied from interface:AnalyticsCollectorCalled 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.- Specified by:
onVideoCodecErrorin interfaceAnalyticsCollector- Parameters:
videoCodecError- The error. Typically aMediaCodec.CodecExceptionif the renderer usesMediaCodec, or aDecoderExceptionif the renderer uses a software decoder.
-
onSurfaceSizeChanged
public final void onSurfaceSizeChanged(int width, int height)Deprecated.Description copied from interface:Player.ListenerCalled each time there's a change in the size of the surface onto which the video is being rendered.Player.Listener.onEvents(Player, Events)will also be called to report this event along with other events that happen in the sameLoopermessage queue iteration.- Specified by:
onSurfaceSizeChangedin interfacePlayer.Listener- Parameters:
width- The surface width in pixels. May beC.LENGTH_UNSETif unknown, or 0 if the video is not rendered onto a surface.height- The surface height in pixels. May beC.LENGTH_UNSETif unknown, or 0 if the video is not rendered onto a surface.
-
onLoadStarted
public final void onLoadStarted(int windowIndex, @Nullable MediaSource.MediaPeriodId mediaPeriodId, LoadEventInfo loadEventInfo, MediaLoadData mediaLoadData)Deprecated.Description copied from interface:MediaSourceEventListenerCalled when a load begins.- Specified by:
onLoadStartedin interfaceMediaSourceEventListener- Parameters:
windowIndex- The window index in the timeline of the media source this load belongs to.mediaPeriodId- TheMediaSource.MediaPeriodIdthis load belongs to. Null if the load does not belong to a specific media period.loadEventInfo- TheLoadEventInfocorresponding to the event. The value ofLoadEventInfo.uriwon't reflect potential redirection yet andLoadEventInfo.responseHeaderswill be empty.mediaLoadData- TheMediaLoadDatadefining the data being loaded.
-
onLoadCompleted
public final void onLoadCompleted(int windowIndex, @Nullable MediaSource.MediaPeriodId mediaPeriodId, LoadEventInfo loadEventInfo, MediaLoadData mediaLoadData)Deprecated.Description copied from interface:MediaSourceEventListenerCalled when a load ends.- Specified by:
onLoadCompletedin interfaceMediaSourceEventListener- Parameters:
windowIndex- The window index in the timeline of the media source this load belongs to.mediaPeriodId- TheMediaSource.MediaPeriodIdthis load belongs to. Null if the load does not belong to a specific media period.loadEventInfo- TheLoadEventInfocorresponding to the event. The values ofLoadEventInfo.elapsedRealtimeMsandLoadEventInfo.bytesLoadedare relative to the correspondingMediaSourceEventListener.onLoadStarted(int, MediaPeriodId, LoadEventInfo, MediaLoadData)event.mediaLoadData- TheMediaLoadDatadefining the data being loaded.
-
onLoadCanceled
public final void onLoadCanceled(int windowIndex, @Nullable MediaSource.MediaPeriodId mediaPeriodId, LoadEventInfo loadEventInfo, MediaLoadData mediaLoadData)Deprecated.Description copied from interface:MediaSourceEventListenerCalled when a load is canceled.- Specified by:
onLoadCanceledin interfaceMediaSourceEventListener- Parameters:
windowIndex- The window index in the timeline of the media source this load belongs to.mediaPeriodId- TheMediaSource.MediaPeriodIdthis load belongs to. Null if the load does not belong to a specific media period.loadEventInfo- TheLoadEventInfocorresponding to the event. The values ofLoadEventInfo.elapsedRealtimeMsandLoadEventInfo.bytesLoadedare relative to the correspondingMediaSourceEventListener.onLoadStarted(int, MediaPeriodId, LoadEventInfo, MediaLoadData)event.mediaLoadData- TheMediaLoadDatadefining the data being loaded.
-
onLoadError
public final void onLoadError(int windowIndex, @Nullable MediaSource.MediaPeriodId mediaPeriodId, LoadEventInfo loadEventInfo, MediaLoadData mediaLoadData, IOException error, boolean wasCanceled)Deprecated.Description copied from interface:MediaSourceEventListenerCalled when a load error occurs.The error may or may not have resulted in the load being canceled, as indicated by the
wasCanceledparameter. If the load was canceled,MediaSourceEventListener.onLoadCanceled(int, com.google.android.exoplayer2.source.MediaSource.MediaPeriodId, com.google.android.exoplayer2.source.LoadEventInfo, com.google.android.exoplayer2.source.MediaLoadData)will not be called in addition to this method.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.- Specified by:
onLoadErrorin interfaceMediaSourceEventListener- Parameters:
windowIndex- The window index in the timeline of the media source this load belongs to.mediaPeriodId- TheMediaSource.MediaPeriodIdthis load belongs to. Null if the load does not belong to a specific media period.loadEventInfo- TheLoadEventInfocorresponding to the event. The values ofLoadEventInfo.elapsedRealtimeMsandLoadEventInfo.bytesLoadedare relative to the correspondingMediaSourceEventListener.onLoadStarted(int, MediaPeriodId, LoadEventInfo, MediaLoadData)event.mediaLoadData- TheMediaLoadDatadefining the data being loaded.error- The load error.wasCanceled- Whether the load was canceled as a result of the error.
-
onUpstreamDiscarded
public final void onUpstreamDiscarded(int windowIndex, @Nullable MediaSource.MediaPeriodId mediaPeriodId, MediaLoadData mediaLoadData)Deprecated.Description copied from interface:MediaSourceEventListenerCalled when data is removed from the back of a media buffer, typically so that it can be re-buffered in a different format.- Specified by:
onUpstreamDiscardedin interfaceMediaSourceEventListener- Parameters:
windowIndex- The window index in the timeline of the media source this load belongs to.mediaPeriodId- TheMediaSource.MediaPeriodIdthe media belongs to.mediaLoadData- TheMediaLoadDatadefining the media being discarded.
-
onDownstreamFormatChanged
public final void onDownstreamFormatChanged(int windowIndex, @Nullable MediaSource.MediaPeriodId mediaPeriodId, MediaLoadData mediaLoadData)Deprecated.Description copied from interface:MediaSourceEventListenerCalled when a downstream format change occurs (i.e. when the format of the media being read from one or moreSampleStreams provided by the source changes).- Specified by:
onDownstreamFormatChangedin interfaceMediaSourceEventListener- Parameters:
windowIndex- The window index in the timeline of the media source this load belongs to.mediaPeriodId- TheMediaSource.MediaPeriodIdthe media belongs to.mediaLoadData- TheMediaLoadDatadefining the newly selected downstream data.
-
onTimelineChanged
public final void onTimelineChanged(Timeline timeline, @TimelineChangeReason @com.google.android.exoplayer2.Player.TimelineChangeReason int reason)
Deprecated.Description copied from interface:Player.ListenerCalled when the value ofPlayer.getCurrentTimeline()changes.Note that the current
MediaItemor playback position may change as a result of a timeline change. If playback can't continue smoothly because of this timeline change, a separatePlayer.Listener.onPositionDiscontinuity(PositionInfo, PositionInfo, int)callback will be triggered.Player.Listener.onEvents(Player, Events)will also be called to report this event along with other events that happen in the sameLoopermessage queue iteration.- Specified by:
onTimelineChangedin interfacePlayer.Listener- Parameters:
timeline- The latest timeline. Never null, but may be empty.reason- ThePlayer.TimelineChangeReasonresponsible for this timeline change.
-
onMediaItemTransition
public final void onMediaItemTransition(@Nullable MediaItem mediaItem, @MediaItemTransitionReason @com.google.android.exoplayer2.Player.MediaItemTransitionReason int reason)Deprecated.Description copied from interface:Player.ListenerCalled when playback transitions to a media item or starts repeating a media item according to the currentrepeat mode.Note that this callback is also called when the value of
Player.getCurrentTimeline()becomes non-empty or empty.Player.Listener.onEvents(Player, Events)will also be called to report this event along with other events that happen in the sameLoopermessage queue iteration.- Specified by:
onMediaItemTransitionin interfacePlayer.Listener- Parameters:
mediaItem- TheMediaItem. May be null if the playlist becomes empty.reason- The reason for the transition.
-
onTracksChanged
public void onTracksChanged(Tracks tracks)
Deprecated.Description copied from interface:Player.ListenerCalled when the value ofPlayer.getCurrentTracks()changes.Player.Listener.onEvents(Player, Events)will also be called to report this event along with other events that happen in the sameLoopermessage queue iteration.- Specified by:
onTracksChangedin interfacePlayer.Listener- Parameters:
tracks- The available tracks information. Never null, but may be of length zero.
-
onLoadingChanged
public void onLoadingChanged(boolean isLoading)
Deprecated.- Specified by:
onLoadingChangedin interfacePlayer.Listener
-
onIsLoadingChanged
public final void onIsLoadingChanged(boolean isLoading)
Deprecated.Description copied from interface:Player.ListenerCalled when the player starts or stops loading the source.Player.Listener.onEvents(Player, Events)will also be called to report this event along with other events that happen in the sameLoopermessage queue iteration.- Specified by:
onIsLoadingChangedin interfacePlayer.Listener- Parameters:
isLoading- Whether the source is currently being loaded.
-
onAvailableCommandsChanged
public void onAvailableCommandsChanged(Player.Commands availableCommands)
Deprecated.Description copied from interface:Player.ListenerCalled when the value returned fromPlayer.isCommandAvailable(int)changes for at least onePlayer.Command.Player.Listener.onEvents(Player, Events)will also be called to report this event along with other events that happen in the sameLoopermessage queue iteration.- Specified by:
onAvailableCommandsChangedin interfacePlayer.Listener- Parameters:
availableCommands- The availablePlayer.Commands.
-
onPlayerStateChanged
public final void onPlayerStateChanged(boolean playWhenReady, @State @com.google.android.exoplayer2.Player.State int playbackState)Deprecated.- Specified by:
onPlayerStateChangedin interfacePlayer.Listener
-
onPlaybackStateChanged
public final void onPlaybackStateChanged(@State @com.google.android.exoplayer2.Player.State int playbackState)
Deprecated.Description copied from interface:Player.ListenerCalled when the value returned fromPlayer.getPlaybackState()changes.Player.Listener.onEvents(Player, Events)will also be called to report this event along with other events that happen in the sameLoopermessage queue iteration.- Specified by:
onPlaybackStateChangedin interfacePlayer.Listener- Parameters:
playbackState- The new playbackPlayer.State.
-
onPlayWhenReadyChanged
public final void onPlayWhenReadyChanged(boolean playWhenReady, @PlayWhenReadyChangeReason @com.google.android.exoplayer2.Player.PlayWhenReadyChangeReason int reason)Deprecated.Description copied from interface:Player.ListenerCalled when the value returned fromPlayer.getPlayWhenReady()changes.Player.Listener.onEvents(Player, Events)will also be called to report this event along with other events that happen in the sameLoopermessage queue iteration.- Specified by:
onPlayWhenReadyChangedin interfacePlayer.Listener- Parameters:
playWhenReady- Whether playback will proceed when ready.reason- ThePlayer.PlayWhenReadyChangeReasonfor the change.
-
onPlaybackSuppressionReasonChanged
public final void onPlaybackSuppressionReasonChanged(@PlaybackSuppressionReason @com.google.android.exoplayer2.Player.PlaybackSuppressionReason int playbackSuppressionReason)
Deprecated.Description copied from interface:Player.ListenerCalled when the value returned fromPlayer.getPlaybackSuppressionReason()changes.Player.Listener.onEvents(Player, Events)will also be called to report this event along with other events that happen in the sameLoopermessage queue iteration.- Specified by:
onPlaybackSuppressionReasonChangedin interfacePlayer.Listener- Parameters:
playbackSuppressionReason- The currentPlayer.PlaybackSuppressionReason.
-
onIsPlayingChanged
public void onIsPlayingChanged(boolean isPlaying)
Deprecated.Description copied from interface:Player.ListenerCalled when the value ofPlayer.isPlaying()changes.Player.Listener.onEvents(Player, Events)will also be called to report this event along with other events that happen in the sameLoopermessage queue iteration.- Specified by:
onIsPlayingChangedin interfacePlayer.Listener- Parameters:
isPlaying- Whether the player is playing.
-
onRepeatModeChanged
public final void onRepeatModeChanged(@RepeatMode @com.google.android.exoplayer2.Player.RepeatMode int repeatMode)
Deprecated.Description copied from interface:Player.ListenerCalled when the value ofPlayer.getRepeatMode()changes.Player.Listener.onEvents(Player, Events)will also be called to report this event along with other events that happen in the sameLoopermessage queue iteration.- Specified by:
onRepeatModeChangedin interfacePlayer.Listener- Parameters:
repeatMode- ThePlayer.RepeatModeused for playback.
-
onShuffleModeEnabledChanged
public final void onShuffleModeEnabledChanged(boolean shuffleModeEnabled)
Deprecated.Description copied from interface:Player.ListenerCalled when the value ofPlayer.getShuffleModeEnabled()changes.Player.Listener.onEvents(Player, Events)will also be called to report this event along with other events that happen in the sameLoopermessage queue iteration.- Specified by:
onShuffleModeEnabledChangedin interfacePlayer.Listener- Parameters:
shuffleModeEnabled- Whether shuffling of media items is enabled.
-
onPlayerError
public final void onPlayerError(PlaybackException error)
Deprecated.Description copied from interface:Player.ListenerCalled when an error occurs. The playback state will transition toPlayer.STATE_IDLEimmediately after this method is called. The player instance can still be used, andPlayer.release()must still be called on the player should it no longer be required.Player.Listener.onEvents(Player, Events)will also be called to report this event along with other events that happen in the sameLoopermessage queue iteration.Implementations of Player may pass an instance of a subclass of
PlaybackExceptionto this method in order to include more information about the error.- Specified by:
onPlayerErrorin interfacePlayer.Listener- Parameters:
error- The error.
-
onPlayerErrorChanged
public void onPlayerErrorChanged(@Nullable PlaybackException error)Deprecated.Description copied from interface:Player.ListenerCalled when thePlaybackExceptionreturned byPlayer.getPlayerError()changes.Player.Listener.onEvents(Player, Events)will also be called to report this event along with other events that happen in the sameLoopermessage queue iteration.Implementations of Player may pass an instance of a subclass of
PlaybackExceptionto this method in order to include more information about the error.- Specified by:
onPlayerErrorChangedin interfacePlayer.Listener- Parameters:
error- The new error, or null if the error is being cleared.
-
onPositionDiscontinuity
public void onPositionDiscontinuity(@DiscontinuityReason @com.google.android.exoplayer2.Player.DiscontinuityReason int reason)
Deprecated.- Specified by:
onPositionDiscontinuityin interfacePlayer.Listener
-
onPositionDiscontinuity
public final void onPositionDiscontinuity(Player.PositionInfo oldPosition, Player.PositionInfo newPosition, @DiscontinuityReason @com.google.android.exoplayer2.Player.DiscontinuityReason int reason)
Deprecated.Description copied from interface:Player.ListenerCalled when a position discontinuity occurs.A position discontinuity occurs when the playing period changes, the playback position jumps within the period currently being played, or when the playing period has been skipped or removed.
Player.Listener.onEvents(Player, Events)will also be called to report this event along with other events that happen in the sameLoopermessage queue iteration.- Specified by:
onPositionDiscontinuityin interfacePlayer.Listener- Parameters:
oldPosition- The position before the discontinuity.newPosition- The position after the discontinuity.reason- ThePlayer.DiscontinuityReasonresponsible for the discontinuity.
-
onPlaybackParametersChanged
public final void onPlaybackParametersChanged(PlaybackParameters playbackParameters)
Deprecated.Description copied from interface:Player.ListenerCalled when the value ofPlayer.getPlaybackParameters()changes. The playback parameters may change due to a call toPlayer.setPlaybackParameters(PlaybackParameters), or the player itself may change them (for example, if audio playback switches to passthrough or offload mode, where speed adjustment is no longer possible).Player.Listener.onEvents(Player, Events)will also be called to report this event along with other events that happen in the sameLoopermessage queue iteration.- Specified by:
onPlaybackParametersChangedin interfacePlayer.Listener- Parameters:
playbackParameters- The playback parameters.
-
onSeekBackIncrementChanged
public void onSeekBackIncrementChanged(long seekBackIncrementMs)
Deprecated.Description copied from interface:Player.ListenerCalled when the value ofPlayer.getSeekBackIncrement()changes.Player.Listener.onEvents(Player, Events)will also be called to report this event along with other events that happen in the sameLoopermessage queue iteration.- Specified by:
onSeekBackIncrementChangedin interfacePlayer.Listener- Parameters:
seekBackIncrementMs- ThePlayer.seekBack()increment, in milliseconds.
-
onSeekForwardIncrementChanged
public void onSeekForwardIncrementChanged(long seekForwardIncrementMs)
Deprecated.Description copied from interface:Player.ListenerCalled when the value ofPlayer.getSeekForwardIncrement()changes.Player.Listener.onEvents(Player, Events)will also be called to report this event along with other events that happen in the sameLoopermessage queue iteration.- Specified by:
onSeekForwardIncrementChangedin interfacePlayer.Listener- Parameters:
seekForwardIncrementMs- ThePlayer.seekForward()increment, in milliseconds.
-
onMaxSeekToPreviousPositionChanged
public void onMaxSeekToPreviousPositionChanged(long maxSeekToPreviousPositionMs)
Deprecated.Description copied from interface:Player.ListenerCalled when the value ofPlayer.getMaxSeekToPreviousPosition()changes.Player.Listener.onEvents(Player, Events)will also be called to report this event along with other events that happen in the sameLoopermessage queue iteration.- Specified by:
onMaxSeekToPreviousPositionChangedin interfacePlayer.Listener- Parameters:
maxSeekToPreviousPositionMs- The maximum position for whichPlayer.seekToPrevious()seeks to the previous position, in milliseconds.
-
onMediaMetadataChanged
public void onMediaMetadataChanged(MediaMetadata mediaMetadata)
Deprecated.Description copied from interface:Player.ListenerCalled when the value ofPlayer.getMediaMetadata()changes.This method may be called multiple times in quick succession.
Player.Listener.onEvents(Player, Events)will also be called to report this event along with other events that happen in the sameLoopermessage queue iteration.- Specified by:
onMediaMetadataChangedin interfacePlayer.Listener- Parameters:
mediaMetadata- The combinedMediaMetadata.
-
onPlaylistMetadataChanged
public void onPlaylistMetadataChanged(MediaMetadata playlistMetadata)
Deprecated.Description copied from interface:Player.ListenerCalled when the value ofPlayer.getPlaylistMetadata()changes.Player.Listener.onEvents(Player, Events)will also be called to report this event along with other events that happen in the sameLoopermessage queue iteration.- Specified by:
onPlaylistMetadataChangedin interfacePlayer.Listener
-
onMetadata
public final void onMetadata(Metadata metadata)
Deprecated.Description copied from interface:Player.ListenerCalled when there is metadata associated with the current playback time.Player.Listener.onEvents(Player, Events)will also be called to report this event along with other events that happen in the sameLoopermessage queue iteration.- Specified by:
onMetadatain interfacePlayer.Listener- Parameters:
metadata- The metadata.
-
onCues
public void onCues(List<Cue> cues)
Deprecated.Description copied from interface:Player.ListenerCalled when the value ofPlayer.getCurrentCues()changes.Both this method and
Player.Listener.onCues(CueGroup)are called when there is a change in the cues. You should only implement one or the other.Player.Listener.onEvents(Player, Events)will also be called to report this event along with other events that happen in the sameLoopermessage queue iteration.- Specified by:
onCuesin interfacePlayer.Listener
-
onCues
public void onCues(CueGroup cueGroup)
Deprecated.Description copied from interface:Player.ListenerCalled when the value ofPlayer.getCurrentCues()changes.Both this method and
Player.Listener.onCues(List)are called when there is a change in the cues. You should only implement one or the other.Player.Listener.onEvents(Player, Events)will also be called to report this event along with other events that happen in the sameLoopermessage queue iteration.- Specified by:
onCuesin interfacePlayer.Listener
-
onSkipSilenceEnabledChanged
public final void onSkipSilenceEnabledChanged(boolean skipSilenceEnabled)
Deprecated.Description copied from interface:Player.ListenerCalled when skipping silences is enabled or disabled in the audio stream.Player.Listener.onEvents(Player, Events)will also be called to report this event along with other events that happen in the sameLoopermessage queue iteration.- Specified by:
onSkipSilenceEnabledChangedin interfacePlayer.Listener- Parameters:
skipSilenceEnabled- Whether skipping silences in the audio stream is enabled.
-
onAudioSessionIdChanged
public final void onAudioSessionIdChanged(int audioSessionId)
Deprecated.Description copied from interface:Player.ListenerCalled when the audio session ID changes.Player.Listener.onEvents(Player, Events)will also be called to report this event along with other events that happen in the sameLoopermessage queue iteration.- Specified by:
onAudioSessionIdChangedin interfacePlayer.Listener- Parameters:
audioSessionId- The audio session ID.
-
onAudioAttributesChanged
public final void onAudioAttributesChanged(AudioAttributes audioAttributes)
Deprecated.Description copied from interface:Player.ListenerCalled when the value ofPlayer.getAudioAttributes()changes.Player.Listener.onEvents(Player, Events)will also be called to report this event along with other events that happen in the sameLoopermessage queue iteration.- Specified by:
onAudioAttributesChangedin interfacePlayer.Listener- Parameters:
audioAttributes- The audio attributes.
-
onVideoSizeChanged
public final void onVideoSizeChanged(VideoSize videoSize)
Deprecated.Description copied from interface:Player.ListenerCalled each time whenPlayer.getVideoSize()changes.Player.Listener.onEvents(Player, Events)will also be called to report this event along with other events that happen in the sameLoopermessage queue iteration.- Specified by:
onVideoSizeChangedin interfacePlayer.Listener- Parameters:
videoSize- The new size of the video.
-
onTrackSelectionParametersChanged
public void onTrackSelectionParametersChanged(TrackSelectionParameters parameters)
Deprecated.Description copied from interface:Player.ListenerCalled when the value returned fromPlayer.getTrackSelectionParameters()changes.Player.Listener.onEvents(Player, Events)will also be called to report this event along with other events that happen in the sameLoopermessage queue iteration.- Specified by:
onTrackSelectionParametersChangedin interfacePlayer.Listener- Parameters:
parameters- The newTrackSelectionParameters.
-
onDeviceInfoChanged
public void onDeviceInfoChanged(DeviceInfo deviceInfo)
Deprecated.Description copied from interface:Player.ListenerCalled when the device information changesPlayer.Listener.onEvents(Player, Events)will also be called to report this event along with other events that happen in the sameLoopermessage queue iteration.- Specified by:
onDeviceInfoChangedin interfacePlayer.Listener- Parameters:
deviceInfo- The newDeviceInfo.
-
onDeviceVolumeChanged
public void onDeviceVolumeChanged(int volume, boolean muted)Deprecated.Description copied from interface:Player.ListenerCalled when the value ofPlayer.getDeviceVolume()orPlayer.isDeviceMuted()changes.Player.Listener.onEvents(Player, Events)will also be called to report this event along with other events that happen in the sameLoopermessage queue iteration.- Specified by:
onDeviceVolumeChangedin interfacePlayer.Listener- Parameters:
volume- The new device volume, with 0 being silence and 1 being unity gain.muted- Whether the device is muted.
-
onRenderedFirstFrame
public void onRenderedFirstFrame()
Deprecated.Description copied from interface:Player.ListenerCalled 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.Player.Listener.onEvents(Player, Events)will also be called to report this event along with other events that happen in the sameLoopermessage queue iteration.- Specified by:
onRenderedFirstFramein interfacePlayer.Listener
-
onEvents
public void onEvents(Player player, Player.Events events)
Deprecated.Description copied from interface:Player.ListenerCalled when one or more player states changed.State changes and events that happen within one
Loopermessage 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
Player.Listener.onPlaybackStateChanged(int)andPlayer.Listener.onPlayWhenReadyChanged(boolean, int)). - They need access to the
Playerobject to trigger further events (e.g. to callPlayer.seekTo(long)after aPlayer.Listener.onMediaItemTransition(MediaItem, int)). - They intend to use multiple state values together or in combination with
Playergetter methods. For example usingPlayer.getCurrentMediaItemIndex()with thetimelineprovided inPlayer.Listener.onTimelineChanged(Timeline, int)is only safe from within this method. - They are interested in events that logically happened together (e.g
Player.Listener.onPlaybackStateChanged(int)toPlayer.STATE_BUFFERINGbecause ofPlayer.Listener.onMediaItemTransition(MediaItem, int)).
- Specified by:
onEventsin interfacePlayer.Listener- Parameters:
player- ThePlayerwhose state changed. Use the getters to obtain the latest states.events- ThePlayer.Eventsthat happened in this iteration, indicating which player states changed.
- They intend to trigger the same logic for multiple events (e.g. when updating a UI for
both
-
onBandwidthSample
public final void onBandwidthSample(int elapsedMs, long bytesTransferred, long bitrateEstimate)Deprecated.Description copied from interface:BandwidthMeter.EventListenerCalled periodically to indicate that bytes have been transferred or the estimated bitrate has changed.Note: The estimated bitrate is typically derived from more information than just
bytesTransferredandelapsedMs.- Specified by:
onBandwidthSamplein interfaceBandwidthMeter.EventListener- Parameters:
elapsedMs- The time taken to transferbytesTransferred, in milliseconds. This is at most the elapsed time since the last callback, but may be less if there were periods during which data was not being transferred.bytesTransferred- The number of bytes transferred since the last callback.bitrateEstimate- The estimated bitrate in bits/sec.
-
onDrmSessionAcquired
public final void onDrmSessionAcquired(int windowIndex, @Nullable MediaSource.MediaPeriodId mediaPeriodId, @State @com.google.android.exoplayer2.drm.DrmSession.State int state)Deprecated.Description copied from interface:DrmSessionEventListenerCalled each time a drm session is acquired.- Specified by:
onDrmSessionAcquiredin interfaceDrmSessionEventListener- Parameters:
windowIndex- The window index in the timeline this media period belongs to.mediaPeriodId- TheMediaSource.MediaPeriodIdassociated with the drm session.state- TheDrmSession.Stateof the session when the acquisition completed.
-
onDrmKeysLoaded
public final void onDrmKeysLoaded(int windowIndex, @Nullable MediaSource.MediaPeriodId mediaPeriodId)Deprecated.Description copied from interface:DrmSessionEventListenerCalled each time keys are loaded.- Specified by:
onDrmKeysLoadedin interfaceDrmSessionEventListener- Parameters:
windowIndex- The window index in the timeline this media period belongs to.mediaPeriodId- TheMediaSource.MediaPeriodIdassociated with the drm session.
-
onDrmSessionManagerError
public final void onDrmSessionManagerError(int windowIndex, @Nullable MediaSource.MediaPeriodId mediaPeriodId, Exception error)Deprecated.Description copied from interface:DrmSessionEventListenerCalled 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 and continue. 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.- Specified by:
onDrmSessionManagerErrorin interfaceDrmSessionEventListener- Parameters:
windowIndex- The window index in the timeline this media period belongs to.mediaPeriodId- TheMediaSource.MediaPeriodIdassociated with the drm session.error- The corresponding exception.
-
onDrmKeysRestored
public final void onDrmKeysRestored(int windowIndex, @Nullable MediaSource.MediaPeriodId mediaPeriodId)Deprecated.Description copied from interface:DrmSessionEventListenerCalled each time offline keys are restored.- Specified by:
onDrmKeysRestoredin interfaceDrmSessionEventListener- Parameters:
windowIndex- The window index in the timeline this media period belongs to.mediaPeriodId- TheMediaSource.MediaPeriodIdassociated with the drm session.
-
onDrmKeysRemoved
public final void onDrmKeysRemoved(int windowIndex, @Nullable MediaSource.MediaPeriodId mediaPeriodId)Deprecated.Description copied from interface:DrmSessionEventListenerCalled each time offline keys are removed.- Specified by:
onDrmKeysRemovedin interfaceDrmSessionEventListener- Parameters:
windowIndex- The window index in the timeline this media period belongs to.mediaPeriodId- TheMediaSource.MediaPeriodIdassociated with the drm session.
-
onDrmSessionReleased
public final void onDrmSessionReleased(int windowIndex, @Nullable MediaSource.MediaPeriodId mediaPeriodId)Deprecated.Description copied from interface:DrmSessionEventListenerCalled each time a drm session is released.- Specified by:
onDrmSessionReleasedin interfaceDrmSessionEventListener- Parameters:
windowIndex- The window index in the timeline this media period belongs to.mediaPeriodId- TheMediaSource.MediaPeriodIdassociated with the drm session.
-
sendEvent
protected final void sendEvent(AnalyticsListener.EventTime eventTime, int eventFlag, ListenerSet.Event<AnalyticsListener> eventInvocation)
Deprecated.Sends an event to registered listeners.- Parameters:
eventTime- TheAnalyticsListener.EventTimeto report.eventFlag- An integer flag indicating the type of the event, orC.INDEX_UNSETto report this event without flag.eventInvocation- The event.
-
generateCurrentPlayerMediaPeriodEventTime
protected final AnalyticsListener.EventTime generateCurrentPlayerMediaPeriodEventTime()
Deprecated.Generates anAnalyticsListener.EventTimefor the currently playing item in the player.
-
generateEventTime
@RequiresNonNull("player") protected final AnalyticsListener.EventTime generateEventTime(Timeline timeline, int windowIndex, @Nullable MediaSource.MediaPeriodId mediaPeriodId)Deprecated.Returns a newAnalyticsListener.EventTimefor the specified timeline, window and media period id.
-
-