# DefaultMediaSourceFactory

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

*** ** * ** ***


```
class DefaultMediaSourceFactory : MediaSourceFactory
```

<br />

*** ** * ** ***

The default `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/source/MediaSource.Factory` implementation.

This implementation delegates calls to `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/source/DefaultMediaSourceFactory#createMediaSource(androidx.media3.common.MediaItem)` to the following factories:

- `DashMediaSource.Factory` if the item's `https://developer.android.com/reference/kotlin/androidx/media3/common/MediaItem.LocalConfiguration#uri()` ends in '.mpd' or if its `https://developer.android.com/reference/kotlin/androidx/media3/common/MediaItem.LocalConfiguration#mimeType()` is explicitly set to `https://developer.android.com/reference/kotlin/androidx/media3/common/MimeTypes#APPLICATION_MPD()` (Requires the [exoplayer-dash module to be added](https://developer.android.com/media/media3/exoplayer/hello-world#add-exoplayer-modules) to the app).
- `HlsMediaSource.Factory` if the item's `https://developer.android.com/reference/kotlin/androidx/media3/common/MediaItem.LocalConfiguration#uri()` ends in '.m3u8' or if its `https://developer.android.com/reference/kotlin/androidx/media3/common/MediaItem.LocalConfiguration#mimeType()` is explicitly set to `https://developer.android.com/reference/kotlin/androidx/media3/common/MimeTypes#APPLICATION_M3U8()` (Requires the [exoplayer-hls module to be added](https://developer.android.com/media/media3/exoplayer/hello-world#add-exoplayer-modules) to the app).
- `SsMediaSource.Factory` if the item's `https://developer.android.com/reference/kotlin/androidx/media3/common/MediaItem.LocalConfiguration#uri()` ends in '.ism', '.ism/Manifest' or if its `https://developer.android.com/reference/kotlin/androidx/media3/common/MediaItem.LocalConfiguration#mimeType()` is explicitly set to `https://developer.android.com/reference/kotlin/androidx/media3/common/MimeTypes#APPLICATION_SS()` (Requires the [exoplayer-smoothstreaming module to be added](https://developer.android.com/media/media3/exoplayer/hello-world#add-exoplayer-modules) to the app).
- `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/source/ProgressiveMediaSource.Factory` serves as a fallback if the item's `https://developer.android.com/reference/kotlin/androidx/media3/common/MediaItem.LocalConfiguration#uri()` doesn't match one of the above. It tries to infer the required extractor by using the `https://developer.android.com/reference/kotlin/androidx/media3/extractor/DefaultExtractorsFactory` or the `https://developer.android.com/reference/kotlin/androidx/media3/extractor/ExtractorsFactory` provided in the constructor. An `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/source/UnrecognizedInputFormatException` is thrown if none of the available extractors can read the stream.

## Ad support for media items with ad tag URIs

To support media items with `https://developer.android.com/reference/kotlin/androidx/media3/common/MediaItem.LocalConfiguration#adsConfiguration()`, `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/source/DefaultMediaSourceFactory#setAdsLoaderProvider(androidx.media3.exoplayer.source.ads.AdsLoader.Provider)` and `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/source/DefaultMediaSourceFactory#setAdViewProvider(androidx.media3.common.AdViewProvider)` need to be called to configure the factory with the required providers.

## Summary

| ### Nested types |
|---|
| `@https://developer.android.com/reference/kotlin/androidx/media3/common/util/UnstableApi interface https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/source/DefaultMediaSourceFactory.AdsLoaderProvider : https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/source/ads/AdsLoader.Provider` **This interface is deprecated.** Use `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/source/ads/AdsLoader.Provider` instead. <br /> |

