MediaSourceEventListener
@UnstableApi
public interface MediaSourceEventListener
AnalyticsCollector |
Interface for data collectors that forward analytics events to |
MediaSourceTestRunner.MediaSourceListener |
|
ServerSideAdInsertionMediaSource |
A |
DefaultAnalyticsCollector |
Data collector that forwards analytics events to |
Interface for callbacks to be notified of MediaSource events.
Summary
Nested types |
|---|
public class MediaSourceEventListener.EventDispatcherDispatches events to |
Public methods |
|
|---|---|
default void |
onDownstreamFormatChanged(Called when a downstream format change occurs (i.e. when the format of the media being read from one or more |
default void |
onLoadCanceled(Called when a load is canceled. |
default void |
onLoadCompleted(Called when a load ends. |
default void |
onLoadError(Called when a load error occurs. |
default void |
onLoadStarted(Called when a load begins. |
default void |
onUpstreamDiscarded(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 methods
onDownstreamFormatChanged
default void onDownstreamFormatChanged(
int windowIndex,
@Nullable MediaSource.MediaPeriodId mediaPeriodId,
MediaLoadData mediaLoadData
)
Called when a downstream format change occurs (i.e. when the format of the media being read from one or more SampleStreams provided by the source changes).
| Parameters | |
|---|---|
int windowIndex |
The window index in the timeline of the media source this load belongs to. |
@Nullable MediaSource.MediaPeriodId mediaPeriodId |
The |
MediaLoadData mediaLoadData |
The |
onLoadCanceled
default void onLoadCanceled(
int windowIndex,
@Nullable MediaSource.MediaPeriodId mediaPeriodId,
LoadEventInfo loadEventInfo,
MediaLoadData mediaLoadData
)
Called when a load is canceled.
| Parameters | |
|---|---|
int windowIndex |
The window index in the timeline of the media source this load belongs to. |
@Nullable MediaSource.MediaPeriodId mediaPeriodId |
The |
LoadEventInfo loadEventInfo |
The |
MediaLoadData mediaLoadData |
The |
onLoadCompleted
default void onLoadCompleted(
int windowIndex,
@Nullable MediaSource.MediaPeriodId mediaPeriodId,
LoadEventInfo loadEventInfo,
MediaLoadData mediaLoadData
)
Called when a load ends.
| Parameters | |
|---|---|
int windowIndex |
The window index in the timeline of the media source this load belongs to. |
@Nullable MediaSource.MediaPeriodId mediaPeriodId |
The |
LoadEventInfo loadEventInfo |
The |
MediaLoadData mediaLoadData |
The |
onLoadError
default void onLoadError(
int windowIndex,
@Nullable MediaSource.MediaPeriodId mediaPeriodId,
LoadEventInfo loadEventInfo,
MediaLoadData mediaLoadData,
IOException error,
boolean wasCanceled
)
Called when a load error occurs.
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 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. 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 | |
|---|---|
int windowIndex |
The window index in the timeline of the media source this load belongs to. |
@Nullable MediaSource.MediaPeriodId mediaPeriodId |
The |
LoadEventInfo loadEventInfo |
The |
MediaLoadData mediaLoadData |
The |
IOException error |
The load error. |
boolean wasCanceled |
Whether the load was canceled as a result of the error. |
onLoadStarted
default void onLoadStarted(
int windowIndex,
@Nullable MediaSource.MediaPeriodId mediaPeriodId,
LoadEventInfo loadEventInfo,
MediaLoadData mediaLoadData,
int retryCount
)
Called when a load begins.
| Parameters | |
|---|---|
int windowIndex |
The window index in the timeline of the media source this load belongs to. |
@Nullable MediaSource.MediaPeriodId mediaPeriodId |
The |
LoadEventInfo loadEventInfo |
The |
MediaLoadData mediaLoadData |
The |
int retryCount |
The number of failed attempts since this method was first called (this is zero for the first load attempt). |
onUpstreamDiscarded
default void onUpstreamDiscarded(
int windowIndex,
MediaSource.MediaPeriodId mediaPeriodId,
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 | |
|---|---|
int windowIndex |
The window index in the timeline of the media source this load belongs to. |
MediaSource.MediaPeriodId mediaPeriodId |
The |
MediaLoadData mediaLoadData |
The |