Back to Exoplayer

MediaSourceEventListener.EventDispatcher (ExoPlayer library)

docs/doc/reference/com/google/android/exoplayer2/source/MediaSourceEventListener.EventDispatcher.html

latest25.5 KB
Original Source

Package com.google.android.exoplayer2.source

Class MediaSourceEventListener.EventDispatcher


public static classMediaSourceEventListener.EventDispatcherextends[Object](https://developer.android.com/reference/java/lang/Object.html "class or interface in java.lang")

Dispatches events to MediaSourceEventListeners.

Field Summary

Fields | Modifier and Type | Field | Description | | --- | --- | --- | | MediaSource.MediaPeriodId | mediaPeriodId | The MediaSource.MediaPeriodId reported with the events. | | int | windowIndex | The timeline window index reported with the events. |

Constructor Summary

Constructors | Constructor | Description | | --- | --- | | EventDispatcher() | Creates an event dispatcher. |

Method Summary

All Methods Instance Methods Concrete Methods Deprecated Methods | Modifier and Type | Method | Description | | --- | --- | --- | | void | addEventListener​(Handler handler, MediaSourceEventListener eventListener) | Adds a listener to the event dispatcher. | | void | downstreamFormatChanged​(@com.google.android.exoplayer2.C.TrackType int trackType, Format trackFormat, @com.google.android.exoplayer2.C.SelectionReason int trackSelectionReason, Object trackSelectionData, long mediaTimeUs) | Dispatches MediaSourceEventListener.onDownstreamFormatChanged(int, MediaPeriodId, MediaLoadData). | | void | downstreamFormatChanged​(MediaLoadData mediaLoadData) | Dispatches MediaSourceEventListener.onDownstreamFormatChanged(int, MediaPeriodId, MediaLoadData). | | void | loadCanceled​(LoadEventInfo loadEventInfo, @com.google.android.exoplayer2.C.DataType int dataType) | Dispatches MediaSourceEventListener.onLoadCanceled(int, MediaPeriodId, LoadEventInfo, MediaLoadData). | | void | loadCanceled​(LoadEventInfo loadEventInfo, @com.google.android.exoplayer2.C.DataType int dataType, @com.google.android.exoplayer2.C.TrackType int trackType, Format trackFormat, @com.google.android.exoplayer2.C.SelectionReason int trackSelectionReason, Object trackSelectionData, long mediaStartTimeUs, long mediaEndTimeUs) | Dispatches MediaSourceEventListener.onLoadCanceled(int, MediaPeriodId, LoadEventInfo, MediaLoadData). | | void | loadCanceled​(LoadEventInfo loadEventInfo, MediaLoadData mediaLoadData) | Dispatches MediaSourceEventListener.onLoadCanceled(int, MediaPeriodId, LoadEventInfo, MediaLoadData). | | void | loadCompleted​(LoadEventInfo loadEventInfo, @com.google.android.exoplayer2.C.DataType int dataType) | Dispatches MediaSourceEventListener.onLoadCompleted(int, MediaPeriodId, LoadEventInfo, MediaLoadData). | | void | loadCompleted​(LoadEventInfo loadEventInfo, @com.google.android.exoplayer2.C.DataType int dataType, @com.google.android.exoplayer2.C.TrackType int trackType, Format trackFormat, @com.google.android.exoplayer2.C.SelectionReason int trackSelectionReason, Object trackSelectionData, long mediaStartTimeUs, long mediaEndTimeUs) | Dispatches MediaSourceEventListener.onLoadCompleted(int, MediaPeriodId, LoadEventInfo, MediaLoadData). | | void | loadCompleted​(LoadEventInfo loadEventInfo, MediaLoadData mediaLoadData) | Dispatches MediaSourceEventListener.onLoadCompleted(int, MediaPeriodId, LoadEventInfo, MediaLoadData). | | void | loadError​(LoadEventInfo loadEventInfo, @com.google.android.exoplayer2.C.DataType int dataType, @com.google.android.exoplayer2.C.TrackType int trackType, Format trackFormat, @com.google.android.exoplayer2.C.SelectionReason int trackSelectionReason, Object trackSelectionData, long mediaStartTimeUs, long mediaEndTimeUs, IOException error, boolean wasCanceled) | Dispatches MediaSourceEventListener.onLoadError(int, MediaPeriodId, LoadEventInfo, MediaLoadData, IOException, boolean). | | void | loadError​(LoadEventInfo loadEventInfo, @com.google.android.exoplayer2.C.DataType int dataType, IOException error, boolean wasCanceled) | Dispatches MediaSourceEventListener.onLoadError(int, MediaPeriodId, LoadEventInfo, MediaLoadData, IOException, boolean). | | void | loadError​(LoadEventInfo loadEventInfo, MediaLoadData mediaLoadData, IOException error, boolean wasCanceled) | Dispatches MediaSourceEventListener.onLoadError(int, MediaPeriodId, LoadEventInfo, MediaLoadData, IOException, boolean). | | void | loadStarted​(LoadEventInfo loadEventInfo, @com.google.android.exoplayer2.C.DataType int dataType) | Dispatches MediaSourceEventListener.onLoadStarted(int, MediaPeriodId, LoadEventInfo, MediaLoadData). | | void | loadStarted​(LoadEventInfo loadEventInfo, @com.google.android.exoplayer2.C.DataType int dataType, @com.google.android.exoplayer2.C.TrackType int trackType, Format trackFormat, @com.google.android.exoplayer2.C.SelectionReason int trackSelectionReason, Object trackSelectionData, long mediaStartTimeUs, long mediaEndTimeUs) | Dispatches MediaSourceEventListener.onLoadStarted(int, MediaPeriodId, LoadEventInfo, MediaLoadData). | | void | loadStarted​(LoadEventInfo loadEventInfo, MediaLoadData mediaLoadData) | Dispatches MediaSourceEventListener.onLoadStarted(int, MediaPeriodId, LoadEventInfo, MediaLoadData). | | void | removeEventListener​(MediaSourceEventListener eventListener) | Removes a listener from the event dispatcher. | | void | upstreamDiscarded​(int trackType, long mediaStartTimeUs, long mediaEndTimeUs) | Dispatches MediaSourceEventListener.onUpstreamDiscarded(int, MediaPeriodId, MediaLoadData). | | void | upstreamDiscarded​(MediaLoadData mediaLoadData) | Dispatches MediaSourceEventListener.onUpstreamDiscarded(int, MediaPeriodId, MediaLoadData). | | MediaSourceEventListener.EventDispatcher | withParameters​(int windowIndex, MediaSource.MediaPeriodId mediaPeriodId) | Creates a view of the event dispatcher with pre-configured window index, media period id, and media time offset. | | MediaSourceEventListener.EventDispatcher | withParameters​(int windowIndex, MediaSource.MediaPeriodId mediaPeriodId, long mediaTimeOffsetMs) | Deprecated. Use withParameters(int, MediaPeriodId) instead.

|

- 

Methods inherited from class java.lang.Object

clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

Field Detail

- 

windowIndex

public final int windowIndex

The timeline window index reported with the events.

- 

mediaPeriodId

@Nullable
public final[MediaSource.MediaPeriodId](MediaSource.MediaPeriodId.html "class in com.google.android.exoplayer2.source")mediaPeriodId

The MediaSource.MediaPeriodId reported with the events.

Constructor Detail

- 

EventDispatcher

public EventDispatcher()

Creates an event dispatcher.

Method Detail

- 

withParameters

@CheckResult
public[MediaSourceEventListener.EventDispatcher](MediaSourceEventListener.EventDispatcher.html "class in com.google.android.exoplayer2.source")withParameters​(int windowIndex,
                                                               @Nullable[MediaSource.MediaPeriodId](MediaSource.MediaPeriodId.html "class in com.google.android.exoplayer2.source")mediaPeriodId)

Creates a view of the event dispatcher with pre-configured window index, media period id, and media time offset. Parameters:windowIndex - The timeline window index to be reported with the events.mediaPeriodId - The MediaSource.MediaPeriodId to be reported with the events.Returns:A view of the event dispatcher with the pre-configured parameters.

- 

withParameters

[@Deprecated](https://developer.android.com/reference/java/lang/Deprecated.html "class or interface in java.lang")@CheckResult
public[MediaSourceEventListener.EventDispatcher](MediaSourceEventListener.EventDispatcher.html "class in com.google.android.exoplayer2.source")withParameters​(int windowIndex,
                                                               @Nullable[MediaSource.MediaPeriodId](MediaSource.MediaPeriodId.html "class in com.google.android.exoplayer2.source")mediaPeriodId,
                                                               long mediaTimeOffsetMs)

Deprecated. Use withParameters(int, MediaPeriodId) instead.

Note: The mediaTimeOffsetMs passed to this method is ignored and not added to media times in any way.

- 

addEventListener

public void addEventListener​([Handler](https://developer.android.com/reference/android/os/Handler.html "class or interface in android.os")handler,[MediaSourceEventListener](MediaSourceEventListener.html "interface in com.google.android.exoplayer2.source")eventListener)

Adds a listener to the event dispatcher. Parameters:handler - A handler on the which listener events will be posted.eventListener - The listener to be added.

- 

removeEventListener

public void removeEventListener​([MediaSourceEventListener](MediaSourceEventListener.html "interface in com.google.android.exoplayer2.source")eventListener)

Removes a listener from the event dispatcher. Parameters:eventListener - The listener to be removed.

- 

loadStarted

public void loadStarted​([LoadEventInfo](LoadEventInfo.html "class in com.google.android.exoplayer2.source")loadEventInfo,
                        @com.google.android.exoplayer2.C.DataType int dataType)

Dispatches MediaSourceEventListener.onLoadStarted(int, MediaPeriodId, LoadEventInfo, MediaLoadData).

- 

loadStarted

public void loadStarted​([LoadEventInfo](LoadEventInfo.html "class in com.google.android.exoplayer2.source")loadEventInfo,
                        @com.google.android.exoplayer2.C.DataType int dataType,
                        @com.google.android.exoplayer2.C.TrackType int trackType,
                        @Nullable[Format](../Format.html "class in com.google.android.exoplayer2")trackFormat,
                        @com.google.android.exoplayer2.C.SelectionReason int trackSelectionReason,
                        @Nullable[Object](https://developer.android.com/reference/java/lang/Object.html "class or interface in java.lang")trackSelectionData,
                        long mediaStartTimeUs,
                        long mediaEndTimeUs)

Dispatches MediaSourceEventListener.onLoadStarted(int, MediaPeriodId, LoadEventInfo, MediaLoadData).

- 

loadStarted

public void loadStarted​([LoadEventInfo](LoadEventInfo.html "class in com.google.android.exoplayer2.source")loadEventInfo,[MediaLoadData](MediaLoadData.html "class in com.google.android.exoplayer2.source")mediaLoadData)

Dispatches MediaSourceEventListener.onLoadStarted(int, MediaPeriodId, LoadEventInfo, MediaLoadData).

- 

loadCompleted

public void loadCompleted​([LoadEventInfo](LoadEventInfo.html "class in com.google.android.exoplayer2.source")loadEventInfo,
                          @com.google.android.exoplayer2.C.DataType int dataType)

Dispatches MediaSourceEventListener.onLoadCompleted(int, MediaPeriodId, LoadEventInfo, MediaLoadData).

- 

loadCompleted

public void loadCompleted​([LoadEventInfo](LoadEventInfo.html "class in com.google.android.exoplayer2.source")loadEventInfo,
                          @com.google.android.exoplayer2.C.DataType int dataType,
                          @com.google.android.exoplayer2.C.TrackType int trackType,
                          @Nullable[Format](../Format.html "class in com.google.android.exoplayer2")trackFormat,
                          @com.google.android.exoplayer2.C.SelectionReason int trackSelectionReason,
                          @Nullable[Object](https://developer.android.com/reference/java/lang/Object.html "class or interface in java.lang")trackSelectionData,
                          long mediaStartTimeUs,
                          long mediaEndTimeUs)

Dispatches MediaSourceEventListener.onLoadCompleted(int, MediaPeriodId, LoadEventInfo, MediaLoadData).

- 

loadCompleted

public void loadCompleted​([LoadEventInfo](LoadEventInfo.html "class in com.google.android.exoplayer2.source")loadEventInfo,[MediaLoadData](MediaLoadData.html "class in com.google.android.exoplayer2.source")mediaLoadData)

Dispatches MediaSourceEventListener.onLoadCompleted(int, MediaPeriodId, LoadEventInfo, MediaLoadData).

- 

loadCanceled

public void loadCanceled​([LoadEventInfo](LoadEventInfo.html "class in com.google.android.exoplayer2.source")loadEventInfo,
                         @com.google.android.exoplayer2.C.DataType int dataType)

Dispatches MediaSourceEventListener.onLoadCanceled(int, MediaPeriodId, LoadEventInfo, MediaLoadData).

- 

loadCanceled

public void loadCanceled​([LoadEventInfo](LoadEventInfo.html "class in com.google.android.exoplayer2.source")loadEventInfo,
                         @com.google.android.exoplayer2.C.DataType int dataType,
                         @com.google.android.exoplayer2.C.TrackType int trackType,
                         @Nullable[Format](../Format.html "class in com.google.android.exoplayer2")trackFormat,
                         @com.google.android.exoplayer2.C.SelectionReason int trackSelectionReason,
                         @Nullable[Object](https://developer.android.com/reference/java/lang/Object.html "class or interface in java.lang")trackSelectionData,
                         long mediaStartTimeUs,
                         long mediaEndTimeUs)

Dispatches MediaSourceEventListener.onLoadCanceled(int, MediaPeriodId, LoadEventInfo, MediaLoadData).

- 

loadCanceled

public void loadCanceled​([LoadEventInfo](LoadEventInfo.html "class in com.google.android.exoplayer2.source")loadEventInfo,[MediaLoadData](MediaLoadData.html "class in com.google.android.exoplayer2.source")mediaLoadData)

Dispatches MediaSourceEventListener.onLoadCanceled(int, MediaPeriodId, LoadEventInfo, MediaLoadData).

- 

loadError

public void loadError​([LoadEventInfo](LoadEventInfo.html "class in com.google.android.exoplayer2.source")loadEventInfo,
                      @com.google.android.exoplayer2.C.DataType int dataType,[IOException](https://developer.android.com/reference/java/io/IOException.html "class or interface in java.io")error,
                      boolean wasCanceled)

Dispatches MediaSourceEventListener.onLoadError(int, MediaPeriodId, LoadEventInfo, MediaLoadData, IOException, boolean).

- 

loadError

public void loadError​([LoadEventInfo](LoadEventInfo.html "class in com.google.android.exoplayer2.source")loadEventInfo,
                      @com.google.android.exoplayer2.C.DataType int dataType,
                      @com.google.android.exoplayer2.C.TrackType int trackType,
                      @Nullable[Format](../Format.html "class in com.google.android.exoplayer2")trackFormat,
                      @com.google.android.exoplayer2.C.SelectionReason int trackSelectionReason,
                      @Nullable[Object](https://developer.android.com/reference/java/lang/Object.html "class or interface in java.lang")trackSelectionData,
                      long mediaStartTimeUs,
                      long mediaEndTimeUs,[IOException](https://developer.android.com/reference/java/io/IOException.html "class or interface in java.io")error,
                      boolean wasCanceled)

Dispatches MediaSourceEventListener.onLoadError(int, MediaPeriodId, LoadEventInfo, MediaLoadData, IOException, boolean).

- 

loadError

public void loadError​([LoadEventInfo](LoadEventInfo.html "class in com.google.android.exoplayer2.source")loadEventInfo,[MediaLoadData](MediaLoadData.html "class in com.google.android.exoplayer2.source")mediaLoadData,[IOException](https://developer.android.com/reference/java/io/IOException.html "class or interface in java.io")error,
                      boolean wasCanceled)

Dispatches MediaSourceEventListener.onLoadError(int, MediaPeriodId, LoadEventInfo, MediaLoadData, IOException, boolean).

- 

upstreamDiscarded

public void upstreamDiscarded​(int trackType,
                              long mediaStartTimeUs,
                              long mediaEndTimeUs)

Dispatches MediaSourceEventListener.onUpstreamDiscarded(int, MediaPeriodId, MediaLoadData).

- 

upstreamDiscarded

public void upstreamDiscarded​([MediaLoadData](MediaLoadData.html "class in com.google.android.exoplayer2.source")mediaLoadData)

Dispatches MediaSourceEventListener.onUpstreamDiscarded(int, MediaPeriodId, MediaLoadData).

- 

downstreamFormatChanged

public void downstreamFormatChanged​(@com.google.android.exoplayer2.C.TrackType int trackType,
                                    @Nullable[Format](../Format.html "class in com.google.android.exoplayer2")trackFormat,
                                    @com.google.android.exoplayer2.C.SelectionReason int trackSelectionReason,
                                    @Nullable[Object](https://developer.android.com/reference/java/lang/Object.html "class or interface in java.lang")trackSelectionData,
                                    long mediaTimeUs)

Dispatches MediaSourceEventListener.onDownstreamFormatChanged(int, MediaPeriodId, MediaLoadData).

- 

downstreamFormatChanged

public void downstreamFormatChanged​([MediaLoadData](MediaLoadData.html "class in com.google.android.exoplayer2.source")mediaLoadData)

Dispatches MediaSourceEventListener.onDownstreamFormatChanged(int, MediaPeriodId, MediaLoadData).