# HlsMediaSource.Factory

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

*** ** * ** ***


```
class HlsMediaSource.Factory : MediaSourceFactory
```

<br />

*** ** * ** ***

Factory for `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/hls/HlsMediaSource`s.

## Summary

| ### Public constructors |
|---|
| `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/hls/HlsMediaSource.Factory#Factory(androidx.media3.datasource.DataSource.Factory)(dataSourceFactory: https://developer.android.com/reference/kotlin/androidx/media3/datasource/DataSource.Factory!)` Creates a new factory for `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/hls/HlsMediaSource`s. |
| `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/hls/HlsMediaSource.Factory#Factory(androidx.media3.exoplayer.hls.HlsDataSourceFactory)(hlsDataSourceFactory: https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/hls/HlsDataSourceFactory!)` Creates a new factory for `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/hls/HlsMediaSource`s. |

| ### Public functions |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/hls/HlsMediaSource!` | `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/hls/HlsMediaSource.Factory#createMediaSource(androidx.media3.common.MediaItem)(mediaItem: https://developer.android.com/reference/kotlin/androidx/media3/common/MediaItem!)` Returns a new `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/hls/HlsMediaSource` using the current parameters. |
| `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/hls/HlsMediaSource.Factory!` | `@https://checkerframework.org/api/com/google/errorprone/annotations/CanIgnoreReturnValue.html [experimentalParseSubtitlesDuringExtraction](https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/hls/HlsMediaSource.Factory#experimentalParseSubtitlesDuringExtraction(boolean))( parseSubtitlesDuringExtraction: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html )` **This function is deprecated.** This method (and all support for 'legacy' subtitle decoding during rendering) will be removed in a future release. <br /> |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-array/index.html<https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html>!` | `@https://developer.android.com/reference/kotlin/androidx/media3/common/C.ContentType https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/hls/HlsMediaSource.Factory#getSupportedTypes()()` Returns the `https://developer.android.com/reference/kotlin/androidx/media3/common/C.ContentType` supported by media sources created by this factory. |
| `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/hls/HlsMediaSource.Factory!` | `@https://checkerframework.org/api/com/google/errorprone/annotations/CanIgnoreReturnValue.html https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/hls/HlsMediaSource.Factory#setAllowChunklessPreparation(boolean)(allowChunklessPreparation: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html)` Sets whether chunkless preparation is allowed. |
| `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/hls/HlsMediaSource.Factory!` | `@https://checkerframework.org/api/com/google/errorprone/annotations/CanIgnoreReturnValue.html https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/hls/HlsMediaSource.Factory#setCmcdConfigurationFactory(androidx.media3.exoplayer.upstream.CmcdConfiguration.Factory)( cmcdConfigurationFactory: https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/upstream/CmcdConfiguration.Factory! )` Sets the `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/upstream/CmcdConfiguration.Factory` used to obtain a `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/upstream/CmcdConfiguration` for a `https://developer.android.com/reference/kotlin/androidx/media3/common/MediaItem`. |
| `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/hls/HlsMediaSource.Factory!` | `@https://checkerframework.org/api/com/google/errorprone/annotations/CanIgnoreReturnValue.html https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/hls/HlsMediaSource.Factory#setCompositeSequenceableLoaderFactory(androidx.media3.exoplayer.source.CompositeSequenceableLoaderFactory)( compositeSequenceableLoaderFactory: https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/source/CompositeSequenceableLoaderFactory! )` Sets the factory to create composite `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/source/SequenceableLoader`s for when this media source loads data from multiple streams (video, audio etc...). |
| `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/hls/HlsMediaSource.Factory!` | `@https://checkerframework.org/api/com/google/errorprone/annotations/CanIgnoreReturnValue.html https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/hls/HlsMediaSource.Factory#setDownloadExecutor(com.google.common.base.Supplier<androidx.media3.exoplayer.util.ReleasableExecutor>)(downloadExecutor: https://guava.dev/releases/snapshot-android/api/docs/com/google/common/base/Supplier.html<https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/util/ReleasableExecutor!>!)` Sets a supplier for an `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/util/ReleasableExecutor` that is used for loading the media. |
| `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/hls/HlsMediaSource.Factory!` | `@https://checkerframework.org/api/com/google/errorprone/annotations/CanIgnoreReturnValue.html https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/hls/HlsMediaSource.Factory#setDrmSessionManagerProvider(androidx.media3.exoplayer.drm.DrmSessionManagerProvider)( drmSessionManagerProvider: https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/drm/DrmSessionManagerProvider! )` Sets the `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/drm/DrmSessionManagerProvider` used to obtain a `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/drm/DrmSessionManager` for a `https://developer.android.com/reference/kotlin/androidx/media3/common/MediaItem`. |
| `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/hls/HlsMediaSource.Factory!` | `@https://checkerframework.org/api/com/google/errorprone/annotations/CanIgnoreReturnValue.html https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/hls/HlsMediaSource.Factory#setExtractorFactory(androidx.media3.exoplayer.hls.HlsExtractorFactory)(extractorFactory: https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/hls/HlsExtractorFactory?)` Sets the factory for `https://developer.android.com/reference/kotlin/androidx/media3/extractor/Extractor`s for the segments. |
| `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/hls/HlsMediaSource.Factory!` | `@https://checkerframework.org/api/com/google/errorprone/annotations/CanIgnoreReturnValue.html https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/hls/HlsMediaSource.Factory#setLoadErrorHandlingPolicy(androidx.media3.exoplayer.upstream.LoadErrorHandlingPolicy)( loadErrorHandlingPolicy: https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/upstream/LoadErrorHandlingPolicy! )` Sets an optional `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/upstream/LoadErrorHandlingPolicy`. |
| `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/hls/HlsMediaSource.Factory!` | `@https://checkerframework.org/api/com/google/errorprone/annotations/CanIgnoreReturnValue.html https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/hls/HlsMediaSource.Factory#setMetadataType(int)(@https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/hls/HlsMediaSource.MetadataType metadataType: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)` Sets the type of metadata to extract from the HLS source (defaults to `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/hls/HlsMediaSource#METADATA_TYPE_ID3()`). |
| `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/hls/HlsMediaSource.Factory!` | `@https://checkerframework.org/api/com/google/errorprone/annotations/CanIgnoreReturnValue.html https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/hls/HlsMediaSource.Factory#setPlaylistParserFactory(androidx.media3.exoplayer.hls.playlist.HlsPlaylistParserFactory)( playlistParserFactory: https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/hls/playlist/HlsPlaylistParserFactory! )` Sets the factory from which playlist parsers will be obtained. |
| `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/hls/HlsMediaSource.Factory!` | `@https://checkerframework.org/api/com/google/errorprone/annotations/CanIgnoreReturnValue.html https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/hls/HlsMediaSource.Factory#setPlaylistTrackerFactory(androidx.media3.exoplayer.hls.playlist.HlsPlaylistTracker.Factory)( playlistTrackerFactory: https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/hls/playlist/HlsPlaylistTracker.Factory! )` Sets the `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/hls/playlist/HlsPlaylistTracker` factory. |
| `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/hls/HlsMediaSource.Factory!` | `@https://checkerframework.org/api/com/google/errorprone/annotations/CanIgnoreReturnValue.html https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/hls/HlsMediaSource.Factory#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 be used for parsing subtitles during extraction. |
| `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/hls/HlsMediaSource.Factory!` | `@https://checkerframework.org/api/com/google/errorprone/annotations/CanIgnoreReturnValue.html https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/hls/HlsMediaSource.Factory#setTimestampAdjusterInitializationTimeoutMs(long)( timestampAdjusterInitializationTimeoutMs: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html )` Sets the timeout for the loading thread to wait for the timestamp adjuster to initialize, in milliseconds.The default value is zero, which is interpreted as an infinite timeout. |
| `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/hls/HlsMediaSource.Factory!` | `@https://checkerframework.org/api/com/google/errorprone/annotations/CanIgnoreReturnValue.html https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/hls/HlsMediaSource.Factory#setUseSessionKeys(boolean)(useSessionKeys: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html)` Sets whether to use #EXT-X-SESSION-KEY tags provided in the multivariant playlist. |

