# DefaultHlsExtractorFactory

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

*** ** * ** ***


```
@UnstableApi
public final class DefaultHlsExtractorFactory implements HlsExtractorFactory
```

<br />

*** ** * ** ***

Default `https://developer.android.com/reference/androidx/media3/exoplayer/hls/HlsExtractorFactory` implementation.

## Summary

| ### Public constructors |
|---|
| `https://developer.android.com/reference/androidx/media3/exoplayer/hls/DefaultHlsExtractorFactory#DefaultHlsExtractorFactory()()` Equivalent to `https://developer.android.com/reference/androidx/media3/exoplayer/hls/DefaultHlsExtractorFactory#DefaultHlsExtractorFactory(int,boolean)` |
| `https://developer.android.com/reference/androidx/media3/exoplayer/hls/DefaultHlsExtractorFactory#DefaultHlsExtractorFactory(int,boolean)( int payloadReaderFactoryFlags, boolean exposeCea608WhenMissingDeclarations )` Creates a factory for HLS segment extractors. |

| ### Public methods |
|---|---|
| `https://developer.android.com/reference/androidx/media3/exoplayer/hls/BundledHlsMediaChunkExtractor` | `https://developer.android.com/reference/androidx/media3/exoplayer/hls/DefaultHlsExtractorFactory#createExtractor(android.net.Uri,androidx.media3.common.Format,java.util.List<androidx.media3.common.Format>,androidx.media3.common.util.TimestampAdjuster,java.util.Map<java.lang.String,java.util.List<java.lang.String>>,androidx.media3.extractor.ExtractorInput,androidx.media3.exoplayer.analytics.PlayerId)( https://developer.android.com/reference/android/net/Uri.html uri, https://developer.android.com/reference/androidx/media3/common/Format format, @https://developer.android.com/reference/androidx/annotation/Nullable https://developer.android.com/reference/java/util/List.html<https://developer.android.com/reference/androidx/media3/common/Format> muxedCaptionFormats, https://developer.android.com/reference/androidx/media3/common/util/TimestampAdjuster timestampAdjuster, 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, https://developer.android.com/reference/androidx/media3/extractor/ExtractorInput sniffingExtractorInput, https://developer.android.com/reference/androidx/media3/exoplayer/analytics/PlayerId playerId )` Creates an `https://developer.android.com/reference/androidx/media3/extractor/Extractor` for extracting HLS media chunks. |
| `https://developer.android.com/reference/androidx/media3/exoplayer/hls/DefaultHlsExtractorFactory` | `@https://checkerframework.org/api/com/google/errorprone/annotations/CanIgnoreReturnValue.html https://developer.android.com/reference/androidx/media3/exoplayer/hls/DefaultHlsExtractorFactory#experimentalParseSubtitlesDuringExtraction(boolean)( boolean parseSubtitlesDuringExtraction )` Sets whether subtitles should be parsed as part of extraction (before being added to the sample queue) or as part of rendering (when being taken from the sample queue). |
| `https://developer.android.com/reference/androidx/media3/common/Format` | `https://developer.android.com/reference/androidx/media3/exoplayer/hls/DefaultHlsExtractorFactory#getOutputTextFormat(androidx.media3.common.Format)(https://developer.android.com/reference/androidx/media3/common/Format sourceFormat)` Returns the output of emitted C#TRACK_TYPE_TEXT text samples which were originally in sourceFormat}. |
| `https://developer.android.com/reference/androidx/media3/exoplayer/hls/DefaultHlsExtractorFactory` | `@https://checkerframework.org/api/com/google/errorprone/annotations/CanIgnoreReturnValue.html https://developer.android.com/reference/androidx/media3/exoplayer/hls/DefaultHlsExtractorFactory#setSubtitleParserFactory(androidx.media3.extractor.text.SubtitleParser.Factory)(https://developer.android.com/reference/androidx/media3/extractor/text/SubtitleParser.Factory subtitleParserFactory)` Sets the `https://developer.android.com/reference/androidx/media3/extractor/text/SubtitleParser.Factory` to use for parsing subtitles during extraction. |

### Inherited Constants

