public abstract class DefaultMediaSourceEventListener extends java.lang.Object implements MediaSourceEventListener
MediaSourceEventListener allowing selective overrides. All methods are implemented as
no-ops.MediaSourceEventListener.EventDispatcher, MediaSourceEventListener.LoadEventInfo, MediaSourceEventListener.MediaLoadData| Constructor and Description |
|---|
DefaultMediaSourceEventListener() |
| Modifier and Type | Method and Description |
|---|---|
void |
onDownstreamFormatChanged(int windowIndex,
MediaSource.MediaPeriodId mediaPeriodId,
MediaSourceEventListener.MediaLoadData mediaLoadData)
Called when a downstream format change occurs (i.e.
|
void |
onLoadCanceled(int windowIndex,
MediaSource.MediaPeriodId mediaPeriodId,
MediaSourceEventListener.LoadEventInfo loadEventInfo,
MediaSourceEventListener.MediaLoadData mediaLoadData)
Called when a load is canceled.
|
void |
onLoadCompleted(int windowIndex,
MediaSource.MediaPeriodId mediaPeriodId,
MediaSourceEventListener.LoadEventInfo loadEventInfo,
MediaSourceEventListener.MediaLoadData mediaLoadData)
Called when a load ends.
|
void |
onLoadError(int windowIndex,
MediaSource.MediaPeriodId mediaPeriodId,
MediaSourceEventListener.LoadEventInfo loadEventInfo,
MediaSourceEventListener.MediaLoadData mediaLoadData,
java.io.IOException error,
boolean wasCanceled)
Called when a load error occurs.
|
void |
onLoadStarted(int windowIndex,
MediaSource.MediaPeriodId mediaPeriodId,
MediaSourceEventListener.LoadEventInfo loadEventInfo,
MediaSourceEventListener.MediaLoadData mediaLoadData)
Called when a load begins.
|
void |
onMediaPeriodCreated(int windowIndex,
MediaSource.MediaPeriodId mediaPeriodId)
Called when a media period is created by the media source.
|
void |
onMediaPeriodReleased(int windowIndex,
MediaSource.MediaPeriodId mediaPeriodId)
Called when a media period is released by the media source.
|
void |
onReadingStarted(int windowIndex,
MediaSource.MediaPeriodId mediaPeriodId)
Called when a media period is first being read from.
|
void |
onUpstreamDiscarded(int windowIndex,
MediaSource.MediaPeriodId mediaPeriodId,
MediaSourceEventListener.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.
|
public void onMediaPeriodCreated(int windowIndex,
MediaSource.MediaPeriodId mediaPeriodId)
MediaSourceEventListeneronMediaPeriodCreated in interface MediaSourceEventListenerwindowIndex - The window index in the timeline this media period belongs to.mediaPeriodId - The MediaSource.MediaPeriodId of the created media period.public void onMediaPeriodReleased(int windowIndex,
MediaSource.MediaPeriodId mediaPeriodId)
MediaSourceEventListeneronMediaPeriodReleased in interface MediaSourceEventListenerwindowIndex - The window index in the timeline this media period belongs to.mediaPeriodId - The MediaSource.MediaPeriodId of the released media period.public void onLoadStarted(int windowIndex,
@Nullable
MediaSource.MediaPeriodId mediaPeriodId,
MediaSourceEventListener.LoadEventInfo loadEventInfo,
MediaSourceEventListener.MediaLoadData mediaLoadData)
MediaSourceEventListeneronLoadStarted in interface MediaSourceEventListenerwindowIndex - The window index in the timeline of the media source this load belongs to.mediaPeriodId - The MediaSource.MediaPeriodId this load belongs to. Null if the load does not
belong to a specific media period.loadEventInfo - The MediaSourceEventListener.LoadEventInfo corresponding to the event. The value of MediaSourceEventListener.LoadEventInfo.uri won't reflect potential redirection yet and MediaSourceEventListener.LoadEventInfo.responseHeaders will be empty.mediaLoadData - The MediaSourceEventListener.MediaLoadData defining the data being loaded.public void onLoadCompleted(int windowIndex,
@Nullable
MediaSource.MediaPeriodId mediaPeriodId,
MediaSourceEventListener.LoadEventInfo loadEventInfo,
MediaSourceEventListener.MediaLoadData mediaLoadData)
MediaSourceEventListeneronLoadCompleted in interface MediaSourceEventListenerwindowIndex - The window index in the timeline of the media source this load belongs to.mediaPeriodId - The MediaSource.MediaPeriodId this load belongs to. Null if the load does not
belong to a specific media period.loadEventInfo - The MediaSourceEventListener.LoadEventInfo corresponding to the event. The values of MediaSourceEventListener.LoadEventInfo.elapsedRealtimeMs and MediaSourceEventListener.LoadEventInfo.bytesLoaded are relative to the
corresponding #onLoadStarted(int, MediaPeriodId, LoadEventInfo, MediaLoadData)
event.mediaLoadData - The MediaSourceEventListener.MediaLoadData defining the data being loaded.public void onLoadCanceled(int windowIndex,
@Nullable
MediaSource.MediaPeriodId mediaPeriodId,
MediaSourceEventListener.LoadEventInfo loadEventInfo,
MediaSourceEventListener.MediaLoadData mediaLoadData)
MediaSourceEventListeneronLoadCanceled in interface MediaSourceEventListenerwindowIndex - The window index in the timeline of the media source this load belongs to.mediaPeriodId - The MediaSource.MediaPeriodId this load belongs to. Null if the load does not
belong to a specific media period.loadEventInfo - The MediaSourceEventListener.LoadEventInfo corresponding to the event. The values of MediaSourceEventListener.LoadEventInfo.elapsedRealtimeMs and MediaSourceEventListener.LoadEventInfo.bytesLoaded are relative to the
corresponding #onLoadStarted(int, MediaPeriodId, LoadEventInfo, MediaLoadData)
event.mediaLoadData - The MediaSourceEventListener.MediaLoadData defining the data being loaded.public void onLoadError(int windowIndex,
@Nullable
MediaSource.MediaPeriodId mediaPeriodId,
MediaSourceEventListener.LoadEventInfo loadEventInfo,
MediaSourceEventListener.MediaLoadData mediaLoadData,
java.io.IOException error,
boolean wasCanceled)
MediaSourceEventListenerThe error may or may not have resulted in the load being canceled, as indicated by the
wasCanceled parameter. If the load was canceled, MediaSourceEventListener.onLoadCanceled(int, com.google.android.exoplayer2.source.MediaSource.MediaPeriodId, com.google.android.exoplayer2.source.MediaSourceEventListener.LoadEventInfo, com.google.android.exoplayer2.source.MediaSourceEventListener.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 and continue. Hence applications should
not implement this method to display a user visible error or initiate an application
level retry (Player.EventListener#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.
onLoadError in interface MediaSourceEventListenerwindowIndex - The window index in the timeline of the media source this load belongs to.mediaPeriodId - The MediaSource.MediaPeriodId this load belongs to. Null if the load does not
belong to a specific media period.loadEventInfo - The MediaSourceEventListener.LoadEventInfo corresponding to the event. The values of MediaSourceEventListener.LoadEventInfo.elapsedRealtimeMs and MediaSourceEventListener.LoadEventInfo.bytesLoaded are relative to the
corresponding #onLoadStarted(int, MediaPeriodId, LoadEventInfo, MediaLoadData)
event.mediaLoadData - The MediaSourceEventListener.MediaLoadData defining the data being loaded.error - The load error.wasCanceled - Whether the load was canceled as a result of the error.public void onReadingStarted(int windowIndex,
MediaSource.MediaPeriodId mediaPeriodId)
MediaSourceEventListeneronReadingStarted in interface MediaSourceEventListenerwindowIndex - The window index in the timeline this media period belongs to.mediaPeriodId - The MediaSource.MediaPeriodId of the media period being read from.public void onUpstreamDiscarded(int windowIndex,
@Nullable
MediaSource.MediaPeriodId mediaPeriodId,
MediaSourceEventListener.MediaLoadData mediaLoadData)
MediaSourceEventListeneronUpstreamDiscarded in interface MediaSourceEventListenerwindowIndex - The window index in the timeline of the media source this load belongs to.mediaPeriodId - The MediaSource.MediaPeriodId the media belongs to.mediaLoadData - The MediaSourceEventListener.MediaLoadData defining the media being discarded.public void onDownstreamFormatChanged(int windowIndex,
@Nullable
MediaSource.MediaPeriodId mediaPeriodId,
MediaSourceEventListener.MediaLoadData mediaLoadData)
MediaSourceEventListenerSampleStreams provided by the source changes).onDownstreamFormatChanged in interface MediaSourceEventListenerwindowIndex - The window index in the timeline of the media source this load belongs to.mediaPeriodId - The MediaSource.MediaPeriodId the media belongs to.mediaLoadData - The MediaSourceEventListener.MediaLoadData defining the newly selected downstream data.