### Inherited Constants

From [androidx.media3.exoplayer.source.MediaSource.Factory](https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/source/MediaSource.Factory) `const https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/source/MediaSource.Factory!` `@https://developer.android.com/reference/kotlin/androidx/media3/common/util/UnstableApi
https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/source/MediaSource.Factory#UNSUPPORTED()`

An instance that throws `https://developer.android.com/reference/java/lang/UnsupportedOperationException.html` from `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/source/MediaSource.Factory#createMediaSource(androidx.media3.common.MediaItem)` and `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/source/MediaSource.Factory#getSupportedTypes()`.
From [androidx.media3.exoplayer.source.MediaSourceFactory](https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/source/MediaSourceFactory) `const https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/source/MediaSourceFactory!` `@https://developer.android.com/reference/kotlin/androidx/media3/common/util/UnstableApi
https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/source/MediaSourceFactory#UNSUPPORTED()`

An instance that throws `https://developer.android.com/reference/java/lang/UnsupportedOperationException.html` from `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/source/MediaSource.Factory#createMediaSource(androidx.media3.common.MediaItem)` and `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/source/MediaSource.Factory#getSupportedTypes()`.

## Public constructors

### Factory

```
Factory(dataSourceFactory: DataSource.Factory!)
```

Creates a new factory for `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/hls/HlsMediaSource`s.

