ProgressiveMediaExtractor


@UnstableApi
public interface ProgressiveMediaExtractor

Known direct subclasses
BundledExtractorsAdapter

ProgressiveMediaExtractor built on top of Extractor instances, whose implementation classes are bundled in the app.

MediaParserExtractorAdapter

ProgressiveMediaExtractor implemented on top of the platform's MediaParser.


Extracts the contents of a container file from a progressive media stream.

Summary

Nested types

Creates ProgressiveMediaExtractor instances.

Public methods

abstract void

Disables seeking in MP3 streams.

abstract long

Returns the current read position in the input stream, or INDEX_UNSET if no input is available.

abstract void
init(
    DataReader dataReader,
    Uri uri,
    Map<StringList<String>> responseHeaders,
    long position,
    long length,
    ExtractorOutput output
)

Initializes the underlying infrastructure for reading from the input.

abstract int
read(PositionHolder positionHolder)

Extracts data starting at the current input stream position.

abstract void

Releases any held resources.

abstract void
seek(long position, long seekTimeUs)

Notifies the extracting infrastructure that a seek has occurred.

Public methods

disableSeekingOnMp3Streams

abstract void disableSeekingOnMp3Streams()

Disables seeking in MP3 streams.

MP3 live streams commonly have seekable metadata, despite being unseekable.

getCurrentInputPosition

abstract long getCurrentInputPosition()

Returns the current read position in the input stream, or INDEX_UNSET if no input is available.

init

abstract void init(
    DataReader dataReader,
    Uri uri,
    Map<StringList<String>> responseHeaders,
    long position,
    long length,
    ExtractorOutput output
)

Initializes the underlying infrastructure for reading from the input.

Parameters
DataReader dataReader

The DataReader from which data should be read.

Uri uri

The Uri from which the media is obtained.

Map<StringList<String>> responseHeaders

The response headers of the media, or an empty map if there are none.

long position

The initial position of the dataReader in the stream.

long length

The length of the stream, or LENGTH_UNSET if length is unknown.

ExtractorOutput output

The ExtractorOutput that will be used to initialize the selected extractor.

Throws
androidx.media3.exoplayer.source.UnrecognizedInputFormatException

Thrown if the input format could not be detected.

java.io.IOException

Thrown if the input could not be read.

read

abstract int read(PositionHolder positionHolder)

Extracts data starting at the current input stream position.

Parameters
PositionHolder positionHolder

If RESULT_SEEK is returned, this holder is updated to hold the position of the required data.

Returns
int

One of the Extractor.RESULT_* values.

Throws
java.io.IOException

If an error occurred reading from the input.

release

abstract void release()

Releases any held resources.

seek

abstract void seek(long position, long seekTimeUs)

Notifies the extracting infrastructure that a seek has occurred.

Parameters
long position

The byte offset in the stream from which data will be provided.

long seekTimeUs

The seek time in microseconds.