| ### Public constructors |
|---|
| `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/source/DefaultMediaSourceFactory#DefaultMediaSourceFactory(android.content.Context)(context: https://developer.android.com/reference/android/content/Context.html!)` Creates a new instance. |
| `@https://developer.android.com/reference/kotlin/androidx/media3/common/util/UnstableApi https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/source/DefaultMediaSourceFactory#DefaultMediaSourceFactory(androidx.media3.datasource.DataSource.Factory)(dataSourceFactory: https://developer.android.com/reference/kotlin/androidx/media3/datasource/DataSource.Factory!)` Creates a new instance. |
| `@https://developer.android.com/reference/kotlin/androidx/media3/common/util/UnstableApi https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/source/DefaultMediaSourceFactory#DefaultMediaSourceFactory(android.content.Context,androidx.media3.extractor.ExtractorsFactory)( context: https://developer.android.com/reference/android/content/Context.html!, extractorsFactory: https://developer.android.com/reference/kotlin/androidx/media3/extractor/ExtractorsFactory! )` Creates a new instance. |
| `@https://developer.android.com/reference/kotlin/androidx/media3/common/util/UnstableApi https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/source/DefaultMediaSourceFactory#DefaultMediaSourceFactory(androidx.media3.datasource.DataSource.Factory,androidx.media3.extractor.ExtractorsFactory)( dataSourceFactory: https://developer.android.com/reference/kotlin/androidx/media3/datasource/DataSource.Factory!, extractorsFactory: https://developer.android.com/reference/kotlin/androidx/media3/extractor/ExtractorsFactory! )` Creates a new instance. |
| `@https://developer.android.com/reference/kotlin/androidx/media3/common/util/UnstableApi https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/source/DefaultMediaSourceFactory#DefaultMediaSourceFactory(androidx.media3.datasource.DataSource.Factory,androidx.media3.extractor.ExtractorsFactory,androidx.media3.extractor.text.SubtitleParser.Factory)( dataSourceFactory: https://developer.android.com/reference/kotlin/androidx/media3/datasource/DataSource.Factory!, extractorsFactory: https://developer.android.com/reference/kotlin/androidx/media3/extractor/ExtractorsFactory!, subtitleParserFactory: https://developer.android.com/reference/kotlin/androidx/media3/extractor/text/SubtitleParser.Factory! )` Creates a new instance. |