The factory will use the following default components:

- `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/drm/DefaultDrmSessionManagerProvider`
- `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/hls/playlist/DefaultHlsPlaylistParserFactory`
- `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/hls/playlist/DefaultHlsPlaylistTracker#FACTORY()`
- `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/hls/DefaultHlsExtractorFactory`
- `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/upstream/DefaultLoadErrorHandlingPolicy`
- `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/source/DefaultCompositeSequenceableLoaderFactory`

| Parameters |
|---|---|
| `dataSourceFactory: https://developer.android.com/reference/kotlin/androidx/media3/datasource/DataSource.Factory!` | A data source factory that will be wrapped by a `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/hls/DefaultHlsDataSourceFactory` to create `https://developer.android.com/reference/kotlin/androidx/media3/datasource/DataSource`s for manifests, segments and keys. |

### Factory

```
Factory(hlsDataSourceFactory: HlsDataSourceFactory!)
```

Creates a new factory for `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/hls/HlsMediaSource`s.

The factory will use the following default components:

- `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/drm/DefaultDrmSessionManagerProvider`
- `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/hls/playlist/DefaultHlsPlaylistParserFactory`
- `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/hls/playlist/DefaultHlsPlaylistTracker#FACTORY()`
- `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/hls/DefaultHlsExtractorFactory`
- `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/upstream/DefaultLoadErrorHandlingPolicy`
- `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/source/DefaultCompositeSequenceableLoaderFactory`

| Parameters |
|---|---|
| `hlsDataSourceFactory: https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/hls/HlsDataSourceFactory!` | An `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/hls/HlsDataSourceFactory` for `https://developer.android.com/reference/kotlin/androidx/media3/datasource/DataSource`s for manifests, segments and keys. |

## Public functions

### createMediaSource

```
fun createMediaSource(mediaItem: MediaItem!): HlsMediaSource!
```

Returns a new `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/hls/HlsMediaSource` using the current parameters.

| Parameters |
|---|---|
| `mediaItem: https://developer.android.com/reference/kotlin/androidx/media3/common/MediaItem!` | The `https://developer.android.com/reference/kotlin/androidx/media3/common/MediaItem`. |

| Returns |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/hls/HlsMediaSource!` | The new `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/hls/HlsMediaSource`. |

| Throws |
|---|---|
| `https://developer.android.com/reference/java/lang/NullPointerException.html` | if `https://developer.android.com/reference/kotlin/androidx/media3/common/MediaItem#localConfiguration()` is `null`. |

### experimentalParseSubtitlesDuringExtraction

```
@CanIgnoreReturnValue
fun [experimentalParseSubtitlesDuringExtraction](https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/hls/HlsMediaSource.Factory#experimentalParseSubtitlesDuringExtraction(boolean))(
    parseSubtitlesDuringExtraction: Boolean
): HlsMediaSource.Factory!
```

