# HlsExtractorFactory

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

*** ** * ** ***


```
@UnstableApi
interface HlsExtractorFactory
```

<br />

Known direct subclasses [DefaultHlsExtractorFactory](https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/hls/DefaultHlsExtractorFactory)

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

*** ** * ** ***

Factory for HLS media chunk extractors.

## Summary

| ### Constants |
|---|---|
| `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 functions |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/hls/HlsMediaChunkExtractor!` | `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/hls/HlsExtractorFactory#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/HlsExtractorFactory!` | `@https://checkerframework.org/api/com/google/errorprone/annotations/CanIgnoreReturnValue.html @https://developer.android.com/reference/kotlin/androidx/media3/common/util/ExperimentalApi https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/hls/HlsExtractorFactory#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/HlsExtractorFactory#getOutputTextFormat(androidx.media3.common.Format)(sourceFormat: https://developer.android.com/reference/kotlin/androidx/media3/common/Format!)` Returns the output `https://developer.android.com/reference/kotlin/androidx/media3/common/Format` of emitted `https://developer.android.com/reference/kotlin/androidx/media3/common/C#TRACK_TYPE_TEXT()` which were originally in `sourceFormat`. |
| `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/hls/HlsExtractorFactory!` | `@https://checkerframework.org/api/com/google/errorprone/annotations/CanIgnoreReturnValue.html https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/hls/HlsExtractorFactory#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. |

## Constants

### DEFAULT

```
const val DEFAULT: HlsExtractorFactory!
```

> [!CAUTION]
> **This property is deprecated.**   
>
> `HlsExtractorFactory` instances are mutable, so sharing one in a static field is not safe. Construct a new instance of `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/hls/DefaultHlsExtractorFactory` for each usage instead.

## 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!
): HlsMediaChunkExtractor!
```

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/HlsMediaChunkExtractor!` | 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
@ExperimentalApi
fun experimentalParseSubtitlesDuringExtraction(
    parseSubtitlesDuringExtraction: Boolean
): HlsExtractorFactory!
```

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/HlsExtractorFactory!` | This factory, for convenience. |

### getOutputTextFormat

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

Returns the output `https://developer.android.com/reference/kotlin/androidx/media3/common/Format` of emitted `https://developer.android.com/reference/kotlin/androidx/media3/common/C#TRACK_TYPE_TEXT()` which were originally in `sourceFormat`.

In many cases, where an `https://developer.android.com/reference/kotlin/androidx/media3/extractor/Extractor` emits samples from the source without mutation, this method simply returns `sourceFormat`. In other cases, such as an `https://developer.android.com/reference/kotlin/androidx/media3/extractor/Extractor` that transcodes subtitles from the `sourceFormat` to `https://developer.android.com/reference/kotlin/androidx/media3/common/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.

| Parameters |
|---|---|
| `sourceFormat: https://developer.android.com/reference/kotlin/androidx/media3/common/Format!` | The original text-based format. |

| Returns |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/media3/common/Format!` | The `https://developer.android.com/reference/kotlin/androidx/media3/common/Format` that will be associated with a `https://developer.android.com/reference/kotlin/androidx/media3/common/C#TRACK_TYPE_TEXT()`. |

### setSubtitleParserFactory

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

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/HlsExtractorFactory!` | This factory, for convenience. |