| ### Public functions |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/source/DefaultMediaSourceFactory!` | `@https://checkerframework.org/api/com/google/errorprone/annotations/CanIgnoreReturnValue.html https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/source/DefaultMediaSourceFactory#clearLocalAdInsertionComponents()()` Clear any values set via `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/source/DefaultMediaSourceFactory#setLocalAdInsertionComponents(androidx.media3.exoplayer.source.ads.AdsLoader.Provider,androidx.media3.common.AdViewProvider)`. |
| `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/source/MediaSource!` | `@https://developer.android.com/reference/kotlin/androidx/media3/common/util/UnstableApi https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/source/DefaultMediaSourceFactory#createMediaSource(androidx.media3.common.MediaItem)(mediaItem: https://developer.android.com/reference/kotlin/androidx/media3/common/MediaItem!)` Creates a new `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/source/MediaSource` with the specified `https://developer.android.com/reference/kotlin/androidx/media3/common/MediaItem`. |
| `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/source/DefaultMediaSourceFactory!` | `@https://checkerframework.org/api/com/google/errorprone/annotations/CanIgnoreReturnValue.html @https://developer.android.com/reference/kotlin/androidx/media3/common/util/UnstableApi [experimentalParseSubtitlesDuringExtraction](https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/source/DefaultMediaSourceFactory#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/util/UnstableApi @https://developer.android.com/reference/kotlin/androidx/media3/common/C.ContentType https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/source/DefaultMediaSourceFactory#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/source/DefaultMediaSourceFactory!` | `@https://checkerframework.org/api/com/google/errorprone/annotations/CanIgnoreReturnValue.html @https://developer.android.com/reference/kotlin/androidx/media3/common/util/UnstableApi [setAdViewProvider](https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/source/DefaultMediaSourceFactory#setAdViewProvider(androidx.media3.common.AdViewProvider))(adViewProvider: https://developer.android.com/reference/kotlin/androidx/media3/common/AdViewProvider?)` **This function is deprecated.** Use `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/source/DefaultMediaSourceFactory#setLocalAdInsertionComponents(androidx.media3.exoplayer.source.ads.AdsLoader.Provider,androidx.media3.common.AdViewProvider)` instead. <br /> |
| `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/source/DefaultMediaSourceFactory!` | `@https://checkerframework.org/api/com/google/errorprone/annotations/CanIgnoreReturnValue.html @https://developer.android.com/reference/kotlin/androidx/media3/common/util/UnstableApi [setAdsLoaderProvider](https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/source/DefaultMediaSourceFactory#setAdsLoaderProvider(androidx.media3.exoplayer.source.ads.AdsLoader.Provider))(adsLoaderProvider: https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/source/ads/AdsLoader.Provider?)` **This function is deprecated.** Use `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/source/DefaultMediaSourceFactory#setLocalAdInsertionComponents(androidx.media3.exoplayer.source.ads.AdsLoader.Provider,androidx.media3.common.AdViewProvider)` instead. <br /> |
| `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/source/DefaultMediaSourceFactory!` | `@https://checkerframework.org/api/com/google/errorprone/annotations/CanIgnoreReturnValue.html @https://developer.android.com/reference/kotlin/androidx/media3/common/util/UnstableApi https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/source/DefaultMediaSourceFactory#setAlwaysWrapInClippingMediaSource(boolean)( alwaysWrapInClippingMediaSource: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html )` Sets whether to always wrap created media sources in a `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/source/ClippingMediaSource`, even when the `https://developer.android.com/reference/kotlin/androidx/media3/common/MediaItem` has no clipping configuration. |
| `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/source/DefaultMediaSourceFactory!` | `@https://checkerframework.org/api/com/google/errorprone/annotations/CanIgnoreReturnValue.html @https://developer.android.com/reference/kotlin/androidx/media3/common/util/UnstableApi https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/source/DefaultMediaSourceFactory#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/source/DefaultMediaSourceFactory!` | `@https://checkerframework.org/api/com/google/errorprone/annotations/CanIgnoreReturnValue.html https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/source/DefaultMediaSourceFactory#setDataSourceFactory(androidx.media3.datasource.DataSource.Factory)(dataSourceFactory: https://developer.android.com/reference/kotlin/androidx/media3/datasource/DataSource.Factory!)` Sets the `https://developer.android.com/reference/kotlin/androidx/media3/datasource/DataSource.Factory` used to create `https://developer.android.com/reference/kotlin/androidx/media3/datasource/DataSource` instances for requesting media data. |
| `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/source/MediaSource.Factory!` | `@https://developer.android.com/reference/kotlin/androidx/media3/common/util/UnstableApi @https://checkerframework.org/api/com/google/errorprone/annotations/CanIgnoreReturnValue.html https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/source/DefaultMediaSourceFactory#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/source/DefaultMediaSourceFactory!` | `@https://checkerframework.org/api/com/google/errorprone/annotations/CanIgnoreReturnValue.html @https://developer.android.com/reference/kotlin/androidx/media3/common/util/UnstableApi https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/source/DefaultMediaSourceFactory#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/source/DefaultMediaSourceFactory!` | `@https://developer.android.com/reference/kotlin/androidx/media3/common/util/ExperimentalApi @https://checkerframework.org/api/com/google/errorprone/annotations/CanIgnoreReturnValue.html https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/source/DefaultMediaSourceFactory#setEnableClippingInMediaPeriod(boolean)(enableClippingInMediaPeriod: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html)` Sets whether to delegate end-position clipping to `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/source/MediaPeriod` instances. |
| `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/source/DefaultMediaSourceFactory!` | `@https://checkerframework.org/api/com/google/errorprone/annotations/CanIgnoreReturnValue.html @https://developer.android.com/reference/kotlin/androidx/media3/common/util/UnstableApi https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/source/DefaultMediaSourceFactory#setExternalImageLoader(androidx.media3.exoplayer.source.ExternalLoader)(externalImageLoader: https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/source/ExternalLoader?)` Sets the `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/source/ExternalLoader` to be called when loading starts in `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/source/ExternallyLoadedMediaSource` when loading images in an external Image Management Framework (for example, Glide). |
| `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/source/DefaultMediaSourceFactory!` | `@https://checkerframework.org/api/com/google/errorprone/annotations/CanIgnoreReturnValue.html @https://developer.android.com/reference/kotlin/androidx/media3/common/util/UnstableApi https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/source/DefaultMediaSourceFactory#setLiveMaxOffsetMs(long)(liveMaxOffsetMs: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html)` Sets the maximum offset from the live edge for live streams, in milliseconds. |
| `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/source/DefaultMediaSourceFactory!` | `@https://checkerframework.org/api/com/google/errorprone/annotations/CanIgnoreReturnValue.html @https://developer.android.com/reference/kotlin/androidx/media3/common/util/UnstableApi https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/source/DefaultMediaSourceFactory#setLiveMaxSpeed(float)(maxSpeed: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html)` Sets the maximum playback speed for live streams. |
| `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/source/DefaultMediaSourceFactory!` | `@https://checkerframework.org/api/com/google/errorprone/annotations/CanIgnoreReturnValue.html @https://developer.android.com/reference/kotlin/androidx/media3/common/util/UnstableApi https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/source/DefaultMediaSourceFactory#setLiveMinOffsetMs(long)(liveMinOffsetMs: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html)` Sets the minimum offset from the live edge for live streams, in milliseconds. |
| `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/source/DefaultMediaSourceFactory!` | `@https://checkerframework.org/api/com/google/errorprone/annotations/CanIgnoreReturnValue.html @https://developer.android.com/reference/kotlin/androidx/media3/common/util/UnstableApi https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/source/DefaultMediaSourceFactory#setLiveMinSpeed(float)(minSpeed: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html)` Sets the minimum playback speed for live streams. |
| `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/source/DefaultMediaSourceFactory!` | `@https://checkerframework.org/api/com/google/errorprone/annotations/CanIgnoreReturnValue.html @https://developer.android.com/reference/kotlin/androidx/media3/common/util/UnstableApi https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/source/DefaultMediaSourceFactory#setLiveTargetOffsetMs(long)(liveTargetOffsetMs: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html)` Sets the target live offset for live streams, in milliseconds. |
| `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/source/DefaultMediaSourceFactory!` | `@https://checkerframework.org/api/com/google/errorprone/annotations/CanIgnoreReturnValue.html @https://developer.android.com/reference/kotlin/androidx/media3/common/util/UnstableApi https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/source/DefaultMediaSourceFactory#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/source/DefaultMediaSourceFactory!` | `@https://checkerframework.org/api/com/google/errorprone/annotations/CanIgnoreReturnValue.html @https://developer.android.com/reference/kotlin/androidx/media3/common/util/UnstableApi https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/source/DefaultMediaSourceFactory#setLoadOnlySelectedTracks(boolean)(loadOnlySelectedTracks: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html)` Sets whether to load only the video and image tracks selected by the track selection policy. |
| `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/source/DefaultMediaSourceFactory!` | `@https://checkerframework.org/api/com/google/errorprone/annotations/CanIgnoreReturnValue.html https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/source/DefaultMediaSourceFactory#setLocalAdInsertionComponents(androidx.media3.exoplayer.source.ads.AdsLoader.Provider,androidx.media3.common.AdViewProvider)( adsLoaderProvider: https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/source/ads/AdsLoader.Provider!, adViewProvider: https://developer.android.com/reference/kotlin/androidx/media3/common/AdViewProvider! )` Sets the components required for local ad insertion for media items that have `https://developer.android.com/reference/kotlin/androidx/media3/common/MediaItem.LocalConfiguration#adsConfiguration()` |
| `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/source/DefaultMediaSourceFactory!` | `@https://checkerframework.org/api/com/google/errorprone/annotations/CanIgnoreReturnValue.html https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/source/DefaultMediaSourceFactory#setServerSideAdInsertionMediaSourceFactory(androidx.media3.exoplayer.source.MediaSource.Factory)( serverSideAdInsertionMediaSourceFactory: https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/source/MediaSource.Factory? )` Sets the `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/source/MediaSource.Factory` used to handle `https://developer.android.com/reference/kotlin/androidx/media3/common/MediaItem` instances containing a `https://developer.android.com/reference/android/net/Uri.html` identified as resolving to content with server side ad insertion (SSAI). |
| `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/source/DefaultMediaSourceFactory!` | `@https://checkerframework.org/api/com/google/errorprone/annotations/CanIgnoreReturnValue.html @https://developer.android.com/reference/kotlin/androidx/media3/common/util/UnstableApi https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/source/DefaultMediaSourceFactory#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. |

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

### DefaultMediaSourceFactory

```
DefaultMediaSourceFactory(context: Context!)
```

Creates a new instance.

| Parameters |
|---|---|
| `context: https://developer.android.com/reference/android/content/Context.html!` | Any context. |

