BaseMediaChunkIterator


@UnstableApi
abstract class BaseMediaChunkIterator : MediaChunkIterator


Base class for MediaChunkIterators. Handles next and isEnded, and provides a bounds check for child classes.

Summary

Public constructors

BaseMediaChunkIterator(fromIndex: Long, toIndex: Long)

Creates base iterator.

Public functions

Boolean

Returns whether the iteration has reached the end of the available data.

Boolean

Moves the iterator to the next media chunk.

Unit

Resets the iterator to the initial position.

Protected functions

Unit

Verifies that the iterator points to a valid element.

Protected properties

Long

Inherited Constants

From androidx.media3.exoplayer.source.chunk.MediaChunkIterator
const MediaChunkIterator!

An empty media chunk iterator without available data.

Inherited functions

From androidx.media3.exoplayer.source.chunk.MediaChunkIterator
abstract Long

Returns the media end time of the chunk, in microseconds.

abstract Long

Returns the media start time of the chunk, in microseconds.

abstract DataSpec!

Returns the DataSpec used to load the media chunk.

Public constructors

BaseMediaChunkIterator

BaseMediaChunkIterator(fromIndex: Long, toIndex: Long)

Creates base iterator.

Parameters
fromIndex: Long

The first available index.

toIndex: Long

The last available index.

Public functions

isEnded

fun isEnded(): Boolean

Returns whether the iteration has reached the end of the available data.

next

fun next(): Boolean

Moves the iterator to the next media chunk.

Check the return value or isEnded to determine whether the iterator reached the end of the available data.

Returns
Boolean

Whether the iterator points to a media chunk with available data.

reset

fun reset(): Unit

Resets the iterator to the initial position.

Protected functions

checkInBounds

protected fun checkInBounds(): Unit

Verifies that the iterator points to a valid element.

Throws
java.util.NoSuchElementException

If the iterator does not point to a valid element.

Protected properties

currentIndex

protected val currentIndexLong