# BundledExtractorsAdapter

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/BundledExtractorsAdapter.java+class:androidx.media3.exoplayer.source.BundledExtractorsAdapter)

*** ** * ** ***


```
@UnstableApi
public final class BundledExtractorsAdapter implements ProgressiveMediaExtractor
```

<br />

*** ** * ** ***

`https://developer.android.com/reference/androidx/media3/exoplayer/source/ProgressiveMediaExtractor` built on top of `https://developer.android.com/reference/androidx/media3/extractor/Extractor` instances, whose implementation classes are bundled in the app.

## Summary

| ### Public constructors |
|---|
| `https://developer.android.com/reference/androidx/media3/exoplayer/source/BundledExtractorsAdapter#BundledExtractorsAdapter(androidx.media3.extractor.ExtractorsFactory)(https://developer.android.com/reference/androidx/media3/extractor/ExtractorsFactory extractorsFactory)` Creates a holder that will select an extractor and initialize it using the specified output. |

| ### Public methods |
|---|---|
| `void` | `https://developer.android.com/reference/androidx/media3/exoplayer/source/BundledExtractorsAdapter#disableSeekingOnMp3Streams()()` Disables seeking in MP3 streams. |
| `long` | `https://developer.android.com/reference/androidx/media3/exoplayer/source/BundledExtractorsAdapter#getCurrentInputPosition()()` Returns the current read position in the input stream, or `https://developer.android.com/reference/androidx/media3/common/C#INDEX_UNSET()` if no input is available. |
| `@https://developer.android.com/reference/androidx/annotation/Nullable https://developer.android.com/reference/java/lang/String.html` | `https://developer.android.com/reference/androidx/media3/exoplayer/source/BundledExtractorsAdapter#getUnderlyingImplementationName()()` Returns the name of the underlying infrastructure for reading from the input. |
| `void` | `https://developer.android.com/reference/androidx/media3/exoplayer/source/BundledExtractorsAdapter#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)( https://developer.android.com/reference/androidx/media3/common/DataReader dataReader, https://developer.android.com/reference/android/net/Uri.html uri, https://developer.android.com/reference/java/util/Map.html<https://developer.android.com/reference/java/lang/String.html, https://developer.android.com/reference/java/util/List.html<https://developer.android.com/reference/java/lang/String.html>> responseHeaders, long position, long length, https://developer.android.com/reference/androidx/media3/extractor/ExtractorOutput output )` Initializes the underlying infrastructure for reading from the input. |
| `int` | `https://developer.android.com/reference/androidx/media3/exoplayer/source/BundledExtractorsAdapter#read(androidx.media3.extractor.PositionHolder)(https://developer.android.com/reference/androidx/media3/extractor/PositionHolder positionHolder)` Extracts data starting at the current input stream position. |
| `void` | `https://developer.android.com/reference/androidx/media3/exoplayer/source/BundledExtractorsAdapter#release()()` Releases any held resources. |
| `void` | `https://developer.android.com/reference/androidx/media3/exoplayer/source/BundledExtractorsAdapter#seek(long,long)(long position, long seekTimeUs)` Notifies the extracting infrastructure that a seek has occurred. |

## Public constructors

### BundledExtractorsAdapter

```
public BundledExtractorsAdapter(ExtractorsFactory extractorsFactory)
```

Creates a holder that will select an extractor and initialize it using the specified output.

| Parameters |
|---|---|
| `https://developer.android.com/reference/androidx/media3/extractor/ExtractorsFactory extractorsFactory` | The `https://developer.android.com/reference/androidx/media3/extractor/ExtractorsFactory` providing the extractors to choose from. |

## Public methods

### disableSeekingOnMp3Streams

```
public void disableSeekingOnMp3Streams()
```

Disables seeking in MP3 streams.

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

### getCurrentInputPosition

```
public long getCurrentInputPosition()
```

Returns the current read position in the input stream, or `https://developer.android.com/reference/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/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

```
public @Nullable String getUnderlyingImplementationName()
```

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

| Returns |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/Nullable https://developer.android.com/reference/java/lang/String.html` | The name, or `null` if the underlying infrastructure has not been determined yet or if providing a name is not supported. |

### init

```
public void init(
    DataReader dataReader,
    Uri uri,
    Map<String, List<String>> responseHeaders,
    long position,
    long length,
    ExtractorOutput output
)
```

Initializes the underlying infrastructure for reading from the input.

| Parameters |
|---|---|
| `https://developer.android.com/reference/androidx/media3/common/DataReader dataReader` | The `https://developer.android.com/reference/androidx/media3/common/DataReader` from which data should be read. |
| `https://developer.android.com/reference/android/net/Uri.html uri` | The `https://developer.android.com/reference/android/net/Uri.html` from which the media is obtained. |
| `https://developer.android.com/reference/java/util/Map.html<https://developer.android.com/reference/java/lang/String.html, https://developer.android.com/reference/java/util/List.html<https://developer.android.com/reference/java/lang/String.html>> 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 `https://developer.android.com/reference/androidx/media3/common/C#LENGTH_UNSET()` if length is unknown. |
| `https://developer.android.com/reference/androidx/media3/extractor/ExtractorOutput output` | The `https://developer.android.com/reference/androidx/media3/extractor/ExtractorOutput` that will be used to initialize the selected extractor. |

| Throws |
|---|---|
| `https://developer.android.com/reference/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

```
public int read(PositionHolder positionHolder)
```

Extracts data starting at the current input stream position.

| Parameters |
|---|---|
| `https://developer.android.com/reference/androidx/media3/extractor/PositionHolder positionHolder` | If `https://developer.android.com/reference/androidx/media3/extractor/Extractor#RESULT_SEEK()` is returned, this holder is updated to hold the position of the required data. |

| Returns |
|---|---|
| `int` | One of the `https://developer.android.com/reference/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

```
public void release()
```

Releases any held resources.

### seek

```
public 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. |