# BundledHlsMediaChunkExtractor

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

*** ** * ** ***


```
@UnstableApi
public final class BundledHlsMediaChunkExtractor implements HlsMediaChunkExtractor
```

<br />

*** ** * ** ***

`https://developer.android.com/reference/androidx/media3/exoplayer/hls/HlsMediaChunkExtractor` implementation that uses ExoPlayer app-bundled `https://developer.android.com/reference/androidx/media3/extractor/Extractor`.

## Summary

| ### Public constructors |
|---|
| `https://developer.android.com/reference/androidx/media3/exoplayer/hls/BundledHlsMediaChunkExtractor#BundledHlsMediaChunkExtractor(androidx.media3.extractor.Extractor,androidx.media3.common.Format,androidx.media3.common.util.TimestampAdjuster)( https://developer.android.com/reference/androidx/media3/extractor/Extractor extractor, https://developer.android.com/reference/androidx/media3/common/Format multivariantPlaylistFormat, https://developer.android.com/reference/androidx/media3/common/util/TimestampAdjuster timestampAdjuster )` Creates a new instance. |

| ### Public methods |
|---|---|
| `void` | `https://developer.android.com/reference/androidx/media3/exoplayer/hls/BundledHlsMediaChunkExtractor#init(androidx.media3.extractor.ExtractorOutput)(https://developer.android.com/reference/androidx/media3/extractor/ExtractorOutput extractorOutput)` Initializes the extractor with an `https://developer.android.com/reference/androidx/media3/extractor/ExtractorOutput`. |
| `boolean` | `https://developer.android.com/reference/androidx/media3/exoplayer/hls/BundledHlsMediaChunkExtractor#isPackedAudioExtractor()()` Returns whether this is a packed audio extractor, as defined in RFC 8216, Section 3.4. |
| `boolean` | `https://developer.android.com/reference/androidx/media3/exoplayer/hls/BundledHlsMediaChunkExtractor#isReusable()()` Returns whether this instance can be used for extracting multiple continuous segments. |
| `void` | `https://developer.android.com/reference/androidx/media3/exoplayer/hls/BundledHlsMediaChunkExtractor#onTruncatedSegmentParsed()()` Resets the sample parsing state. |
| `boolean` | `https://developer.android.com/reference/androidx/media3/exoplayer/hls/BundledHlsMediaChunkExtractor#read(androidx.media3.extractor.ExtractorInput)(https://developer.android.com/reference/androidx/media3/extractor/ExtractorInput extractorInput)` Extracts data read from a provided `https://developer.android.com/reference/androidx/media3/extractor/ExtractorInput`. |
| `https://developer.android.com/reference/androidx/media3/exoplayer/hls/HlsMediaChunkExtractor` | `https://developer.android.com/reference/androidx/media3/exoplayer/hls/BundledHlsMediaChunkExtractor#recreate()()` Returns a new instance for extracting the same type of media as this one. |

## Public constructors

### BundledHlsMediaChunkExtractor

```
public BundledHlsMediaChunkExtractor(
    Extractor extractor,
    Format multivariantPlaylistFormat,
    TimestampAdjuster timestampAdjuster
)
```

Creates a new instance.

| Parameters |
|---|---|
| `https://developer.android.com/reference/androidx/media3/extractor/Extractor extractor` | The underlying `https://developer.android.com/reference/androidx/media3/extractor/Extractor`. |
| `https://developer.android.com/reference/androidx/media3/common/Format multivariantPlaylistFormat` | The `https://developer.android.com/reference/androidx/media3/common/Format` obtained from the multivariant playlist. |
| `https://developer.android.com/reference/androidx/media3/common/util/TimestampAdjuster timestampAdjuster` | A `https://developer.android.com/reference/androidx/media3/common/util/TimestampAdjuster` to adjust sample timestamps. |

## Public methods

### init

```
public void init(ExtractorOutput extractorOutput)
```

Initializes the extractor with an `https://developer.android.com/reference/androidx/media3/extractor/ExtractorOutput`. Called at most once.

| Parameters |
|---|---|
| `https://developer.android.com/reference/androidx/media3/extractor/ExtractorOutput extractorOutput` | An `https://developer.android.com/reference/androidx/media3/extractor/ExtractorOutput` to receive extracted data. |

### isPackedAudioExtractor

```
public boolean isPackedAudioExtractor()
```

Returns whether this is a packed audio extractor, as defined in RFC 8216, Section 3.4.

### isReusable

```
public boolean isReusable()
```

Returns whether this instance can be used for extracting multiple continuous segments.

### onTruncatedSegmentParsed

```
public void onTruncatedSegmentParsed()
```

Resets the sample parsing state.

Resetting the parsing state allows support for Fragmented MP4 EXT-X-I-FRAME-STREAM-INF segments. EXT-X-I-FRAME-STREAM-INF segments are truncated to include only a leading key frame. After parsing said keyframe, an extractor may reach an unexpected end of file. By resetting its state, we can continue feeding samples from the following segments to the extractor. See [#7512](https://github.com/google/ExoPlayer/issues/7512) for context.

### read

```
public boolean read(ExtractorInput extractorInput)
```

Extracts data read from a provided `https://developer.android.com/reference/androidx/media3/extractor/ExtractorInput`. Must not be called before `https://developer.android.com/reference/androidx/media3/exoplayer/hls/HlsMediaChunkExtractor#init(androidx.media3.extractor.ExtractorOutput)`.

A single call to this method will block until some progress has been made, but will not block for longer than this. Hence each call will consume only a small amount of input data.

When this method throws an `https://developer.android.com/reference/java/io/IOException.html`, extraction may continue by providing an `https://developer.android.com/reference/androidx/media3/extractor/ExtractorInput` with an unchanged `https://developer.android.com/reference/androidx/media3/extractor/ExtractorInput#getPosition()` to a subsequent call to this method.

| Parameters |
|---|---|
| `https://developer.android.com/reference/androidx/media3/extractor/ExtractorInput extractorInput` | The input to read from. |

| Returns |
|---|---|
| `boolean` | Whether there is any data left to extract. Returns false if the end of input has been reached. |

| Throws |
|---|---|
| `https://developer.android.com/reference/java/io/IOException.html` | If an error occurred reading from or parsing the input. |

### recreate

```
public HlsMediaChunkExtractor recreate()
```

Returns a new instance for extracting the same type of media as this one. Can only be called on instances that are not `https://developer.android.com/reference/androidx/media3/exoplayer/hls/HlsMediaChunkExtractor#isReusable()`.