MediaSourceEventListener.EventDispatcher


class MediaSourceEventListener.EventDispatcher


Dispatches events to MediaSourceEventListeners.

Summary

Public constructors

Creates an event dispatcher.

Public functions

Unit
addEventListener(
    handler: Handler!,
    eventListener: MediaSourceEventListener!
)

Adds a listener to the event dispatcher.

Unit

Dispatches to a function that supplies a MediaSourceEventListener.

Unit

Dispatches onDownstreamFormatChanged.

Unit
downstreamFormatChanged(
    @C.TrackType trackType: Int,
    trackFormat: Format?,
    @C.SelectionReason trackSelectionReason: Int,
    trackSelectionData: Any?,
    mediaTimeUs: Long
)

Dispatches onDownstreamFormatChanged.

Unit
loadCanceled(loadEventInfo: LoadEventInfo!, @C.DataType dataType: Int)

Dispatches onLoadCanceled.

Unit
loadCanceled(loadEventInfo: LoadEventInfo!, mediaLoadData: MediaLoadData!)

Dispatches onLoadCanceled.

Unit
loadCanceled(
    loadEventInfo: LoadEventInfo!,
    @C.DataType dataType: Int,
    @C.TrackType trackType: Int,
    trackFormat: Format?,
    @C.SelectionReason trackSelectionReason: Int,
    trackSelectionData: Any?,
    mediaStartTimeUs: Long,
    mediaEndTimeUs: Long
)

Dispatches onLoadCanceled.

Unit
loadCompleted(loadEventInfo: LoadEventInfo!, @C.DataType dataType: Int)

Dispatches onLoadCompleted.

Unit
loadCompleted(loadEventInfo: LoadEventInfo!, mediaLoadData: MediaLoadData!)

Dispatches onLoadCompleted.

Unit
loadCompleted(
    loadEventInfo: LoadEventInfo!,
    @C.DataType dataType: Int,
    @C.TrackType trackType: Int,
    trackFormat: Format?,
    @C.SelectionReason trackSelectionReason: Int,
    trackSelectionData: Any?,
    mediaStartTimeUs: Long,
    mediaEndTimeUs: Long
)

Dispatches onLoadCompleted.

Unit
loadError(
    loadEventInfo: LoadEventInfo!,
    @C.DataType dataType: Int,
    error: IOException!,
    wasCanceled: Boolean
)

Dispatches onLoadError.

Unit
loadError(
    loadEventInfo: LoadEventInfo!,
    mediaLoadData: MediaLoadData!,
    error: IOException!,
    wasCanceled: Boolean
)

Dispatches onLoadError.

Unit
loadError(
    loadEventInfo: LoadEventInfo!,
    @C.DataType dataType: Int,
    @C.TrackType trackType: Int,
    trackFormat: Format?,
    @C.SelectionReason trackSelectionReason: Int,
    trackSelectionData: Any?,
    mediaStartTimeUs: Long,
    mediaEndTimeUs: Long,
    error: IOException!,
    wasCanceled: Boolean
)

Dispatches onLoadError.

Unit
loadStarted(loadEventInfo: LoadEventInfo!, @C.DataType dataType: Int)

Dispatches onLoadStarted.

Unit
loadStarted(loadEventInfo: LoadEventInfo!, mediaLoadData: MediaLoadData!)

Dispatches onLoadStarted.

Unit
loadStarted(
    loadEventInfo: LoadEventInfo!,
    @C.DataType dataType: Int,
    @C.TrackType trackType: Int,
    trackFormat: Format?,
    @C.SelectionReason trackSelectionReason: Int,
    trackSelectionData: Any?,
    mediaStartTimeUs: Long,
    mediaEndTimeUs: Long
)

Dispatches onLoadStarted.

Unit

Removes a listener from the event dispatcher.

Unit

Dispatches onUpstreamDiscarded.

Unit
upstreamDiscarded(
    trackType: Int,
    mediaStartTimeUs: Long,
    mediaEndTimeUs: Long
)

Dispatches onUpstreamDiscarded.

MediaSourceEventListener.EventDispatcher!
withParameters(
    windowIndex: Int,
    mediaPeriodId: MediaSource.MediaPeriodId?
)

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

MediaSourceEventListener.EventDispatcher!
withParameters(
    windowIndex: Int,
    mediaPeriodId: MediaSource.MediaPeriodId?,
    mediaTimeOffsetMs: Long
)

This function is deprecated.

Use withParameters instead.

Public properties

MediaSource.MediaPeriodId?

The MediaPeriodId reported with the events.

Int

The timeline window index reported with the events.

Public constructors

EventDispatcher

EventDispatcher()

Creates an event dispatcher.

Public functions

addEventListener

fun addEventListener(
    handler: Handler!,
    eventListener: MediaSourceEventListener!
): Unit

Adds a listener to the event dispatcher.

Parameters
handler: Handler!

A handler on the which listener events will be posted.

eventListener: MediaSourceEventListener!

The listener to be added.

dispatchEvent

fun dispatchEvent(event: Consumer<MediaSourceEventListener!>!): Unit

Dispatches to a function that supplies a MediaSourceEventListener.