> [!CAUTION]
> **This function is deprecated.**   
>
> This method (and all support for 'legacy' subtitle decoding during rendering) will be removed in a future release.

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 `true` (i.e. subtitles will be parsed during extraction).

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

### getSupportedTypes

```
@C.ContentType
fun getSupportedTypes(): Array<Int>!
```

Returns the `https://developer.android.com/reference/kotlin/androidx/media3/common/C.ContentType` supported by media sources created by this factory.

### setAllowChunklessPreparation

```
@CanIgnoreReturnValue
fun setAllowChunklessPreparation(allowChunklessPreparation: Boolean): HlsMediaSource.Factory!
```

Sets whether chunkless preparation is allowed. If true, preparation without chunk downloads will be enabled for streams that provide sufficient information in their multivariant playlist.

| Parameters |
|---|---|
| `allowChunklessPreparation: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | Whether chunkless preparation is allowed. |

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

### setCmcdConfigurationFactory

```
@CanIgnoreReturnValue
fun setCmcdConfigurationFactory(
    cmcdConfigurationFactory: CmcdConfiguration.Factory!
): HlsMediaSource.Factory!
```

Sets the `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/upstream/CmcdConfiguration.Factory` used to obtain a `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/upstream/CmcdConfiguration` for a `https://developer.android.com/reference/kotlin/androidx/media3/common/MediaItem`.

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

### setCompositeSequenceableLoaderFactory

```
@CanIgnoreReturnValue
fun setCompositeSequenceableLoaderFactory(
    compositeSequenceableLoaderFactory: CompositeSequenceableLoaderFactory!
): HlsMediaSource.Factory!
```

Sets the factory to create composite `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/source/SequenceableLoader`s for when this media source loads data from multiple streams (video, audio etc...).

| Parameters |
|---|---|
| `compositeSequenceableLoaderFactory: https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/source/CompositeSequenceableLoaderFactory!` | A factory to create composite `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/source/SequenceableLoader`s for when this media source loads data from multiple streams (video, audio etc...). |

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

### setDownloadExecutor

```
@CanIgnoreReturnValue
fun setDownloadExecutor(downloadExecutor: Supplier<ReleasableExecutor!>!): HlsMediaSource.Factory!
```

Sets a supplier for an `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/util/ReleasableExecutor` that is used for loading the media.

| Parameters |
|---|---|
| `downloadExecutor: https://guava.dev/releases/snapshot-android/api/docs/com/google/common/base/Supplier.html<https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/util/ReleasableExecutor!>!` | A `https://guava.dev/releases/snapshot-android/api/docs/com/google/common/base/Supplier.html` that provides an externally managed `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/util/ReleasableExecutor` for downloading and extraction. |

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

### setDrmSessionManagerProvider

```
@CanIgnoreReturnValue
fun setDrmSessionManagerProvider(
    drmSessionManagerProvider: DrmSessionManagerProvider!
): HlsMediaSource.Factory!
```

Sets the `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/drm/DrmSessionManagerProvider` used to obtain a `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/drm/DrmSessionManager` for a `https://developer.android.com/reference/kotlin/androidx/media3/common/MediaItem`.

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

### setExtractorFactory

```
@CanIgnoreReturnValue
fun setExtractorFactory(extractorFactory: HlsExtractorFactory?): HlsMediaSource.Factory!
```

Sets the factory for `https://developer.android.com/reference/kotlin/androidx/media3/extractor/Extractor`s for the segments. The default value is `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/hls/DefaultHlsExtractorFactory`.

Any values passed to `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/hls/HlsMediaSource.Factory#setSubtitleParserFactory(androidx.media3.extractor.text.SubtitleParser.Factory)` or `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/hls/HlsMediaSource.Factory#experimentalParseSubtitlesDuringExtraction(boolean)` will be forwarded to the provided `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/hls/HlsExtractorFactory` instance during `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/hls/HlsMediaSource.Factory#createMediaSource(androidx.media3.common.MediaItem)`.

