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

*** ** * ** ***


```
class HlsDownloader.Factory : SegmentDownloader.BaseFactory<HlsPlaylist!>
```

<br />

|---|---|---|
| [kotlin.Any](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-any/index.html) |||
| ↳ | [androidx.media3.exoplayer.offline.SegmentDownloader.BaseFactory](https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/offline/SegmentDownloader.BaseFactory)\<[HlsPlaylist](https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/hls/playlist/HlsPlaylist)!\> ||
|   | ↳ | [androidx.media3.exoplayer.hls.offline.HlsDownloader.Factory](https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/hls/offline/HlsDownloader.Factory) |

*** ** * ** ***

A factory for `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/hls/offline/HlsDownloader`.

## Summary

| ### Public constructors |
|---|
| `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/hls/offline/HlsDownloader.Factory#Factory(androidx.media3.datasource.cache.CacheDataSource.Factory)(cacheDataSourceFactory: https://developer.android.com/reference/kotlin/androidx/media3/datasource/cache/CacheDataSource.Factory!)` Creates a factory for `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/hls/offline/HlsDownloader`. |

| ### Public functions |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/hls/offline/HlsDownloader!` | `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/hls/offline/HlsDownloader.Factory#create(androidx.media3.common.MediaItem)(mediaItem: https://developer.android.com/reference/kotlin/androidx/media3/common/MediaItem!)` Creates `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/hls/offline/HlsDownloader`. |
| `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/hls/offline/HlsDownloader.Factory!` | `@https://checkerframework.org/api/com/google/errorprone/annotations/CanIgnoreReturnValue.html https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/hls/offline/HlsDownloader.Factory#setDurationUs(long)(durationUs: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html)` Sets the duration in microseconds from the `startPositionUs` to be downloaded, or `https://developer.android.com/reference/kotlin/androidx/media3/common/C#TIME_UNSET()` if the media should be downloaded to the end. |
| `abstract https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/offline/SegmentDownloaderFactory!` | `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/hls/offline/HlsDownloader.Factory#setDurationUs(long)(durationUs: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html)` Sets the duration in microseconds from the `startPositionUs` to be downloaded, or `https://developer.android.com/reference/kotlin/androidx/media3/common/C#TIME_UNSET()` if the media should be downloaded to the end. |
| `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/hls/offline/HlsDownloader.Factory!` | `@https://checkerframework.org/api/com/google/errorprone/annotations/CanIgnoreReturnValue.html https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/hls/offline/HlsDownloader.Factory#setExecutor(java.util.concurrent.Executor)(executor: https://developer.android.com/reference/java/util/concurrent/Executor.html!)` Sets the `https://developer.android.com/reference/java/util/concurrent/Executor.html` used to make requests for the media being downloaded. |
| `abstract https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/offline/SegmentDownloaderFactory!` | `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/hls/offline/HlsDownloader.Factory#setExecutor(java.util.concurrent.Executor)(executor: https://developer.android.com/reference/java/util/concurrent/Executor.html!)` Sets the `https://developer.android.com/reference/java/util/concurrent/Executor.html` used to make requests for the media being downloaded. |
| `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/hls/offline/HlsDownloader.Factory!` | `@https://checkerframework.org/api/com/google/errorprone/annotations/CanIgnoreReturnValue.html https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/hls/offline/HlsDownloader.Factory#setManifestParser(androidx.media3.exoplayer.hls.playlist.HlsPlaylistParser)(manifestParser: https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/hls/playlist/HlsPlaylistParser!)` Sets a parser for HLS playlists. |
| `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/hls/offline/HlsDownloader.Factory!` | `@https://checkerframework.org/api/com/google/errorprone/annotations/CanIgnoreReturnValue.html https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/hls/offline/HlsDownloader.Factory#setMaxMergedSegmentStartTimeDiffMs(long)( maxMergedSegmentStartTimeDiffMs: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html )` Sets the maximum difference of the start time of two segments, up to which the segments (of the same URI) should be merged into a single download segment, in milliseconds. |
| `abstract https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/offline/SegmentDownloaderFactory!` | `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/hls/offline/HlsDownloader.Factory#setMaxMergedSegmentStartTimeDiffMs(long)( maxMergedSegmentStartTimeDiffMs: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html )` Sets the maximum difference of the start time of two segments, up to which the segments (of the same URI) should be merged into a single download segment, in milliseconds. |
| `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/hls/offline/HlsDownloader.Factory!` | `@https://checkerframework.org/api/com/google/errorprone/annotations/CanIgnoreReturnValue.html https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/hls/offline/HlsDownloader.Factory#setStartPositionUs(long)(startPositionUs: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html)` Sets the start position in microseconds that the download should start from. |
| `abstract https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/offline/SegmentDownloaderFactory!` | `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/hls/offline/HlsDownloader.Factory#setStartPositionUs(long)(startPositionUs: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html)` Sets the start position in microseconds that the download should start from. |

