public class

MediaSourceEventListener.EventDispatcher

extends java.lang.Object

 java.lang.Object

↳androidx.media3.exoplayer.source.MediaSourceEventListener.EventDispatcher

Overview

Dispatches events to MediaSourceEventListeners.

Summary

Fields
public final MediaSource.MediaPeriodIdmediaPeriodId

The MediaSource.MediaPeriodId reported with the events.

public final intwindowIndex

The timeline window index reported with the events.

Constructors
publicEventDispatcher()

Creates an event dispatcher.

Methods
public voidaddEventListener(Handler handler, MediaSourceEventListener eventListener)

Adds a listener to the event dispatcher.

public voiddownstreamFormatChanged(int trackType, Format trackFormat, int trackSelectionReason, java.lang.Object trackSelectionData, long mediaTimeUs)

Dispatches MediaSourceEventListener.EventDispatcher.

public voiddownstreamFormatChanged(MediaLoadData mediaLoadData)

Dispatches MediaSourceEventListener.EventDispatcher.

public voidloadCanceled(LoadEventInfo loadEventInfo, int dataType)

Dispatches MediaSourceEventListener.EventDispatcher.

public voidloadCanceled(LoadEventInfo loadEventInfo, int dataType, int trackType, Format trackFormat, int trackSelectionReason, java.lang.Object trackSelectionData, long mediaStartTimeUs, long mediaEndTimeUs)

Dispatches MediaSourceEventListener.EventDispatcher.

public voidloadCanceled(LoadEventInfo loadEventInfo, MediaLoadData mediaLoadData)

Dispatches MediaSourceEventListener.EventDispatcher.

public voidloadCompleted(LoadEventInfo loadEventInfo, int dataType)

Dispatches MediaSourceEventListener.EventDispatcher.

public voidloadCompleted(LoadEventInfo loadEventInfo, int dataType, int trackType, Format trackFormat, int trackSelectionReason, java.lang.Object trackSelectionData, long mediaStartTimeUs, long mediaEndTimeUs)

Dispatches MediaSourceEventListener.EventDispatcher.

public voidloadCompleted(LoadEventInfo loadEventInfo, MediaLoadData mediaLoadData)

Dispatches MediaSourceEventListener.EventDispatcher.

public voidloadError(LoadEventInfo loadEventInfo, int dataType, int trackType, Format trackFormat, int trackSelectionReason, java.lang.Object trackSelectionData, long mediaStartTimeUs, long mediaEndTimeUs, java.io.IOException error, boolean wasCanceled)

Dispatches MediaSourceEventListener.EventDispatcher.

public voidloadError(LoadEventInfo loadEventInfo, int dataType, java.io.IOException error, boolean wasCanceled)

Dispatches MediaSourceEventListener.EventDispatcher.

public voidloadError(LoadEventInfo loadEventInfo, MediaLoadData mediaLoadData, java.io.IOException error, boolean wasCanceled)

Dispatches MediaSourceEventListener.EventDispatcher.

public voidloadStarted(LoadEventInfo loadEventInfo, int dataType)

Dispatches MediaSourceEventListener.EventDispatcher.

public voidloadStarted(LoadEventInfo loadEventInfo, int dataType, int trackType, Format trackFormat, int trackSelectionReason, java.lang.Object trackSelectionData, long mediaStartTimeUs, long mediaEndTimeUs)

Dispatches MediaSourceEventListener.EventDispatcher.

public voidloadStarted(LoadEventInfo loadEventInfo, MediaLoadData mediaLoadData)

Dispatches MediaSourceEventListener.EventDispatcher.

public voidremoveEventListener(MediaSourceEventListener eventListener)

Removes a listener from the event dispatcher.

public voidupstreamDiscarded(int trackType, long mediaStartTimeUs, long mediaEndTimeUs)

Dispatches MediaSourceEventListener.EventDispatcher.

public voidupstreamDiscarded(MediaLoadData mediaLoadData)

Dispatches MediaSourceEventListener.EventDispatcher.

public MediaSourceEventListener.EventDispatcherwithParameters(int windowIndex, MediaSource.MediaPeriodId mediaPeriodId, long mediaTimeOffsetMs)