### DefaultMediaSourceFactory

```
@UnstableApi
DefaultMediaSourceFactory(dataSourceFactory: DataSource.Factory!)
```

Creates a new instance.

Note that this constructor is only useful to try and ensure that ExoPlayer's `https://developer.android.com/reference/kotlin/androidx/media3/datasource/DefaultDataSource.Factory` can be removed by ProGuard or R8.

| Parameters |
|---|---|
| `dataSourceFactory: https://developer.android.com/reference/kotlin/androidx/media3/datasource/DataSource.Factory!` | A `https://developer.android.com/reference/kotlin/androidx/media3/datasource/DataSource.Factory` to create `https://developer.android.com/reference/kotlin/androidx/media3/datasource/DataSource` instances for requesting media data. |

### DefaultMediaSourceFactory

```
@UnstableApi
DefaultMediaSourceFactory(
    context: Context!,
    extractorsFactory: ExtractorsFactory!
)
```

Creates a new instance.

Note that this constructor is only useful to try and ensure that ExoPlayer's `https://developer.android.com/reference/kotlin/androidx/media3/extractor/DefaultExtractorsFactory` can be removed by ProGuard or R8.

| Parameters |
|---|---|
| `context: https://developer.android.com/reference/android/content/Context.html!` | Any context. |
| `extractorsFactory: https://developer.android.com/reference/kotlin/androidx/media3/extractor/ExtractorsFactory!` | An `https://developer.android.com/reference/kotlin/androidx/media3/extractor/ExtractorsFactory` used to extract progressive media from its container. |

