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

*** ** * ** ***


```
public final class DefaultMediaSourceFactory implements MediaSourceFactory
```

<br />

*** ** * ** ***

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

This implementation delegates calls to `https://developer.android.com/reference/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/androidx/media3/common/MediaItem.LocalConfiguration#uri()` ends in '.mpd' or if its `https://developer.android.com/reference/androidx/media3/common/MediaItem.LocalConfiguration#mimeType()` is explicitly set to `https://developer.android.com/reference/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/androidx/media3/common/MediaItem.LocalConfiguration#uri()` ends in '.m3u8' or if its `https://developer.android.com/reference/androidx/media3/common/MediaItem.LocalConfiguration#mimeType()` is explicitly set to `https://developer.android.com/reference/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/androidx/media3/common/MediaItem.LocalConfiguration#uri()` ends in '.ism', '.ism/Manifest' or if its `https://developer.android.com/reference/androidx/media3/common/MediaItem.LocalConfiguration#mimeType()` is explicitly set to `https://developer.android.com/reference/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/androidx/media3/exoplayer/source/ProgressiveMediaSource.Factory` serves as a fallback if the item's `https://developer.android.com/reference/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/androidx/media3/extractor/DefaultExtractorsFactory` or the `https://developer.android.com/reference/androidx/media3/extractor/ExtractorsFactory` provided in the constructor. An `https://developer.android.com/reference/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/androidx/media3/common/MediaItem.LocalConfiguration#adsConfiguration()`, `https://developer.android.com/reference/androidx/media3/exoplayer/source/DefaultMediaSourceFactory#setAdsLoaderProvider(androidx.media3.exoplayer.source.ads.AdsLoader.Provider)` and `https://developer.android.com/reference/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/androidx/media3/common/util/UnstableApi public interface https://developer.android.com/reference/androidx/media3/exoplayer/source/DefaultMediaSourceFactory.AdsLoaderProvider extends https://developer.android.com/reference/androidx/media3/exoplayer/source/ads/AdsLoader.Provider` **This interface is deprecated.** Use `https://developer.android.com/reference/androidx/media3/exoplayer/source/ads/AdsLoader.Provider` instead. <br /> |

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

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

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

### DefaultMediaSourceFactory

```
public DefaultMediaSourceFactory(Context context)
```

Creates a new instance.

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

### DefaultMediaSourceFactory

```
@UnstableApi
public DefaultMediaSourceFactory(DataSource.Factory dataSourceFactory)
```

Creates a new instance.

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

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

### DefaultMediaSourceFactory

```
@UnstableApi
public 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/androidx/media3/extractor/DefaultExtractorsFactory` can be removed by ProGuard or R8.

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

### DefaultMediaSourceFactory

```
@UnstableApi
public DefaultMediaSourceFactory(
    DataSource.Factory dataSourceFactory,
    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/androidx/media3/datasource/DefaultDataSource.Factory` and `https://developer.android.com/reference/androidx/media3/extractor/DefaultExtractorsFactory` can be removed by ProGuard or R8.

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

### DefaultMediaSourceFactory

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

Creates a new instance.

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

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

## Public methods

### clearLocalAdInsertionComponents

```
@CanIgnoreReturnValue
public DefaultMediaSourceFactory clearLocalAdInsertionComponents()
```

Clear any values set via `https://developer.android.com/reference/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/androidx/media3/exoplayer/source/DefaultMediaSourceFactory#setAdsLoaderProvider(androidx.media3.exoplayer.source.ads.AdsLoader.Provider)` and `https://developer.android.com/reference/androidx/media3/exoplayer/source/DefaultMediaSourceFactory#setAdViewProvider(androidx.media3.common.AdViewProvider)`.

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

### createMediaSource

```
@UnstableApi
public MediaSource createMediaSource(MediaItem mediaItem)
```

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

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

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

### experimentalParseSubtitlesDuringExtraction

```
@CanIgnoreReturnValue
@UnstableApi
public DefaultMediaSourceFactory [experimentalParseSubtitlesDuringExtraction](https://developer.android.com/reference/androidx/media3/exoplayer/source/DefaultMediaSourceFactory#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/source/DefaultMediaSourceFactory` | This factory, for convenience. |

### getSupportedTypes

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

### setAdViewProvider

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

> [!CAUTION]
> **This method is deprecated.**   
>
> Use `https://developer.android.com/reference/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/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/androidx/media3/common/AdViewProvider` set by `https://developer.android.com/reference/androidx/media3/exoplayer/source/DefaultMediaSourceFactory#setLocalAdInsertionComponents(androidx.media3.exoplayer.source.ads.AdsLoader.Provider,androidx.media3.common.AdViewProvider)`.

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

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

### setAdsLoaderProvider

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

> [!CAUTION]
> **This method is deprecated.**   
>
> Use `https://developer.android.com/reference/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/androidx/media3/exoplayer/source/ads/AdsLoader.Provider` that provides `https://developer.android.com/reference/androidx/media3/exoplayer/source/ads/AdsLoader` instances for media items that have `https://developer.android.com/reference/androidx/media3/common/MediaItem.LocalConfiguration#adsConfiguration()`.

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

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

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

### setAlwaysWrapInClippingMediaSource

```
@CanIgnoreReturnValue
@UnstableApi
public DefaultMediaSourceFactory setAlwaysWrapInClippingMediaSource(
    boolean alwaysWrapInClippingMediaSource
)
```

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