Creates a view of the event dispatcher with pre-configured window index, media period id, and media time offset.

from java.lang.Objectclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

Fields

public final int windowIndex

The timeline window index reported with the events.

public final MediaSource.MediaPeriodId mediaPeriodId

The MediaSource.MediaPeriodId reported with the events.

Constructors

public EventDispatcher()

Creates an event dispatcher.

Methods

public MediaSourceEventListener.EventDispatcher withParameters(int windowIndex, MediaSource.MediaPeriodId mediaPeriodId, long mediaTimeOffsetMs)

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.
mediaTimeOffsetMs: The offset to be added to all media times, in milliseconds.

Returns:

A view of the event dispatcher with the pre-configured parameters.

public void addEventListener(Handler handler, MediaSourceEventListener 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.

public void removeEventListener(MediaSourceEventListener eventListener)

Removes a listener from the event dispatcher.

Parameters:

eventListener: The listener to be removed.

public void loadStarted(LoadEventInfo loadEventInfo, int dataType)

Dispatches MediaSourceEventListener.EventDispatcher.

public void loadStarted(LoadEventInfo loadEventInfo, int dataType, int trackType, Format trackFormat, int trackSelectionReason, java.lang.Object trackSelectionData, long mediaStartTimeUs, long mediaEndTimeUs)

Dispatches MediaSourceEventListener.EventDispatcher.

public void loadStarted(LoadEventInfo loadEventInfo, MediaLoadData mediaLoadData)

Dispatches MediaSourceEventListener.EventDispatcher.

public void loadCompleted(LoadEventInfo loadEventInfo, int dataType)

Dispatches MediaSourceEventListener.EventDispatcher.

public void loadCompleted(LoadEventInfo loadEventInfo, int dataType, int trackType, Format trackFormat, int trackSelectionReason, java.lang.Object trackSelectionData, long mediaStartTimeUs, long mediaEndTimeUs)

Dispatches MediaSourceEventListener.EventDispatcher.

public void loadCompleted(LoadEventInfo loadEventInfo, MediaLoadData mediaLoadData)

Dispatches MediaSourceEventListener.EventDispatcher.

public void loadCanceled(LoadEventInfo loadEventInfo, int dataType)

Dispatches MediaSourceEventListener.EventDispatcher.

public void loadCanceled(LoadEventInfo loadEventInfo, int dataType, int trackType, Format trackFormat, int trackSelectionReason, java.lang.Object trackSelectionData, long mediaStartTimeUs, long mediaEndTimeUs)

Dispatches MediaSourceEventListener.EventDispatcher.

public void loadCanceled(LoadEventInfo loadEventInfo, MediaLoadData mediaLoadData)

Dispatches MediaSourceEventListener.EventDispatcher.

public void loadError(LoadEventInfo loadEventInfo, int dataType, java.io.IOException error, boolean wasCanceled)

Dispatches MediaSourceEventListener.EventDispatcher.

public void loadError(LoadEventInfo loadEventInfo, int dataType, int trackType, Format trackFormat, int trackSelectionReason, java.lang.Object trackSelectionData, long mediaStartTimeUs, long mediaEndTimeUs, java.io.IOException error, boolean wasCanceled)

Dispatches MediaSourceEventListener.EventDispatcher.

public void loadError(LoadEventInfo loadEventInfo, MediaLoadData mediaLoadData, java.io.IOException error, boolean wasCanceled)

Dispatches MediaSourceEventListener.EventDispatcher.

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

Dispatches MediaSourceEventListener.EventDispatcher.

public void upstreamDiscarded(MediaLoadData mediaLoadData)

Dispatches MediaSourceEventListener.EventDispatcher.

public void downstreamFormatChanged(int trackType, Format trackFormat, int trackSelectionReason, java.lang.Object trackSelectionData, long mediaTimeUs)

Dispatches MediaSourceEventListener.EventDispatcher.

public void downstreamFormatChanged(MediaLoadData mediaLoadData)

Dispatches MediaSourceEventListener.EventDispatcher.