# 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
class DefaultHlsExtractorFactory : HlsExtractorFactory
```

<br />

*** ** * ** ***

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

## Summary

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

| ### Public functions |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/hls/BundledHlsMediaChunkExtractor!` | `https://developer.android.com/reference/kotlin/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)( uri: https://developer.android.com/reference/android/net/Uri.html!, format: https://developer.android.com/reference/kotlin/androidx/media3/common/Format!, muxedCaptionFormats: (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://developer.android.com/reference/kotlin/androidx/media3/common/Format!>?, timestampAdjuster: https://developer.android.com/reference/kotlin/androidx/media3/common/util/TimestampAdjuster!, 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!>!>!, sniffingExtractorInput: https://developer.android.com/reference/kotlin/androidx/media3/extractor/ExtractorInput!, playerId: https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/analytics/PlayerId! )` Creates an `https://developer.android.com/reference/kotlin/androidx/media3/extractor/Extractor` for extracting HLS media chunks. |
| `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/hls/DefaultHlsExtractorFactory!` | `@https://checkerframework.org/api/com/google/errorprone/annotations/CanIgnoreReturnValue.html https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/hls/DefaultHlsExtractorFactory#experimentalParseSubtitlesDuringExtraction(boolean)( parseSubtitlesDuringExtraction: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html )` 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/kotlin/androidx/media3/common/Format!` | `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/hls/DefaultHlsExtractorFactory#getOutputTextFormat(androidx.media3.common.Format)(sourceFormat: https://developer.android.com/reference/kotlin/androidx/media3/common/Format!)` Returns the output of emitted C#TRACK_TYPE_TEXT text samples which were originally in sourceFormat}. |
| `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/hls/DefaultHlsExtractorFactory!` | `@https://checkerframework.org/api/com/google/errorprone/annotations/CanIgnoreReturnValue.html https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/hls/DefaultHlsExtractorFactory#setSubtitleParserFactory(androidx.media3.extractor.text.SubtitleParser.Factory)(subtitleParserFactory: https://developer.android.com/reference/kotlin/androidx/media3/extractor/text/SubtitleParser.Factory!)` Sets the `https://developer.android.com/reference/kotlin/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/kotlin/androidx/media3/exoplayer/hls/HlsExtractorFactory) `const https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/hls/HlsExtractorFactory!` `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/hls/HlsExtractorFactory#DEFAULT()`

**This property is deprecated.**

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

<br />

## Public constructors

### DefaultHlsExtractorFactory

```
DefaultHlsExtractorFactory()
```

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

### DefaultHlsExtractorFactory

```
DefaultHlsExtractorFactory(
    payloadReaderFactoryFlags: Int,
    exposeCea608WhenMissingDeclarations: Boolean
)
```

Creates a factory for HLS segment extractors.

| Parameters |
|---|---|
| `payloadReaderFactoryFlags: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | Flags to add when constructing any `https://developer.android.com/reference/kotlin/androidx/media3/extractor/ts/DefaultTsPayloadReaderFactory` instances. Other flags may be added on top of ` payloadReaderFactoryFlags` when creating `https://developer.android.com/reference/kotlin/androidx/media3/extractor/ts/DefaultTsPayloadReaderFactory`. |
| `exposeCea608WhenMissingDeclarations: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | Whether created `https://developer.android.com/reference/kotlin/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 functions

### createExtractor

```
fun createExtractor(
    uri: Uri!,
    format: Format!,
    muxedCaptionFormats: (Mutable)List<Format!>?,
    timestampAdjuster: TimestampAdjuster!,
    responseHeaders: (Mutable)Map<String!, (Mutable)List<String!>!>!,
    sniffingExtractorInput: ExtractorInput!,
    playerId: PlayerId!
): BundledHlsMediaChunkExtractor!
```

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

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

| Returns |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/hls/BundledHlsMediaChunkExtractor!` | An `https://developer.android.com/reference/kotlin/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
fun experimentalParseSubtitlesDuringExtraction(
    parseSubtitlesDuringExtraction: Boolean
): DefaultHlsExtractorFactory!
```

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 |
|---|---|
| `parseSubtitlesDuringExtraction: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | Whether to parse subtitles during extraction or rendering. |

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

### getOutputTextFormat

```
fun getOutputTextFormat(sourceFormat: Format!): Format!
```

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/kotlin/androidx/media3/common/MimeTypes#APPLICATION_MEDIA3_CUES()` if it is supported by `https://developer.android.com/reference/kotlin/androidx/media3/extractor/text/SubtitleParser.Factory`.

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

### setSubtitleParserFactory

```
@CanIgnoreReturnValue
fun setSubtitleParserFactory(subtitleParserFactory: SubtitleParser.Factory!): DefaultHlsExtractorFactory!
```

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

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

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