| Parameters |
|---|---|
| `extractorFactory: https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/hls/HlsExtractorFactory?` | An `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/hls/HlsExtractorFactory` for `https://developer.android.com/reference/kotlin/androidx/media3/extractor/Extractor`s for the segments. |

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

### setLoadErrorHandlingPolicy

```
@CanIgnoreReturnValue
fun setLoadErrorHandlingPolicy(
    loadErrorHandlingPolicy: LoadErrorHandlingPolicy!
): HlsMediaSource.Factory!
```

Sets an optional `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/upstream/LoadErrorHandlingPolicy`.

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

### setMetadataType

```
@CanIgnoreReturnValue
fun setMetadataType(@HlsMediaSource.MetadataType metadataType: Int): HlsMediaSource.Factory!
```

Sets the type of metadata to extract from the HLS source (defaults to `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/hls/HlsMediaSource#METADATA_TYPE_ID3()`).

HLS supports in-band ID3 in both TS and fMP4 streams, but in the fMP4 case the data is wrapped in an EMSG box \[[spec](https://aomediacodec.github.io/av1-id3/)\].

If this is set to `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/hls/HlsMediaSource#METADATA_TYPE_ID3()` then raw ID3 metadata of will be extracted from TS sources. From fMP4 streams EMSGs containing metadata of this type (in the variant stream only) will be unwrapped to expose the inner data. All other in-band metadata will be dropped.

If this is set to `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/hls/HlsMediaSource#METADATA_TYPE_EMSG()` then all EMSG data from the fMP4 variant stream will be extracted. No metadata will be extracted from TS streams, since they don't support EMSG.

| Parameters |
|---|---|
| `@https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/hls/HlsMediaSource.MetadataType metadataType: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | The type of metadata to extract. |

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

### setPlaylistParserFactory

```
@CanIgnoreReturnValue
fun setPlaylistParserFactory(
    playlistParserFactory: HlsPlaylistParserFactory!
): HlsMediaSource.Factory!
```

Sets the factory from which playlist parsers will be obtained.

| Parameters |
|---|---|
| `playlistParserFactory: https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/hls/playlist/HlsPlaylistParserFactory!` | An `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/hls/playlist/HlsPlaylistParserFactory`. |

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

### setPlaylistTrackerFactory

```
@CanIgnoreReturnValue
fun setPlaylistTrackerFactory(
    playlistTrackerFactory: HlsPlaylistTracker.Factory!
): HlsMediaSource.Factory!
```

Sets the `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/hls/playlist/HlsPlaylistTracker` factory.

| Parameters |
|---|---|
| `playlistTrackerFactory: https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/hls/playlist/HlsPlaylistTracker.Factory!` | A factory for `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/hls/playlist/HlsPlaylistTracker` instances. |

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

### setSubtitleParserFactory

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

Sets the `https://developer.android.com/reference/kotlin/androidx/media3/extractor/text/SubtitleParser.Factory` to be used for parsing subtitles during extraction.

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

### setTimestampAdjusterInitializationTimeoutMs

```
@CanIgnoreReturnValue
fun setTimestampAdjusterInitializationTimeoutMs(
    timestampAdjusterInitializationTimeoutMs: Long
): HlsMediaSource.Factory!
```

Sets the timeout for the loading thread to wait for the timestamp adjuster to initialize, in milliseconds.The default value is zero, which is interpreted as an infinite timeout.

| Parameters |
|---|---|
| `timestampAdjusterInitializationTimeoutMs: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html` | The timeout in milliseconds. A timeout of zero is interpreted as an infinite timeout. |

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

### setUseSessionKeys

```
@CanIgnoreReturnValue
fun setUseSessionKeys(useSessionKeys: Boolean): HlsMediaSource.Factory!
```

Sets whether to use #EXT-X-SESSION-KEY tags provided in the multivariant playlist. If enabled, it's assumed that any single session key declared in the multivariant playlist can be used to obtain all of the keys required for playback. For media where this is not true, this option should not be enabled.

| Parameters |
|---|---|
| `useSessionKeys: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | Whether to use #EXT-X-SESSION-KEY tags. |

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