# SegmentDownloader.BaseFactory

Artifact: [androidx.media3:media3-exoplayer](https://developer.android.com/jetpack/androidx/releases/media3) [View Source](https://cs.android.com/search?q=file:androidx/media3/exoplayer/offline/SegmentDownloader.java+class:androidx.media3.exoplayer.offline.SegmentDownloader.BaseFactory)

*** ** * ** ***


```
protected abstract class SegmentDownloader.BaseFactory<M : FilterableManifest<M!>?>
```

<br />

Known direct subclasses [DashDownloader.Factory](https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/dash/offline/DashDownloader.Factory), [HlsDownloader.Factory](https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/hls/offline/HlsDownloader.Factory), [SsDownloader.Factory](https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/smoothstreaming/offline/SsDownloader.Factory)

|---|---|
| `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/dash/offline/DashDownloader.Factory` | A factory for `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/dash/offline/DashDownloader`. |
| `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`. |
| `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/smoothstreaming/offline/SsDownloader.Factory` | A factory for `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/smoothstreaming/offline/SsDownloader`. |

*** ** * ** ***

A base class of the factory of the concrete extension of `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/offline/SegmentDownloader`.

## Summary

| ### Public constructors |
|---|
| `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/offline/SegmentDownloader.BaseFactory#BaseFactory(androidx.media3.datasource.cache.CacheDataSource.Factory,androidx.media3.exoplayer.upstream.ParsingLoadable.Parser<M>)( cacheDataSourceFactory: https://developer.android.com/reference/kotlin/androidx/media3/datasource/cache/CacheDataSource.Factory!, manifestParser: https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/upstream/ParsingLoadable.Parser<M!>! )` |

| ### Public functions |
|---|---|
| `abstract https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/offline/SegmentDownloader<*>!` | `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/offline/SegmentDownloader.BaseFactory#create(androidx.media3.common.MediaItem)(mediaItem: https://developer.android.com/reference/kotlin/androidx/media3/common/MediaItem!)` Creates the segment downloader. |
| `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/offline/SegmentDownloader.BaseFactory<M!>!` | `@https://checkerframework.org/api/com/google/errorprone/annotations/CanIgnoreReturnValue.html https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/offline/SegmentDownloader.BaseFactory#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/offline/SegmentDownloader.BaseFactory<M!>!` | `@https://checkerframework.org/api/com/google/errorprone/annotations/CanIgnoreReturnValue.html https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/offline/SegmentDownloader.BaseFactory#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/offline/SegmentDownloader.BaseFactory<M!>!` | `@https://checkerframework.org/api/com/google/errorprone/annotations/CanIgnoreReturnValue.html https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/offline/SegmentDownloader.BaseFactory#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/offline/SegmentDownloader.BaseFactory<M!>!` | `@https://checkerframework.org/api/com/google/errorprone/annotations/CanIgnoreReturnValue.html https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/offline/SegmentDownloader.BaseFactory#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. |

| ### Protected properties |
|---|---|
| `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

### BaseFactory

```
BaseFactory(
    cacheDataSourceFactory: CacheDataSource.Factory!,
    manifestParser: ParsingLoadable.Parser<M!>!
)
```

## Public functions

### create

```
abstract fun create(mediaItem: MediaItem!): SegmentDownloader<*>!
```

Creates the segment downloader.

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

### setDurationUs

```
@CanIgnoreReturnValue
fun setDurationUs(durationUs: Long): SegmentDownloader.BaseFactory<M!>!
```

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!): SegmentDownloader.BaseFactory<M!>!
```

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.

### setMaxMergedSegmentStartTimeDiffMs

```
@CanIgnoreReturnValue
fun setMaxMergedSegmentStartTimeDiffMs(
    maxMergedSegmentStartTimeDiffMs: Long
): SegmentDownloader.BaseFactory<M!>!
```

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): SegmentDownloader.BaseFactory<M!>!
```

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

## Protected properties

### cacheDataSourceFactory

```
protected val cacheDataSourceFactory: CacheDataSource.Factory!
```

### durationUs

```
protected val durationUs: Long
```

### executor

```
protected val executor: Executor!
```

### manifestParser

```
protected val manifestParser: ParsingLoadable.Parser<M!>!
```

### maxMergedSegmentStartTimeDiffMs

```
protected val maxMergedSegmentStartTimeDiffMs: Long
```

### startPositionUs

```
protected val startPositionUs: Long
```