# ExternallyLoadedMediaSource.Factory

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

*** ** * ** ***


```
class ExternallyLoadedMediaSource.Factory : MediaSource.Factory
```

<br />

*** ** * ** ***

Factory for `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/source/ExternallyLoadedMediaSource`.

## Summary

| ### Public constructors |
|---|
| `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/source/ExternallyLoadedMediaSource.Factory#Factory(long,androidx.media3.exoplayer.source.ExternalLoader)(timelineDurationUs: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html, externalLoader: https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/source/ExternalLoader!)` Creates an instance. |

| ### Public functions |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/source/ExternallyLoadedMediaSource!` | `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/source/ExternallyLoadedMediaSource.Factory#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://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/C.ContentType https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/source/ExternallyLoadedMediaSource.Factory#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/MediaSource.Factory!` | `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/source/ExternallyLoadedMediaSource.Factory#setDrmSessionManagerProvider(androidx.media3.exoplayer.drm.DrmSessionManagerProvider)( drmSessionManagerProvider: https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/drm/DrmSessionManagerProvider! )` Does nothing. |
| `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/source/MediaSource.Factory!` | `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/source/ExternallyLoadedMediaSource.Factory#setLoadErrorHandlingPolicy(androidx.media3.exoplayer.upstream.LoadErrorHandlingPolicy)( loadErrorHandlingPolicy: https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/upstream/LoadErrorHandlingPolicy! )` Does nothing. |

### 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()`.

### Inherited functions

From [androidx.media3.exoplayer.source.MediaSource.Factory](https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/source/MediaSource.Factory) `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/common/util/ExperimentalApi
[experimentalParseSubtitlesDuringExtraction](https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/source/MediaSource.Factory#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://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#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/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/MediaSource.Factory#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/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#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.

## Public constructors

### Factory

```
Factory(timelineDurationUs: Long, externalLoader: ExternalLoader!)
```

Creates an instance.

| Parameters |
|---|---|
| `timelineDurationUs: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html` | The duration of the `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/source/SinglePeriodTimeline` created, in microseconds. |
| `externalLoader: 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 in preparation for playback. |

## Public functions

### createMediaSource

```
fun createMediaSource(mediaItem: MediaItem!): ExternallyLoadedMediaSource!
```

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/ExternallyLoadedMediaSource!` | The new `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/source/MediaSource`. |

### getSupportedTypes

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

### setDrmSessionManagerProvider

```
fun setDrmSessionManagerProvider(
    drmSessionManagerProvider: DrmSessionManagerProvider!
): MediaSource.Factory!
```

Does nothing. `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/source/ExternallyLoadedMediaSource` does not support DRM.

### setLoadErrorHandlingPolicy

```
fun setLoadErrorHandlingPolicy(
    loadErrorHandlingPolicy: LoadErrorHandlingPolicy!
): MediaSource.Factory!
```

Does nothing. `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/source/ExternallyLoadedMediaSource` does not support error handling policies.