# MediaParserExtractorAdapter

Artifact: [androidx.media3:media3-exoplayer](https://developer.android.com/jetpack/androidx/releases/media3) [View Source](https://cs.android.com/search?q=file:androidx/media3/exoplayer/source/MediaParserExtractorAdapter.java+class:androidx.media3.exoplayer.source.MediaParserExtractorAdapter)

*** ** * ** ***


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

<br />

*** ** * ** ***

`https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/source/ProgressiveMediaExtractor` implemented on top of the platform's `https://developer.android.com/reference/android/media/MediaParser.html`.

## Summary

| ### Nested types |
|---|
| `class https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/source/MediaParserExtractorAdapter.Factory : https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/source/ProgressiveMediaExtractor.Factory` A `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/source/ProgressiveMediaExtractor.Factory` for instances of `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/source/MediaParserExtractorAdapter`. |

| ### Constants |
|---|---|
| `const https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/source/ProgressiveMediaExtractor.Factory!` | `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/source/MediaParserExtractorAdapter#FACTORY()` **This property is deprecated.** Use `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/source/MediaParserExtractorAdapter.Factory` instead. <br /> |

| ### Public constructors |
|---|
| `[MediaParserExtractorAdapter](https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/source/MediaParserExtractorAdapter#MediaParserExtractorAdapter(androidx.media3.exoplayer.analytics.PlayerId))(playerId: https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/analytics/PlayerId!)` **This function is deprecated.** Use `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/source/MediaParserExtractorAdapter.Factory` instead. <br /> |

| ### Public functions |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/source/MediaParserExtractorAdapter#disableSeekingOnMp3Streams()()` Disables seeking in MP3 streams. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html` | `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/source/MediaParserExtractorAdapter#getCurrentInputPosition()()` Returns the current read position in the input stream, or `https://developer.android.com/reference/kotlin/androidx/media3/common/C#INDEX_UNSET()` if no input is available. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html?` | `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/source/MediaParserExtractorAdapter#getUnderlyingImplementationName()()` Returns the name of the underlying infrastructure for reading from the input. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/source/MediaParserExtractorAdapter#init(androidx.media3.common.DataReader,android.net.Uri,java.util.Map<java.lang.String,java.util.List<java.lang.String>>,long,long,androidx.media3.extractor.ExtractorOutput)( dataReader: https://developer.android.com/reference/kotlin/androidx/media3/common/DataReader!, uri: https://developer.android.com/reference/android/net/Uri.html!, responseHeaders: (https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-mutable-map/index.html)https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-map/index.html<https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html!, (https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-mutable-list/index.html)https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-list/index.html<https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html!>!>!, position: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html, length: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html, output: https://developer.android.com/reference/kotlin/androidx/media3/extractor/ExtractorOutput! )` Initializes the underlying infrastructure for reading from the input. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/source/MediaParserExtractorAdapter#read(androidx.media3.extractor.PositionHolder)(positionHolder: https://developer.android.com/reference/kotlin/androidx/media3/extractor/PositionHolder!)` Extracts data starting at the current input stream position. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/source/MediaParserExtractorAdapter#release()()` Releases any held resources. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/source/MediaParserExtractorAdapter#seek(long,long)(position: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html, seekTimeUs: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html)` Notifies the extracting infrastructure that a seek has occurred. |

## Constants

### FACTORY

```
const val FACTORY: ProgressiveMediaExtractor.Factory!
```

> [!CAUTION]
> **This property is deprecated.**   
>
> Use `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/source/MediaParserExtractorAdapter.Factory` instead.

## Public constructors

### MediaParserExtractorAdapter

```
[MediaParserExtractorAdapter](https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/source/MediaParserExtractorAdapter#MediaParserExtractorAdapter(androidx.media3.exoplayer.analytics.PlayerId))(playerId: PlayerId!)
```

> [!CAUTION]
> **This function is deprecated.**   
>
> Use `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/source/MediaParserExtractorAdapter.Factory` instead.

## 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 `https://developer.android.com/reference/kotlin/androidx/media3/common/C#INDEX_UNSET()` if no input is available.

The returned position may still refer to the input passed to the most recent `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/source/ProgressiveMediaExtractor#init(androidx.media3.common.DataReader,android.net.Uri,java.util.Map<java.lang.String,java.util.List<java.lang.String>>,long,long,androidx.media3.extractor.ExtractorOutput)` call, even if the caller has since stopped reading from that input.

### getUnderlyingImplementationName

```
fun getUnderlyingImplementationName(): String?
```

Returns the name of the underlying infrastructure for reading from the input.

| Returns |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html?` | The name, or `null` if the underlying infrastructure has not been determined yet or if providing a name is not supported. |

### 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: https://developer.android.com/reference/kotlin/androidx/media3/common/DataReader!` | The `https://developer.android.com/reference/kotlin/androidx/media3/common/DataReader` from which data should be read. |
| `uri: https://developer.android.com/reference/android/net/Uri.html!` | The `https://developer.android.com/reference/android/net/Uri.html` from which the media is obtained. |
| `responseHeaders: (https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-mutable-map/index.html)https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-map/index.html<https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html!, (https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-mutable-list/index.html)https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-list/index.html<https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html!>!>!` | The response headers of the media, or an empty map if there are none. |
| `position: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html` | The initial position of the `dataReader` in the stream. |
| `length: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html` | The length of the stream, or `https://developer.android.com/reference/kotlin/androidx/media3/common/C#LENGTH_UNSET()` if length is unknown. |
| `output: https://developer.android.com/reference/kotlin/androidx/media3/extractor/ExtractorOutput!` | The `https://developer.android.com/reference/kotlin/androidx/media3/extractor/ExtractorOutput` that will be used to initialize the selected extractor. |

| Throws |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/source/UnrecognizedInputFormatException` | Thrown if the input format could not be detected. |
| `https://developer.android.com/reference/java/io/IOException.html` | 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: https://developer.android.com/reference/kotlin/androidx/media3/extractor/PositionHolder!` | If `https://developer.android.com/reference/kotlin/androidx/media3/extractor/Extractor#RESULT_SEEK()` is returned, this holder is updated to hold the position of the required data. |

| Returns |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | One of the `https://developer.android.com/reference/kotlin/androidx/media3/extractor/Extractor``.RESULT_*` values. |

| Throws |
|---|---|
| `https://developer.android.com/reference/java/io/IOException.html` | 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: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html` | The byte offset in the stream from which data will be provided. |
| `seekTimeUs: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html` | The seek time in microseconds. |