# 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)

*** ** * ** ***


```
public final class HlsMediaSource.Factory implements MediaSourceFactory
```

<br />

*** ** * ** ***

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

## Summary

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

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

## Public constructors

### Factory

```
public Factory(DataSource.Factory dataSourceFactory)
```

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

The factory will use the following default components:

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

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

### Factory

```
public Factory(HlsDataSourceFactory hlsDataSourceFactory)
```

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

The factory will use the following default components:

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

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

## Public methods

### createMediaSource

```
public HlsMediaSource createMediaSource(MediaItem mediaItem)
```

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

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

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

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

### experimentalParseSubtitlesDuringExtraction

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

> [!CAUTION]
> **This method 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 |
|---|---|
| `boolean parseSubtitlesDuringExtraction` | Whether to parse subtitles during extraction or rendering. |

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

### getSupportedTypes

```
@C.ContentType
public int[] getSupportedTypes()
```

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

### setAllowChunklessPreparation

```
@CanIgnoreReturnValue
public HlsMediaSource.Factory setAllowChunklessPreparation(boolean allowChunklessPreparation)
```

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 |
|---|---|
| `boolean allowChunklessPreparation` | Whether chunkless preparation is allowed. |

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

### setCmcdConfigurationFactory

```
@CanIgnoreReturnValue
public HlsMediaSource.Factory setCmcdConfigurationFactory(
    CmcdConfiguration.Factory cmcdConfigurationFactory
)
```

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

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

### setCompositeSequenceableLoaderFactory

```
@CanIgnoreReturnValue
public HlsMediaSource.Factory setCompositeSequenceableLoaderFactory(
    CompositeSequenceableLoaderFactory compositeSequenceableLoaderFactory
)
```

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

| Parameters |
|---|---|
| `https://developer.android.com/reference/androidx/media3/exoplayer/source/CompositeSequenceableLoaderFactory compositeSequenceableLoaderFactory` | A factory to create composite `https://developer.android.com/reference/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/androidx/media3/exoplayer/hls/HlsMediaSource.Factory` | This factory, for convenience. |

### setDownloadExecutor

```
@CanIgnoreReturnValue
public HlsMediaSource.Factory setDownloadExecutor(Supplier<ReleasableExecutor> downloadExecutor)
```

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

| Parameters |
|---|---|
| `https://guava.dev/releases/snapshot-android/api/docs/com/google/common/base/Supplier.html<https://developer.android.com/reference/androidx/media3/exoplayer/util/ReleasableExecutor> downloadExecutor` | 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/androidx/media3/exoplayer/util/ReleasableExecutor` for downloading and extraction. |

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

### setDrmSessionManagerProvider

```
@CanIgnoreReturnValue
public HlsMediaSource.Factory setDrmSessionManagerProvider(
    DrmSessionManagerProvider drmSessionManagerProvider
)
```

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

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

### setExtractorFactory

```
@CanIgnoreReturnValue
public HlsMediaSource.Factory setExtractorFactory(@Nullable HlsExtractorFactory extractorFactory)
```

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

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

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

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

### setLoadErrorHandlingPolicy

```
@CanIgnoreReturnValue
public HlsMediaSource.Factory setLoadErrorHandlingPolicy(
    LoadErrorHandlingPolicy loadErrorHandlingPolicy
)
```

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

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

### setMetadataType

```
@CanIgnoreReturnValue
public HlsMediaSource.Factory setMetadataType(@HlsMediaSource.MetadataType int metadataType)
```

Sets the type of metadata to extract from the HLS source (defaults to `https://developer.android.com/reference/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/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/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/androidx/media3/exoplayer/hls/HlsMediaSource.MetadataType int metadataType` | The type of metadata to extract. |

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

### setPlaylistParserFactory

```
@CanIgnoreReturnValue
public HlsMediaSource.Factory setPlaylistParserFactory(
    HlsPlaylistParserFactory playlistParserFactory
)
```

Sets the factory from which playlist parsers will be obtained.

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

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

### setPlaylistTrackerFactory

```
@CanIgnoreReturnValue
public HlsMediaSource.Factory setPlaylistTrackerFactory(
    HlsPlaylistTracker.Factory playlistTrackerFactory
)
```

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

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

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

### setSubtitleParserFactory

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

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

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

### setTimestampAdjusterInitializationTimeoutMs

```
@CanIgnoreReturnValue
public HlsMediaSource.Factory setTimestampAdjusterInitializationTimeoutMs(
    long timestampAdjusterInitializationTimeoutMs
)
```

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 |
|---|---|
| `long timestampAdjusterInitializationTimeoutMs` | The timeout in milliseconds. A timeout of zero is interpreted as an infinite timeout. |

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

### setUseSessionKeys

```
@CanIgnoreReturnValue
public HlsMediaSource.Factory setUseSessionKeys(boolean useSessionKeys)
```

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 |
|---|---|
| `boolean useSessionKeys` | Whether to use #EXT-X-SESSION-KEY tags. |

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