public interface MediaSourceEventListener
MediaSource events.| Modifier and Type | Interface and Description |
|---|---|
static class |
MediaSourceEventListener.EventDispatcher
Dispatches events to
MediaSourceEventListeners. |
static class |
MediaSourceEventListener.LoadEventInfo
Media source load event information.
|
static class |
MediaSourceEventListener.MediaLoadData
Descriptor for data being loaded or selected by a media source.
|
| 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.
|
void onMediaPeriodCreated(int windowIndex,
MediaSource.MediaPeriodId mediaPeriodId)
windowIndex - The window index in the timeline this media period belongs to.mediaPeriodId - The MediaSource.MediaPeriodId of the created media period.void onMediaPeriodReleased(int windowIndex,
MediaSource.MediaPeriodId mediaPeriodId)
windowIndex - The window index in the timeline this media period belongs to.mediaPeriodId - The MediaSource.MediaPeriodId of the released media period.void onLoadStarted(int windowIndex,
@Nullable
MediaSource.MediaPeriodId mediaPeriodId,
MediaSourceEventListener.LoadEventInfo loadEventInfo,
MediaSourceEventListener.MediaLoadData mediaLoadData)
windowIndex - 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 defining the load event.mediaLoadData - The MediaSourceEventListener.MediaLoadData defining the data being loaded.void onLoadCompleted(int windowIndex,
@Nullable
MediaSource.MediaPeriodId mediaPeriodId,
MediaSourceEventListener.LoadEventInfo loadEventInfo,
MediaSourceEventListener.MediaLoadData mediaLoadData)
windowIndex - 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 defining the load event.mediaLoadData - The MediaSourceEventListener.MediaLoadData defining the data being loaded.void onLoadCanceled(int windowIndex,
@Nullable
MediaSource.MediaPeriodId mediaPeriodId,
MediaSourceEventListener.LoadEventInfo loadEventInfo,
MediaSourceEventListener.MediaLoadData mediaLoadData)
windowIndex - 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 defining the load event.mediaLoadData - The MediaSourceEventListener.MediaLoadData defining the data being loaded.void onLoadError(int windowIndex,
@Nullable
MediaSource.MediaPeriodId mediaPeriodId,
MediaSourceEventListener.LoadEventInfo loadEventInfo,
MediaSourceEventListener.MediaLoadData mediaLoadData,
java.io.IOException error,
boolean wasCanceled)
The error may or may not have resulted in the load being canceled, as indicated by the
wasCanceled parameter. If the load was canceled, 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.
windowIndex - 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 defining the load 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.void onReadingStarted(int windowIndex,
MediaSource.MediaPeriodId mediaPeriodId)
windowIndex - The window index in the timeline this media period belongs to.mediaPeriodId - The MediaSource.MediaPeriodId of the media period being read from.void onUpstreamDiscarded(int windowIndex,
MediaSource.MediaPeriodId mediaPeriodId,
MediaSourceEventListener.MediaLoadData mediaLoadData)
windowIndex - 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.void onDownstreamFormatChanged(int windowIndex,
@Nullable
MediaSource.MediaPeriodId mediaPeriodId,
MediaSourceEventListener.MediaLoadData mediaLoadData)
SampleStreams provided by the source changes).windowIndex - 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.