From [androidx.media3.exoplayer.hls.HlsExtractorFactory](https://developer.android.com/reference/androidx/media3/exoplayer/hls/HlsExtractorFactory) `static final https://developer.android.com/reference/androidx/media3/exoplayer/hls/HlsExtractorFactory` `https://developer.android.com/reference/androidx/media3/exoplayer/hls/HlsExtractorFactory#DEFAULT()`

**This field is deprecated.**

`HlsExtractorFactory` instances are mutable, so sharing one in a static field is not safe.

<br />

## Public constructors

### DefaultHlsExtractorFactory

```
public DefaultHlsExtractorFactory()
```

Equivalent to `https://developer.android.com/reference/androidx/media3/exoplayer/hls/DefaultHlsExtractorFactory#DefaultHlsExtractorFactory(int,boolean)`

### DefaultHlsExtractorFactory

```
public DefaultHlsExtractorFactory(
    int payloadReaderFactoryFlags,
    boolean exposeCea608WhenMissingDeclarations
)
```

Creates a factory for HLS segment extractors.

| Parameters |
|---|---|
| `int payloadReaderFactoryFlags` | Flags to add when constructing any `https://developer.android.com/reference/androidx/media3/extractor/ts/DefaultTsPayloadReaderFactory` instances. Other flags may be added on top of ` payloadReaderFactoryFlags` when creating `https://developer.android.com/reference/androidx/media3/extractor/ts/DefaultTsPayloadReaderFactory`. |
| `boolean exposeCea608WhenMissingDeclarations` | Whether created `https://developer.android.com/reference/androidx/media3/extractor/ts/TsExtractor` instances should expose a CEA-608 track should the multivariant playlist contain no Closed Captions declarations. If the multivariant playlist contains any Closed Captions declarations, this flag is ignored. |

## Public methods

### createExtractor

```
public BundledHlsMediaChunkExtractor createExtractor(
    Uri uri,
    Format format,
    @Nullable List<Format> muxedCaptionFormats,
    TimestampAdjuster timestampAdjuster,
    Map<String, List<String>> responseHeaders,
    ExtractorInput sniffingExtractorInput,
    PlayerId playerId
)
```

Creates an `https://developer.android.com/reference/androidx/media3/extractor/Extractor` for extracting HLS media chunks.

| Parameters |
|---|---|
| `https://developer.android.com/reference/android/net/Uri.html uri` | The URI of the media chunk. |
| `https://developer.android.com/reference/androidx/media3/common/Format format` | A `https://developer.android.com/reference/androidx/media3/common/Format` associated with the chunk to extract. |
| `@https://developer.android.com/reference/androidx/annotation/Nullable https://developer.android.com/reference/java/util/List.html<https://developer.android.com/reference/androidx/media3/common/Format> muxedCaptionFormats` | List of muxed caption `https://developer.android.com/reference/androidx/media3/common/Format`s. Null if no closed caption information is available in the multivariant playlist. |
| `https://developer.android.com/reference/androidx/media3/common/util/TimestampAdjuster timestampAdjuster` | Adjuster corresponding to the provided discontinuity sequence number. |
| `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 HTTP response headers associated with the media segment or initialization section to extract. |
| `https://developer.android.com/reference/androidx/media3/extractor/ExtractorInput sniffingExtractorInput` | The first extractor input that will be passed to the returned extractor's `https://developer.android.com/reference/androidx/media3/extractor/Extractor#read(androidx.media3.extractor.ExtractorInput,androidx.media3.extractor.PositionHolder)`. Must only be used to call `https://developer.android.com/reference/androidx/media3/extractor/Extractor#sniff(androidx.media3.extractor.ExtractorInput)`. |
| `https://developer.android.com/reference/androidx/media3/exoplayer/analytics/PlayerId playerId` | The `https://developer.android.com/reference/androidx/media3/exoplayer/analytics/PlayerId` of the player using this extractors factory. |

| Returns |
|---|---|
| `https://developer.android.com/reference/androidx/media3/exoplayer/hls/BundledHlsMediaChunkExtractor` | An `https://developer.android.com/reference/androidx/media3/exoplayer/hls/HlsMediaChunkExtractor`. |

| Throws |
|---|---|
| `https://developer.android.com/reference/java/io/IOException.html` | If an I/O error is encountered while sniffing. |

### experimentalParseSubtitlesDuringExtraction

```
@CanIgnoreReturnValue
public DefaultHlsExtractorFactory experimentalParseSubtitlesDuringExtraction(
    boolean parseSubtitlesDuringExtraction
)
```

Sets whether subtitles should be parsed as part of extraction (before being added to the sample queue) or as part of rendering (when being taken from the sample queue). Defaults to `
false` (i.e. subtitles will be parsed as part of rendering).

This method is experimental and will be renamed or removed in a future release.

| Parameters |
|---|---|
| `boolean parseSubtitlesDuringExtraction` | Whether to parse subtitles during extraction or rendering. |

| Returns |
|---|---|
| `https://developer.android.com/reference/androidx/media3/exoplayer/hls/DefaultHlsExtractorFactory` | This factory, for convenience. |

### getOutputTextFormat

```
public Format getOutputTextFormat(Format sourceFormat)
```

Returns the output of emitted C#TRACK_TYPE_TEXT text samples which were originally in sourceFormat}.

In many cases, where an emits samples from the source without mutation, this method simply returns sourceFormat}. In other cases, such as an that transcodes subtitles from the sourceFormat} to \* MimeTypes#APPLICATION_MEDIA3_CUES, the format is updated to indicate the transcoding that is taking place.

Non-text source formats are always returned without mutation.

This implementation performs transcoding of the original format to `https://developer.android.com/reference/androidx/media3/common/MimeTypes#APPLICATION_MEDIA3_CUES()` if it is supported by `https://developer.android.com/reference/androidx/media3/extractor/text/SubtitleParser.Factory`.

To modify the support behavior, you can `https://developer.android.com/reference/androidx/media3/exoplayer/hls/DefaultHlsExtractorFactory#setSubtitleParserFactory(androidx.media3.extractor.text.SubtitleParser.Factory)`.

### setSubtitleParserFactory

```
@CanIgnoreReturnValue
public DefaultHlsExtractorFactory setSubtitleParserFactory(SubtitleParser.Factory subtitleParserFactory)
```

Sets the `https://developer.android.com/reference/androidx/media3/extractor/text/SubtitleParser.Factory` to use for parsing subtitles during extraction. The default factory value is implementation dependent.

| Parameters |
|---|---|
| `https://developer.android.com/reference/androidx/media3/extractor/text/SubtitleParser.Factory subtitleParserFactory` | The `https://developer.android.com/reference/androidx/media3/extractor/text/SubtitleParser.Factory` for parsing subtitles during extraction. |

| Returns |
|---|---|
| `https://developer.android.com/reference/androidx/media3/exoplayer/hls/DefaultHlsExtractorFactory` | This factory, for convenience. |