By default a `https://developer.android.com/reference/androidx/media3/exoplayer/source/ClippingMediaSource` is only added when `https://developer.android.com/reference/androidx/media3/common/MediaItem#clippingConfiguration()` is non-trivial. This means an item that starts unclipped has no `https://developer.android.com/reference/androidx/media3/exoplayer/source/ClippingMediaSource` in its source structure, and a later `https://developer.android.com/reference/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/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/androidx/media3/common/C#SSAI_SCHEME()` URIs, which are never clipped.

**Note:** `https://developer.android.com/reference/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 |
|---|---|
| `boolean alwaysWrapInClippingMediaSource` | Whether to always wrap created media sources in a `https://developer.android.com/reference/androidx/media3/exoplayer/source/ClippingMediaSource`. |

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

### setCmcdConfigurationFactory

```
@CanIgnoreReturnValue
@UnstableApi
public DefaultMediaSourceFactory 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/source/DefaultMediaSourceFactory` | This factory, for convenience. |

### setDataSourceFactory

```
@CanIgnoreReturnValue
public DefaultMediaSourceFactory setDataSourceFactory(DataSource.Factory dataSourceFactory)
```

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

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

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

### setDownloadExecutor

```
@UnstableApi
@CanIgnoreReturnValue
public MediaSource.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/source/MediaSource.Factory` | This factory, for convenience. |

### setDrmSessionManagerProvider

```
@CanIgnoreReturnValue
@UnstableApi
public DefaultMediaSourceFactory 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/source/DefaultMediaSourceFactory` | This factory, for convenience. |

### setEnableClippingInMediaPeriod

```
@ExperimentalApi
@CanIgnoreReturnValue
public DefaultMediaSourceFactory setEnableClippingInMediaPeriod(boolean enableClippingInMediaPeriod)
```

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

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

| Parameters |
|---|---|
| `boolean enableClippingInMediaPeriod` | Whether to delegate end-position clipping to `https://developer.android.com/reference/androidx/media3/exoplayer/source/MediaPeriod` instances. |

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

### setExternalImageLoader

```
@CanIgnoreReturnValue
@UnstableApi
public DefaultMediaSourceFactory setExternalImageLoader(@Nullable ExternalLoader externalImageLoader)
```

Sets the `https://developer.android.com/reference/androidx/media3/exoplayer/source/ExternalLoader` to be called when loading starts in `https://developer.android.com/reference/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/androidx/media3/common/MediaItem.LocalConfiguration#mimeType()` is set to `https://developer.android.com/reference/androidx/media3/common/MimeTypes#APPLICATION_EXTERNALLY_LOADED_IMAGE()`.

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

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

### setLiveMaxOffsetMs

```
@CanIgnoreReturnValue
@UnstableApi
public DefaultMediaSourceFactory setLiveMaxOffsetMs(long liveMaxOffsetMs)
```

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

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

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

### setLiveMaxSpeed

```
@CanIgnoreReturnValue
@UnstableApi
public DefaultMediaSourceFactory setLiveMaxSpeed(float maxSpeed)
```

Sets the maximum playback speed for live streams.

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

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

### setLiveMinOffsetMs

```
@CanIgnoreReturnValue
@UnstableApi
public DefaultMediaSourceFactory setLiveMinOffsetMs(long liveMinOffsetMs)
```

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

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

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

### setLiveMinSpeed

```
@CanIgnoreReturnValue
@UnstableApi
public DefaultMediaSourceFactory setLiveMinSpeed(float minSpeed)
```

Sets the minimum playback speed for live streams.

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

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

### setLiveTargetOffsetMs

```
@CanIgnoreReturnValue
@UnstableApi
public DefaultMediaSourceFactory setLiveTargetOffsetMs(long liveTargetOffsetMs)
```

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

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

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

### setLoadErrorHandlingPolicy

```
@CanIgnoreReturnValue
@UnstableApi
public DefaultMediaSourceFactory 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/source/DefaultMediaSourceFactory` | This factory, for convenience. |

### setLoadOnlySelectedTracks

```
@CanIgnoreReturnValue
@UnstableApi
public DefaultMediaSourceFactory setLoadOnlySelectedTracks(boolean loadOnlySelectedTracks)
```

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 |
|---|---|
| `boolean loadOnlySelectedTracks` | 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/androidx/media3/exoplayer/source/DefaultMediaSourceFactory` | This factory, for convenience. |

### setLocalAdInsertionComponents

```
@CanIgnoreReturnValue
public DefaultMediaSourceFactory setLocalAdInsertionComponents(
    AdsLoader.Provider adsLoaderProvider,
    AdViewProvider adViewProvider
)
```

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

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

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

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

### setServerSideAdInsertionMediaSourceFactory

```
@CanIgnoreReturnValue
public DefaultMediaSourceFactory setServerSideAdInsertionMediaSourceFactory(
    @Nullable MediaSource.Factory serverSideAdInsertionMediaSourceFactory
)
```

Sets the `https://developer.android.com/reference/androidx/media3/exoplayer/source/MediaSource.Factory` used to handle `https://developer.android.com/reference/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/androidx/media3/common/C#SSAI_SCHEME()`.

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

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

### setSubtitleParserFactory

```
@CanIgnoreReturnValue
@UnstableApi
public DefaultMediaSourceFactory 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/source/DefaultMediaSourceFactory` | This factory, for convenience. |