### Inherited properties

From [androidx.media3.exoplayer.offline.SegmentDownloader.BaseFactory](https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/offline/SegmentDownloader.BaseFactory) `https://developer.android.com/reference/kotlin/androidx/media3/datasource/cache/CacheDataSource.Factory!` `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/offline/SegmentDownloader.BaseFactory#cacheDataSourceFactory()` `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html` `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/offline/SegmentDownloader.BaseFactory#durationUs()` `https://developer.android.com/reference/java/util/concurrent/Executor.html!` `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/offline/SegmentDownloader.BaseFactory#executor()` `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/upstream/ParsingLoadable.Parser<M!>!` `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/offline/SegmentDownloader.BaseFactory#manifestParser()` `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html` `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/offline/SegmentDownloader.BaseFactory#maxMergedSegmentStartTimeDiffMs()` `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html` `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/offline/SegmentDownloader.BaseFactory#startPositionUs()`

## Public constructors

### Factory

```
Factory(cacheDataSourceFactory: CacheDataSource.Factory!)
```

Creates a factory for `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/hls/offline/HlsDownloader`.

| Parameters |
|---|---|
| `cacheDataSourceFactory: https://developer.android.com/reference/kotlin/androidx/media3/datasource/cache/CacheDataSource.Factory!` | A `https://developer.android.com/reference/kotlin/androidx/media3/datasource/cache/CacheDataSource.Factory` for the cache into which the download will be written. |

## Public functions

### create

```
fun create(mediaItem: MediaItem!): HlsDownloader!
```

Creates `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/hls/offline/HlsDownloader`.

### setDurationUs

```
@CanIgnoreReturnValue
fun setDurationUs(durationUs: Long): HlsDownloader.Factory!
```

Sets the duration in microseconds from the `startPositionUs` to be downloaded, or `https://developer.android.com/reference/kotlin/androidx/media3/common/C#TIME_UNSET()` if the media should be downloaded to the end.

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

### setDurationUs

```
abstract fun setDurationUs(durationUs: Long): SegmentDownloaderFactory!
```

Sets the duration in microseconds from the `startPositionUs` to be downloaded, or `https://developer.android.com/reference/kotlin/androidx/media3/common/C#TIME_UNSET()` if the media should be downloaded to the end.

### setExecutor

```
@CanIgnoreReturnValue
fun setExecutor(executor: Executor!): HlsDownloader.Factory!
```

Sets the `https://developer.android.com/reference/java/util/concurrent/Executor.html` used to make requests for the media being downloaded. Providing an `https://developer.android.com/reference/java/util/concurrent/Executor.html` that uses multiple threads will speed up the download by allowing parts of it to be executed in parallel.

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

### setExecutor

```
abstract fun setExecutor(executor: Executor!): SegmentDownloaderFactory!
```

Sets the `https://developer.android.com/reference/java/util/concurrent/Executor.html` used to make requests for the media being downloaded. Providing an `https://developer.android.com/reference/java/util/concurrent/Executor.html` that uses multiple threads will speed up the download by allowing parts of it to be executed in parallel.

### setManifestParser

```
@CanIgnoreReturnValue
fun setManifestParser(manifestParser: HlsPlaylistParser!): HlsDownloader.Factory!
```

Sets a parser for HLS playlists.

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

### setMaxMergedSegmentStartTimeDiffMs

```
@CanIgnoreReturnValue
fun setMaxMergedSegmentStartTimeDiffMs(
    maxMergedSegmentStartTimeDiffMs: Long
): HlsDownloader.Factory!
```

Sets the maximum difference of the start time of two segments, up to which the segments (of the same URI) should be merged into a single download segment, in milliseconds.

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

### setMaxMergedSegmentStartTimeDiffMs

```
abstract fun setMaxMergedSegmentStartTimeDiffMs(
    maxMergedSegmentStartTimeDiffMs: Long
): SegmentDownloaderFactory!
```

Sets the maximum difference of the start time of two segments, up to which the segments (of the same URI) should be merged into a single download segment, in milliseconds.

### setStartPositionUs

```
@CanIgnoreReturnValue
fun setStartPositionUs(startPositionUs: Long): HlsDownloader.Factory!
```

Sets the start position in microseconds that the download should start from.

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

### setStartPositionUs

```
abstract fun setStartPositionUs(startPositionUs: Long): SegmentDownloaderFactory!
```

Sets the start position in microseconds that the download should start from.