# ImaServerSideAdInsertionMediaSource.Factory

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

*** ** * ** ***


```
class ImaServerSideAdInsertionMediaSource.Factory : MediaSource.Factory
```

<br />

*** ** * ** ***

Factory for creating `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/ima/ImaServerSideAdInsertionMediaSource`.

Apps can use the `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/ima/ImaServerSideAdInsertionMediaSource.Factory` to customized the `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/source/DefaultMediaSourceFactory` that is used to build a player:

## Summary

| ### Public constructors |
|---|
| `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/ima/ImaServerSideAdInsertionMediaSource.Factory#Factory(androidx.media3.exoplayer.ima.ImaServerSideAdInsertionMediaSource.AdsLoader,androidx.media3.exoplayer.source.MediaSource.Factory)( adsLoader: https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/ima/ImaServerSideAdInsertionMediaSource.AdsLoader!, contentMediaSourceFactory: https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/source/MediaSource.Factory! )` Creates a new factory for `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/ima/ImaServerSideAdInsertionMediaSource`. |

| ### Public functions |
|---|---|
| `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/ima/ImaServerSideAdInsertionMediaSource.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/util/UnstableApi @https://developer.android.com/reference/kotlin/androidx/media3/common/C.ContentType https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/ima/ImaServerSideAdInsertionMediaSource.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/common/util/UnstableApi @https://checkerframework.org/api/com/google/errorprone/annotations/CanIgnoreReturnValue.html https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/ima/ImaServerSideAdInsertionMediaSource.Factory#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/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/ima/ImaServerSideAdInsertionMediaSource.Factory#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`. |

### 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(
    adsLoader: ImaServerSideAdInsertionMediaSource.AdsLoader!,
    contentMediaSourceFactory: MediaSource.Factory!
)
```

Creates a new factory for `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/ima/ImaServerSideAdInsertionMediaSource`.

| Parameters |
|---|---|
| `adsLoader: https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/ima/ImaServerSideAdInsertionMediaSource.AdsLoader!` | The `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/ima/ImaServerSideAdInsertionMediaSource.AdsLoader`. |
| `contentMediaSourceFactory: https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/source/MediaSource.Factory!` | The content media source factory to create content sources. |

## Public functions

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

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

### setDrmSessionManagerProvider

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

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

### setLoadErrorHandlingPolicy

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

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