LoopingMediaSource


@UnstableApi
class LoopingMediaSource : WrappingMediaSource


Loops a MediaSource a specified number of times.

Summary

Public constructors

This function is deprecated. Deprecated in Java

LoopingMediaSource(childSource: MediaSource!, loopCount: Int)

This function is deprecated. Deprecated in Java

Public functions

MediaPeriod!
createPeriod(
    id: MediaSource.MediaPeriodId!,
    allocator: Allocator!,
    startPositionUs: Long
)

This function is deprecated. Deprecated in Java

Timeline?

This function is deprecated. Deprecated in Java

Boolean

This function is deprecated. Deprecated in Java

Unit
releasePeriod(mediaPeriod: MediaPeriod!)

This function is deprecated. Deprecated in Java

Protected functions

MediaSource.MediaPeriodId?

This function is deprecated. Deprecated in Java

Unit

This function is deprecated. Deprecated in Java

Inherited functions

From androidx.media3.exoplayer.source.BaseMediaSource
Unit
@UnstableApi
addDrmEventListener(
    handler: Handler!,
    eventListener: DrmSessionEventListener!
)

This function is deprecated. Deprecated in Java

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

This function is deprecated. Deprecated in Java

DrmSessionEventListener.EventDispatcher!

This function is deprecated. Deprecated in Java

DrmSessionEventListener.EventDispatcher!
createDrmEventDispatcher(
    windowIndex: Int,
    mediaPeriodId: MediaSource.MediaPeriodId?
)

This function is deprecated. Deprecated in Java

MediaSourceEventListener.EventDispatcher!

This function is deprecated. Deprecated in Java

MediaSourceEventListener.EventDispatcher!
createEventDispatcher(
    mediaPeriodId: MediaSource.MediaPeriodId!,
    mediaTimeOffsetMs: Long
)

This function is deprecated.

Use createEventDispatcher instead.

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

This function is deprecated. Deprecated in Java

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

This function is deprecated.

Use createEventDispatcher instead.

Unit

This function is deprecated. Deprecated in Java

Unit

This function is deprecated. Deprecated in Java

Boolean

This function is deprecated. Deprecated in Java

Unit
@UnstableApi
prepareSource(
    caller: MediaSource.MediaSourceCaller!,
    playerId: PlayerId!,
    bandwidthMeter: BandwidthMeter!
)

This function is deprecated. Deprecated in Java

Boolean

This function is deprecated. Deprecated in Java

Unit

This function is deprecated. Deprecated in Java

Unit

This function is deprecated. Deprecated in Java

Unit

This function is deprecated. Deprecated in Java

Unit

This function is deprecated. Deprecated in Java

From androidx.media3.exoplayer.source.CompositeMediaSource
Unit

This function is deprecated. Deprecated in Java

Unit

This function is deprecated. Deprecated in Java

Unit

This function is deprecated. Deprecated in Java

Unit

This function is deprecated. Deprecated in Java

MediaSource.MediaPeriodId?
getMediaPeriodIdForChildMediaPeriodId(
    @UnknownNull childSourceId: T!,
    mediaPeriodId: MediaSource.MediaPeriodId!
)

This function is deprecated. Deprecated in Java

Long
getMediaTimeForChildMediaTime(
    @UnknownNull childSourceId: T!,
    mediaTimeMs: Long,
    mediaPeriodId: MediaSource.MediaPeriodId?
)

This function is deprecated. Deprecated in Java

Int
getWindowIndexForChildWindowIndex(
    @UnknownNull childSourceId: T!,
    windowIndex: Int
)

This function is deprecated. Deprecated in Java

Unit

This function is deprecated. Deprecated in Java

abstract Unit
onChildSourceInfoRefreshed(
    @UnknownNull childSourceId: T!,
    mediaSource: MediaSource!,
    newTimeline: Timeline!
)

This function is deprecated. Deprecated in Java

Unit
prepareChildSource(@UnknownNull id: T!, mediaSource: MediaSource!)

This function is deprecated. Deprecated in Java

Unit

This function is deprecated. Deprecated in Java

Unit

This function is deprecated. Deprecated in Java

From androidx.media3.exoplayer.source.MediaSource
Unit
@UnstableApi
prepareSource(
    caller: MediaSource.MediaSourceCaller!,
    mediaTransferListener: TransferListener?,
    playerId: PlayerId!
)

This function is deprecated.

Use prepareSource instead.

From androidx.media3.exoplayer.source.WrappingMediaSource
Boolean

This function is deprecated. Deprecated in Java

Unit

This function is deprecated. Deprecated in Java

Unit

This function is deprecated. Deprecated in Java

MediaItem!

