MediaParserExtractorAdapter


@RequiresApi(value = 30)
@UnstableApi
class MediaParserExtractorAdapter : ProgressiveMediaExtractor


ProgressiveMediaExtractor implemented on top of the platform's MediaParser.

Summary

Constants

const ProgressiveMediaExtractor.Factory!

This property is deprecated.

Use MediaParserExtractorAdapter.Factory instead.

Public constructors

This function is deprecated.

Use MediaParserExtractorAdapter.Factory instead.

Public functions

Unit

Disables seeking in MP3 streams.

Long

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

Unit
init(
    dataReader: DataReader!,
    uri: Uri!,
    responseHeaders: (Mutable)Map<String!, (Mutable)List<String!>!>!,
    position: Long,
    length: Long,
    output: ExtractorOutput!
)

Initializes the underlying infrastructure for reading from the input.

Int
read(positionHolder: PositionHolder!)

Extracts data starting at the current input stream position.

Unit

Releases any held resources.

Unit
seek(position: Long, seekTimeUs: Long)

Notifies the extracting infrastructure that a seek has occurred.

Constants

FACTORY

const val FACTORYProgressiveMediaExtractor.Factory!

Public constructors

MediaParserExtractorAdapter

MediaParserExtractorAdapter(playerId: PlayerId!)

Public functions

disableSeekingOnMp3Streams

fun disableSeekingOnMp3Streams(): Unit

Disables seeking in MP3 streams.

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

getCurrentInputPosition

fun getCurrentInputPosition(): Long

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

init

fun init(
    dataReader: DataReader!,
    uri: Uri!,
    responseHeaders: (Mutable)Map<String!, (Mutable)List<String!>!>!,
    position: Long,
    length: Long,
    output: ExtractorOutput!
): Unit

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.

responseHeaders: (Mutable)Map<String!, (Mutable)List<String!>!>!

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

position: Long

The initial position of the dataReader in the stream.

length: Long

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

output: ExtractorOutput!

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

fun read(positionHolder: PositionHolder!): Int

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

fun release(): Unit

Releases any held resources.

seek

fun seek(position: Long, seekTimeUs: Long): Unit

Notifies the extracting infrastructure that a seek has occurred.

Parameters
position: Long

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

seekTimeUs: Long

The seek time in microseconds.