# DefaultDownloaderFactory

# DefaultDownloaderFactory

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

*** ** * ** ***

Kotlin\|[Java](https://developer.android.com/reference/androidx/media3/exoplayer/offline/DefaultDownloaderFactory "View this page in Java")

<br />

```
@UnstableApi
class DefaultDownloaderFactory : DownloaderFactory
```

<br />

*** ** * ** ***

Default[DownloaderFactory](https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/offline/DownloaderFactory), supporting creation of progressive, DASH, HLS and SmoothStreaming downloaders. Note that for the latter three, the corresponding library module must be built into the application.

## Summary

|                                                                                                                                                                                                                                                                                                                                         ### Public constructors                                                                                                                                                                                                                                                                                                                                         |
|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| ~~[DefaultDownloaderFactory](https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/offline/DefaultDownloaderFactory#DefaultDownloaderFactory(androidx.media3.datasource.cache.CacheDataSource.Factory))~~`(` ` cacheDataSourceFactory: `[CacheDataSource.Factory](https://developer.android.com/reference/kotlin/androidx/media3/datasource/cache/CacheDataSource.Factory)`!` `)` **This function is deprecated.** Use[DefaultDownloaderFactory](https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/offline/DefaultDownloaderFactory#DefaultDownloaderFactory(androidx.media3.datasource.cache.CacheDataSource.Factory,java.util.concurrent.Executor)). <br /> |
| [DefaultDownloaderFactory](https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/offline/DefaultDownloaderFactory#DefaultDownloaderFactory(androidx.media3.datasource.cache.CacheDataSource.Factory,java.util.concurrent.Executor))`(` ` cacheDataSourceFactory: `[CacheDataSource.Factory](https://developer.android.com/reference/kotlin/androidx/media3/datasource/cache/CacheDataSource.Factory)`!,` ` executor: `[Executor](https://developer.android.com/reference/java/util/concurrent/Executor.html)`!` `)` Creates an instance.                                                                                                                                             |

|                                             ### Public functions                                             |
|--------------------------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| [Downloader](https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/offline/Downloader)`!` | [createDownloader](https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/offline/DefaultDownloaderFactory#createDownloader(androidx.media3.exoplayer.offline.DownloadRequest))`(request: `[DownloadRequest](https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/offline/DownloadRequest)`!)` Creates a[Downloader](https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/offline/Downloader)to perform the given[DownloadRequest](https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/offline/DownloadRequest). |

## Public constructors

### DefaultDownloaderFactory

```
[DefaultDownloaderFactory](https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/offline/DefaultDownloaderFactory#DefaultDownloaderFactory(androidx.media3.datasource.cache.CacheDataSource.Factory))(
    cacheDataSourceFactory: CacheDataSource.Factory!
)
```
| **This function is deprecated.**   
|
| Use[DefaultDownloaderFactory](https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/offline/DefaultDownloaderFactory#DefaultDownloaderFactory(androidx.media3.datasource.cache.CacheDataSource.Factory,java.util.concurrent.Executor)).

Creates an instance.  

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

### DefaultDownloaderFactory

```
DefaultDownloaderFactory(
    cacheDataSourceFactory: CacheDataSource.Factory!,
    executor: Executor!
)
```

Creates an instance.  

|                                                                           Parameters                                                                            |
|-----------------------------------------------------------------------------------------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `cacheDataSourceFactory: `[CacheDataSource.Factory](https://developer.android.com/reference/kotlin/androidx/media3/datasource/cache/CacheDataSource.Factory)`!` | A[CacheDataSource.Factory](https://developer.android.com/reference/kotlin/androidx/media3/datasource/cache/CacheDataSource.Factory)for the cache into which downloads will be written.                                                                                                                                                                                                                                      |
| `executor: `[Executor](https://developer.android.com/reference/java/util/concurrent/Executor.html)`!`                                                           | An[Executor](https://developer.android.com/reference/java/util/concurrent/Executor.html)used to download data. Passing`Runnable::run`will cause each download task to download data on its own thread. Passing an[Executor](https://developer.android.com/reference/java/util/concurrent/Executor.html)that uses multiple threads will speed up download tasks that can be split into smaller parts for parallel execution. |

## Public functions

### createDownloader

```
fun createDownloader(request: DownloadRequest!): Downloader!
```

Creates a[Downloader](https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/offline/Downloader)to perform the given[DownloadRequest](https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/offline/DownloadRequest).  

|                                                            Parameters                                                             |
|-----------------------------------------------------------------------------------------------------------------------------------|-----------------------|
| `request: `[DownloadRequest](https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/offline/DownloadRequest)`!` | The download request. |

|                                                   Returns                                                    |
|--------------------------------------------------------------------------------------------------------------|-----------------|
| [Downloader](https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/offline/Downloader)`!` | The downloader. |