This function is deprecated. Deprecated in Java

MediaSource.MediaPeriodId?
getMediaPeriodIdForChildMediaPeriodId(
    childSourceId: Void!,
    mediaPeriodId: MediaSource.MediaPeriodId!
)

This function is deprecated. Deprecated in Java

Long
getMediaTimeForChildMediaTime(
    mediaTimeMs: Long,
    mediaPeriodId: MediaSource.MediaPeriodId?
)

This function is deprecated. Deprecated in Java

Long
getMediaTimeForChildMediaTime(
    childSourceId: Void!,
    mediaTimeMs: Long,
    mediaPeriodId: MediaSource.MediaPeriodId?
)

This function is deprecated. Deprecated in Java

Int

This function is deprecated. Deprecated in Java

Int
getWindowIndexForChildWindowIndex(childSourceId: Void!, windowIndex: Int)

This function is deprecated. Deprecated in Java

Unit
onChildSourceInfoRefreshed(
    childSourceId: Void!,
    mediaSource: MediaSource!,
    newTimeline: Timeline!
)

This function is deprecated. Deprecated in Java

Unit

This function is deprecated. Deprecated in Java

Unit

This function is deprecated. Deprecated in Java

Unit
prepareSourceInternal(mediaTransferListener: TransferListener?)

This function is deprecated. Deprecated in Java

Unit

This function is deprecated. Deprecated in Java

Unit

This function is deprecated. Deprecated in Java

Inherited properties

From androidx.media3.exoplayer.source.BaseMediaSource
BandwidthMeter?

This property is deprecated. Deprecated in Java

PlayerId?

This property is deprecated. Deprecated in Java

From androidx.media3.exoplayer.source.WrappingMediaSource
MediaSource!

This property is deprecated. Deprecated in Java

Public constructors

LoopingMediaSource

LoopingMediaSource(childSource: MediaSource!)

Loops the provided source indefinitely. Note that it is usually better to use setRepeatMode.

Parameters
childSource: MediaSource!

The MediaSource to loop.

LoopingMediaSource

LoopingMediaSource(childSource: MediaSource!, loopCount: Int)

Loops the provided source a specified number of times.

Parameters
childSource: MediaSource!

The MediaSource to loop.

loopCount: Int

The desired number of loops. Must be strictly positive.

Public functions

createPeriod

fun createPeriod(
    id: MediaSource.MediaPeriodId!,
    allocator: Allocator!,
    startPositionUs: Long
): MediaPeriod!

Creates the requested MediaPeriod.

This method typically forwards to the wrapped media source and optionally wraps the returned MediaPeriod.

See also
createPeriod

getInitialTimeline

fun getInitialTimeline(): Timeline?

Returns the initial placeholder timeline that is returned immediately when the real timeline is not yet known, or null to let the player create an initial timeline.

Should not be called directly from application code.

The initial timeline must use the same uids for windows and periods that the real timeline will use. It also must provide windows which are marked as dynamic to indicate that the window is expected to change when the real timeline arrives.

Any media source which has multiple windows should typically provide such an initial timeline to make sure the player reports the correct number of windows immediately.

This method must be called on the application thread.

isSingleWindow

fun isSingleWindow(): Boolean

Returns true if the media source is guaranteed to never have zero or more than one window.

Should not be called directly from application code.

The default implementation returns true.

This method must be called on the application thread.

Returns
Boolean

true if the source has exactly one window.

releasePeriod

fun releasePeriod(mediaPeriod: MediaPeriod!): Unit

Releases a MediaPeriod.

This method typically forwards to the wrapped media source and optionally unwraps the provided MediaPeriod.

See also
releasePeriod

Protected functions

getMediaPeriodIdForChildMediaPeriodId

protected fun getMediaPeriodIdForChildMediaPeriodId(
    mediaPeriodId: MediaSource.MediaPeriodId!
): MediaSource.MediaPeriodId?

Returns the MediaPeriodId in the wrapping source corresponding to the specified MediaPeriodId in a child source. The default implementation does not change the media period id.

Parameters
mediaPeriodId: MediaSource.MediaPeriodId!

A MediaPeriodId of the child source.

Returns
MediaSource.MediaPeriodId?

The corresponding MediaPeriodId in the wrapping source. Null if no corresponding media period id can be determined.

onChildSourceInfoRefreshed

protected fun onChildSourceInfoRefreshed(newTimeline: Timeline!): Unit

Called when the child source info has been refreshed.

This Timeline can be amended if needed, for example using ForwardingTimeline. The Timeline for the wrapping source needs to be published with refreshSourceInfo.

Parameters
newTimeline: Timeline!

The timeline of the child source.