### DefaultMediaSourceFactory

```
@UnstableApi
DefaultMediaSourceFactory(
    dataSourceFactory: DataSource.Factory!,
    extractorsFactory: ExtractorsFactory!
)
```

Creates a new instance.

Note that this constructor is only useful to try and ensure that ExoPlayer's `https://developer.android.com/reference/kotlin/androidx/media3/datasource/DefaultDataSource.Factory` and `https://developer.android.com/reference/kotlin/androidx/media3/extractor/DefaultExtractorsFactory` can be removed by ProGuard or R8.

| Parameters |
|---|---|
| `dataSourceFactory: https://developer.android.com/reference/kotlin/androidx/media3/datasource/DataSource.Factory!` | A `https://developer.android.com/reference/kotlin/androidx/media3/datasource/DataSource.Factory` to create `https://developer.android.com/reference/kotlin/androidx/media3/datasource/DataSource` instances for requesting media data. |
| `extractorsFactory: https://developer.android.com/reference/kotlin/androidx/media3/extractor/ExtractorsFactory!` | An `https://developer.android.com/reference/kotlin/androidx/media3/extractor/ExtractorsFactory` used to extract progressive media from its container. |

### DefaultMediaSourceFactory

```
@UnstableApi
DefaultMediaSourceFactory(
    dataSourceFactory: DataSource.Factory!,
    extractorsFactory: ExtractorsFactory!,
    subtitleParserFactory: SubtitleParser.Factory!
)
```

Creates a new instance.

Note that this constructor is only useful to try and ensure that ExoPlayer's `https://developer.android.com/reference/kotlin/androidx/media3/datasource/DefaultDataSource.Factory`, `https://developer.android.com/reference/kotlin/androidx/media3/extractor/DefaultExtractorsFactory` and `https://developer.android.com/reference/kotlin/androidx/media3/extractor/text/DefaultSubtitleParserFactory` can be removed by ProGuard or R8.

| Parameters |
|---|---|
| `dataSourceFactory: https://developer.android.com/reference/kotlin/androidx/media3/datasource/DataSource.Factory!` | A `https://developer.android.com/reference/kotlin/androidx/media3/datasource/DataSource.Factory` to create `https://developer.android.com/reference/kotlin/androidx/media3/datasource/DataSource` instances for requesting media data. |
| `extractorsFactory: https://developer.android.com/reference/kotlin/androidx/media3/extractor/ExtractorsFactory!` | An `https://developer.android.com/reference/kotlin/androidx/media3/extractor/ExtractorsFactory` used to extract progressive media from its container. |
| `subtitleParserFactory: https://developer.android.com/reference/kotlin/androidx/media3/extractor/text/SubtitleParser.Factory!` | A `https://developer.android.com/reference/kotlin/androidx/media3/extractor/text/SubtitleParser.Factory` to create `https://developer.android.com/reference/kotlin/androidx/media3/extractor/text/SubtitleParser` instances used to parse subtitles. |

## Public functions

### clearLocalAdInsertionComponents

```
@CanIgnoreReturnValue
fun clearLocalAdInsertionComponents(): DefaultMediaSourceFactory!
```

Clear any values set via `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/source/DefaultMediaSourceFactory#setLocalAdInsertionComponents(androidx.media3.exoplayer.source.ads.AdsLoader.Provider,androidx.media3.common.AdViewProvider)`.

This will also clear any values set by `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/source/DefaultMediaSourceFactory#setAdsLoaderProvider(androidx.media3.exoplayer.source.ads.AdsLoader.Provider)` and `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/source/DefaultMediaSourceFactory#setAdViewProvider(androidx.media3.common.AdViewProvider)`.

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

### createMediaSource

```
@UnstableApi
fun createMediaSource(mediaItem: MediaItem!): MediaSource!
```

