@UnstableApi
public abstract class MediaChunk extends Chunk

Known direct subclasses
BaseMediaChunk

A base implementation of MediaChunk that outputs to a BaseMediaChunkOutput.

FakeMediaChunk

Fake MediaChunk.

Known indirect subclasses
ContainerMediaChunk

A BaseMediaChunk that uses an Extractor to decode sample data.

SingleSampleMediaChunk

A BaseMediaChunk for chunks consisting of a single raw sample.


An abstract base class for Chunks that contain media samples.

Summary

Public fields

final long

The chunk index, or INDEX_UNSET if it is not known.

Public constructors

MediaChunk(
    DataSource dataSource,
    DataSpec dataSpec,
    Format trackFormat,
    @C.SelectionReason int trackSelectionReason,
    @Nullable Object trackSelectionData,
    long startTimeUs,
    long endTimeUs,
    long chunkIndex
)

Public methods

long

Returns the next chunk index or INDEX_UNSET if it is not known.

abstract boolean

Returns whether the chunk has been fully loaded.

Inherited fields

From androidx.media3.exoplayer.source.chunk.Chunk
final StatsDataSource
final DataSpec

The DataSpec that defines the data to be loaded.

final long

The end time of the media contained by the chunk, or TIME_UNSET if the data being loaded does not contain media samples.

final long

Identifies the load task for this loadable.

final long

The start time of the media contained by the chunk, or TIME_UNSET if the data being loaded does not contain media samples.

final Format

The format of the track to which this chunk belongs.

final @Nullable Object

Optional data associated with the selection of the track to which this chunk belongs.

final int

One of the selection reasons if the chunk belongs to a track.

final int

The data type of the chunk.

Inherited methods

From androidx.media3.exoplayer.source.chunk.Chunk
final long

Returns the number of bytes that have been loaded.

final long

Returns the duration of the chunk in microseconds.

final Map<StringList<String>>

Returns the response headers associated with the last open call.

final Uri

Returns the Uri associated with the last open call.

From androidx.media3.exoplayer.upstream.Loader.Loadable
abstract void

Cancels the load.

abstract void

Performs the load, returning on completion or cancellation.

Public fields

chunkIndex

public final long chunkIndex

The chunk index, or INDEX_UNSET if it is not known.

Public constructors

MediaChunk

public MediaChunk(
    DataSource dataSource,
    DataSpec dataSpec,
    Format trackFormat,
    @C.SelectionReason int trackSelectionReason,
    @Nullable Object trackSelectionData,
    long startTimeUs,
    long endTimeUs,
    long chunkIndex
)
Parameters
DataSource dataSource

The source from which the data should be loaded.

DataSpec dataSpec

Defines the data to be loaded.

Format trackFormat

See trackFormat.

@C.SelectionReason int trackSelectionReason

See trackSelectionReason.

@Nullable Object trackSelectionData

See trackSelectionData.

long startTimeUs

The start time of the media contained by the chunk, in microseconds.

long endTimeUs

The end time of the media contained by the chunk, in microseconds.

long chunkIndex

The index of the chunk, or INDEX_UNSET if it is not known.

Public methods

getNextChunkIndex

public long getNextChunkIndex()

Returns the next chunk index or INDEX_UNSET if it is not known.

isLoadCompleted

public abstract boolean isLoadCompleted()

Returns whether the chunk has been fully loaded.