downstreamFormatChanged

fun downstreamFormatChanged(mediaLoadData: MediaLoadData!): Unit

Dispatches onDownstreamFormatChanged.

downstreamFormatChanged

fun downstreamFormatChanged(
    @C.TrackType trackType: Int,
    trackFormat: Format?,
    @C.SelectionReason trackSelectionReason: Int,
    trackSelectionData: Any?,
    mediaTimeUs: Long
): Unit

Dispatches onDownstreamFormatChanged.

loadCanceled

fun loadCanceled(loadEventInfo: LoadEventInfo!, @C.DataType dataType: Int): Unit

Dispatches onLoadCanceled.

loadCanceled

fun loadCanceled(loadEventInfo: LoadEventInfo!, mediaLoadData: MediaLoadData!): Unit

Dispatches onLoadCanceled.

loadCanceled

fun loadCanceled(
    loadEventInfo: LoadEventInfo!,
    @C.DataType dataType: Int,
    @C.TrackType trackType: Int,
    trackFormat: Format?,
    @C.SelectionReason trackSelectionReason: Int,
    trackSelectionData: Any?,
    mediaStartTimeUs: Long,
    mediaEndTimeUs: Long
): Unit

Dispatches onLoadCanceled.

loadCompleted

fun loadCompleted(loadEventInfo: LoadEventInfo!, @C.DataType dataType: Int): Unit

Dispatches onLoadCompleted.

loadCompleted

fun loadCompleted(loadEventInfo: LoadEventInfo!, mediaLoadData: MediaLoadData!): Unit

Dispatches onLoadCompleted.

loadCompleted

fun loadCompleted(
    loadEventInfo: LoadEventInfo!,
    @C.DataType dataType: Int,
    @C.TrackType trackType: Int,
    trackFormat: Format?,
    @C.SelectionReason trackSelectionReason: Int,
    trackSelectionData: Any?,
    mediaStartTimeUs: Long,
    mediaEndTimeUs: Long
): Unit

Dispatches onLoadCompleted.

loadError

fun loadError(
    loadEventInfo: LoadEventInfo!,
    @C.DataType dataType: Int,
    error: IOException!,
    wasCanceled: Boolean
): Unit

Dispatches onLoadError.

loadError

fun loadError(
    loadEventInfo: LoadEventInfo!,
    mediaLoadData: MediaLoadData!,
    error: IOException!,
    wasCanceled: Boolean
): Unit

Dispatches onLoadError.

loadError

fun loadError(
    loadEventInfo: LoadEventInfo!,
    @C.DataType dataType: Int,
    @C.TrackType trackType: Int,
    trackFormat: Format?,
    @C.SelectionReason trackSelectionReason: Int,
    trackSelectionData: Any?,
    mediaStartTimeUs: Long,
    mediaEndTimeUs: Long,
    error: IOException!,
    wasCanceled: Boolean
): Unit

Dispatches onLoadError.

loadStarted

fun loadStarted(loadEventInfo: LoadEventInfo!, @C.DataType dataType: Int): Unit

Dispatches onLoadStarted.

loadStarted

fun loadStarted(loadEventInfo: LoadEventInfo!, mediaLoadData: MediaLoadData!): Unit

Dispatches onLoadStarted.

loadStarted

fun loadStarted(
    loadEventInfo: LoadEventInfo!,
    @C.DataType dataType: Int,
    @C.TrackType trackType: Int,
    trackFormat: Format?,
    @C.SelectionReason trackSelectionReason: Int,
    trackSelectionData: Any?,
    mediaStartTimeUs: Long,
    mediaEndTimeUs: Long
): Unit

Dispatches onLoadStarted.

removeEventListener

fun removeEventListener(eventListener: MediaSourceEventListener!): Unit

Removes a listener from the event dispatcher.

Parameters
eventListener: MediaSourceEventListener!

The listener to be removed.

upstreamDiscarded

fun upstreamDiscarded(mediaLoadData: MediaLoadData!): Unit

Dispatches onUpstreamDiscarded.

upstreamDiscarded

fun upstreamDiscarded(
    trackType: Int,
    mediaStartTimeUs: Long,
    mediaEndTimeUs: Long
): Unit

Dispatches onUpstreamDiscarded.

withParameters

fun withParameters(
    windowIndex: Int,
    mediaPeriodId: MediaSource.MediaPeriodId?
): MediaSourceEventListener.EventDispatcher!

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

Parameters
windowIndex: Int

The timeline window index to be reported with the events.

mediaPeriodId: MediaSource.MediaPeriodId?

The MediaPeriodId to be reported with the events.

Returns
MediaSourceEventListener.EventDispatcher!

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

withParameters

fun withParameters(
    windowIndex: Int,
    mediaPeriodId: MediaSource.MediaPeriodId?,
    mediaTimeOffsetMs: Long
): MediaSourceEventListener.EventDispatcher!

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

Public properties

mediaPeriodId

val mediaPeriodIdMediaSource.MediaPeriodId?

The MediaPeriodId reported with the events.

windowIndex

val windowIndexInt

The timeline window index reported with the events.