Creates a new `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/source/MediaSource` with the specified `https://developer.android.com/reference/kotlin/androidx/media3/common/MediaItem`.

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

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

### experimentalParseSubtitlesDuringExtraction

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

> [!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/source/DefaultMediaSourceFactory!` | This factory, for convenience. |

### getSupportedTypes

```
@UnstableApi
@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.

### setAdViewProvider

```
@CanIgnoreReturnValue
@UnstableApi
fun [setAdViewProvider](https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/source/DefaultMediaSourceFactory#setAdViewProvider(androidx.media3.common.AdViewProvider))(adViewProvider: AdViewProvider?): DefaultMediaSourceFactory!
```

> [!CAUTION]
> **This function is deprecated.**   
>
> Use `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/source/DefaultMediaSourceFactory#setLocalAdInsertionComponents(androidx.media3.exoplayer.source.ads.AdsLoader.Provider,androidx.media3.common.AdViewProvider)` instead.

Sets the `https://developer.android.com/reference/kotlin/androidx/media3/common/AdViewProvider` that provides information about views for the ad playback UI.

This will override or clear the `https://developer.android.com/reference/kotlin/androidx/media3/common/AdViewProvider` set by `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/source/DefaultMediaSourceFactory#setLocalAdInsertionComponents(androidx.media3.exoplayer.source.ads.AdsLoader.Provider,androidx.media3.common.AdViewProvider)`.

| Parameters |
|---|---|
| `adViewProvider: https://developer.android.com/reference/kotlin/androidx/media3/common/AdViewProvider?` | A provider for information about views for the ad playback UI. |

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

### setAdsLoaderProvider

```
@CanIgnoreReturnValue
@UnstableApi
fun [setAdsLoaderProvider](https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/source/DefaultMediaSourceFactory#setAdsLoaderProvider(androidx.media3.exoplayer.source.ads.AdsLoader.Provider))(adsLoaderProvider: AdsLoader.Provider?): DefaultMediaSourceFactory!
```

> [!CAUTION]
> **This function is deprecated.**   
>
> Use `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/source/DefaultMediaSourceFactory#setLocalAdInsertionComponents(androidx.media3.exoplayer.source.ads.AdsLoader.Provider,androidx.media3.common.AdViewProvider)` instead.

Sets the `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/source/ads/AdsLoader.Provider` that provides `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/source/ads/AdsLoader` instances for media items that have `https://developer.android.com/reference/kotlin/androidx/media3/common/MediaItem.LocalConfiguration#adsConfiguration()`.

This will override or clear the `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/source/ads/AdsLoader.Provider` set by `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/source/DefaultMediaSourceFactory#setLocalAdInsertionComponents(androidx.media3.exoplayer.source.ads.AdsLoader.Provider,androidx.media3.common.AdViewProvider)`.

| Parameters |
|---|---|
| `adsLoaderProvider: https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/source/ads/AdsLoader.Provider?` | A provider for `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/source/ads/AdsLoader` instances. |

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

### setAlwaysWrapInClippingMediaSource

```
@CanIgnoreReturnValue
@UnstableApi
fun setAlwaysWrapInClippingMediaSource(
    alwaysWrapInClippingMediaSource: Boolean
): DefaultMediaSourceFactory!
```

Sets whether to always wrap created media sources in a `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/source/ClippingMediaSource`, even when the `https://developer.android.com/reference/kotlin/androidx/media3/common/MediaItem` has no clipping configuration.

By default a `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/source/ClippingMediaSource` is only added when `https://developer.android.com/reference/kotlin/androidx/media3/common/MediaItem#clippingConfiguration()` is non-trivial. This means an item that starts unclipped has no `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/source/ClippingMediaSource` in its source structure, and a later `https://developer.android.com/reference/kotlin/androidx/media3/common/Player#replaceMediaItem(int,androidx.media3.common.MediaItem)` that adds a clipping configuration is silently ignored, because the existing media source reports that it can be updated in place. Enabling this ensures the wrapper is always present, so clipping configuration changes take effect. To apply them without re-preparing the media source, also enable `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/source/DefaultMediaSourceFactory#setEnableClippingInMediaPeriod(boolean)`.

This applies to all media sources created by this factory, except for items with `https://developer.android.com/reference/kotlin/androidx/media3/common/C#SSAI_SCHEME()` URIs, which are never clipped.

**Note:** `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/source/ClippingMediaSource` only supports single-period content, so enabling this makes playback of multi-period content fail, even if it isn't clipped.

The default value is `false`.

| Parameters |
|---|---|
| `alwaysWrapInClippingMediaSource: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | Whether to always wrap created media sources in a `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/source/ClippingMediaSource`. |

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

### setCmcdConfigurationFactory

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

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

### setDataSourceFactory

```
@CanIgnoreReturnValue
fun setDataSourceFactory(dataSourceFactory: DataSource.Factory!): DefaultMediaSourceFactory!
```

Sets the `https://developer.android.com/reference/kotlin/androidx/media3/datasource/DataSource.Factory` used to create `https://developer.android.com/reference/kotlin/androidx/media3/datasource/DataSource` instances for requesting media data.

| Parameters |
|---|---|
| `dataSourceFactory: https://developer.android.com/reference/kotlin/androidx/media3/datasource/DataSource.Factory!` | The `https://developer.android.com/reference/kotlin/androidx/media3/datasource/DataSource.Factory`. |

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

### setDownloadExecutor

```
@UnstableApi
@CanIgnoreReturnValue
fun setDownloadExecutor(downloadExecutor: Supplier<ReleasableExecutor!>!): MediaSource.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/source/MediaSource.Factory!` | This factory, for convenience. |

### setDrmSessionManagerProvider

```
@CanIgnoreReturnValue
@UnstableApi
fun setDrmSessionManagerProvider(
    drmSessionManagerProvider: DrmSessionManagerProvider!
): DefaultMediaSourceFactory!
```

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

### setEnableClippingInMediaPeriod

```
@ExperimentalApi
@CanIgnoreReturnValue
fun setEnableClippingInMediaPeriod(enableClippingInMediaPeriod: Boolean): DefaultMediaSourceFactory!
```

Sets whether to delegate end-position clipping to `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/source/MediaPeriod` instances.

The default value is determined by `https://developer.android.com/reference/kotlin/androidx/media3/common/Flags#FLAG_ENABLE_CLIPPING_IN_MEDIA_PERIOD()`.

| Parameters |
|---|---|
| `enableClippingInMediaPeriod: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | Whether to delegate end-position clipping to `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/source/MediaPeriod` instances. |

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

### setExternalImageLoader

```
@CanIgnoreReturnValue
@UnstableApi
fun setExternalImageLoader(externalImageLoader: ExternalLoader?): DefaultMediaSourceFactory!
```

Sets the `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/source/ExternalLoader` to be called when loading starts in `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/source/ExternallyLoadedMediaSource` when loading images in an external Image Management Framework (for example, Glide).

This loader is only used when the `https://developer.android.com/reference/kotlin/androidx/media3/common/MediaItem.LocalConfiguration#mimeType()` is set to `https://developer.android.com/reference/kotlin/androidx/media3/common/MimeTypes#APPLICATION_EXTERNALLY_LOADED_IMAGE()`.

| Parameters |
|---|---|
| `externalImageLoader: https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/source/ExternalLoader?` | The `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/source/ExternalLoader` to load the media or `null` to remove a previously set `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/source/ExternalLoader`. |

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

### setLiveMaxOffsetMs

```
@CanIgnoreReturnValue
@UnstableApi
fun setLiveMaxOffsetMs(liveMaxOffsetMs: Long): DefaultMediaSourceFactory!
```

Sets the maximum offset from the live edge for live streams, in milliseconds.

| Parameters |
|---|---|
| `liveMaxOffsetMs: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html` | The maximum allowed live offset, in milliseconds, or `https://developer.android.com/reference/kotlin/androidx/media3/common/C#TIME_UNSET()` to use the media-defined default. |

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

### setLiveMaxSpeed

```
@CanIgnoreReturnValue
@UnstableApi
fun setLiveMaxSpeed(maxSpeed: Float): DefaultMediaSourceFactory!
```

Sets the maximum playback speed for live streams.

| Parameters |
|---|---|
| `maxSpeed: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html` | The maximum factor by which playback can be sped up for live streams, or `https://developer.android.com/reference/kotlin/androidx/media3/common/C#RATE_UNSET()` to use the media-defined default. |

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

### setLiveMinOffsetMs

```
@CanIgnoreReturnValue
@UnstableApi
fun setLiveMinOffsetMs(liveMinOffsetMs: Long): DefaultMediaSourceFactory!
```

Sets the minimum offset from the live edge for live streams, in milliseconds.

| Parameters |
|---|---|
| `liveMinOffsetMs: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html` | The minimum allowed live offset, in milliseconds, or `https://developer.android.com/reference/kotlin/androidx/media3/common/C#TIME_UNSET()` to use the media-defined default. |

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

### setLiveMinSpeed

```
@CanIgnoreReturnValue
@UnstableApi
fun setLiveMinSpeed(minSpeed: Float): DefaultMediaSourceFactory!
```

Sets the minimum playback speed for live streams.

| Parameters |
|---|---|
| `minSpeed: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html` | The minimum factor by which playback can be sped up for live streams, or `https://developer.android.com/reference/kotlin/androidx/media3/common/C#RATE_UNSET()` to use the media-defined default. |

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

### setLiveTargetOffsetMs

```
@CanIgnoreReturnValue
@UnstableApi
fun setLiveTargetOffsetMs(liveTargetOffsetMs: Long): DefaultMediaSourceFactory!
```

Sets the target live offset for live streams, in milliseconds.

| Parameters |
|---|---|
| `liveTargetOffsetMs: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html` | The target live offset, in milliseconds, or `https://developer.android.com/reference/kotlin/androidx/media3/common/C#TIME_UNSET()` to use the media-defined default. |

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

### setLoadErrorHandlingPolicy

```
@CanIgnoreReturnValue
@UnstableApi
fun setLoadErrorHandlingPolicy(
    loadErrorHandlingPolicy: LoadErrorHandlingPolicy!
): DefaultMediaSourceFactory!
```

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

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

### setLoadOnlySelectedTracks

```
@CanIgnoreReturnValue
@UnstableApi
fun setLoadOnlySelectedTracks(loadOnlySelectedTracks: Boolean): DefaultMediaSourceFactory!
```

Sets whether to load only the video and image tracks selected by the track selection policy.

Audio, text, and metadata tracks are always loaded regardless of track selection, as they have relatively low bitrate and are more likely to be toggled mid-playback (e.g., changing audio languages or subtitle tracks, or disabling audio during scrubbing mode). Always loading them allows seamlessly switching mid-playback without re-buffering or seeking.

Note that while this saves memory, it may cause additional buffering or latency if unselected video or image tracks are enabled mid-playback, as the player may need to perform additional network requests to fetch the newly selected track data.

The default is `true`.

| Parameters |
|---|---|
| `loadOnlySelectedTracks: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | Whether to load only the video and image tracks selected by the track selection policy, instead of loading all tracks. |

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

### setLocalAdInsertionComponents

```
@CanIgnoreReturnValue
fun setLocalAdInsertionComponents(
    adsLoaderProvider: AdsLoader.Provider!,
    adViewProvider: AdViewProvider!
): DefaultMediaSourceFactory!
```

Sets the components required for local ad insertion for media items that have `https://developer.android.com/reference/kotlin/androidx/media3/common/MediaItem.LocalConfiguration#adsConfiguration()`

This will override the values set by `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/source/DefaultMediaSourceFactory#setAdsLoaderProvider(androidx.media3.exoplayer.source.ads.AdsLoader.Provider)` and `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/source/DefaultMediaSourceFactory#setAdViewProvider(androidx.media3.common.AdViewProvider)`.

| Parameters |
|---|---|
| `adsLoaderProvider: https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/source/ads/AdsLoader.Provider!` | A provider for `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/source/ads/AdsLoader` instances. |
| `adViewProvider: https://developer.android.com/reference/kotlin/androidx/media3/common/AdViewProvider!` | A provider for information about views for the ad playback UI. |

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

### setServerSideAdInsertionMediaSourceFactory

```
@CanIgnoreReturnValue
fun setServerSideAdInsertionMediaSourceFactory(
    serverSideAdInsertionMediaSourceFactory: MediaSource.Factory?
): DefaultMediaSourceFactory!
```

Sets the `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/source/MediaSource.Factory` used to handle `https://developer.android.com/reference/kotlin/androidx/media3/common/MediaItem` instances containing a `https://developer.android.com/reference/android/net/Uri.html` identified as resolving to content with server side ad insertion (SSAI).

SSAI URIs are those with a `https://developer.android.com/reference/android/net/Uri.html#getScheme()` of `https://developer.android.com/reference/kotlin/androidx/media3/common/C#SSAI_SCHEME()`.

| Parameters |
|---|---|
| `serverSideAdInsertionMediaSourceFactory: https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/source/MediaSource.Factory?` | The `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/source/MediaSource.Factory` for SSAI content, or `null` to remove a previously set `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/source/MediaSource.Factory`. |

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

### setSubtitleParserFactory

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

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