# CmcdData.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/upstream/CmcdData.java+class:androidx.media3.exoplayer.upstream.CmcdData.Factory)

*** ** * ** ***


```
class CmcdData.Factory
```

<br />

*** ** * ** ***

`https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/upstream/CmcdData.Factory` for `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/upstream/CmcdData` instances.

## Summary

| ### Public constructors |
|---|
| `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/upstream/CmcdData.Factory#Factory(androidx.media3.exoplayer.upstream.CmcdConfiguration,java.lang.String)( cmcdConfiguration: https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/upstream/CmcdConfiguration!, @https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/upstream/CmcdData.StreamingFormat streamingFormat: @https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/upstream/CmcdData.StreamingFormat https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html! )` Creates an instance. |

| ### Public functions |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/upstream/CmcdData!` | `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/upstream/CmcdData.Factory#createCmcdData()()` Creates a `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/upstream/CmcdData` instance. |
| `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/upstream/CmcdData.Factory!` | `@https://checkerframework.org/api/com/google/errorprone/annotations/CanIgnoreReturnValue.html https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/upstream/CmcdData.Factory#setBufferedDurationUs(long)(bufferedDurationUs: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html)` Sets the duration of media currently buffered from the current playback position, in microseconds. |
| `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/upstream/CmcdData.Factory!` | `@https://checkerframework.org/api/com/google/errorprone/annotations/CanIgnoreReturnValue.html https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/upstream/CmcdData.Factory#setChunkDurationUs(long)(chunkDurationUs: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html)` Sets the duration of current media chunk being requested, in microseconds. |
| `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/upstream/CmcdData.Factory!` | `@https://checkerframework.org/api/com/google/errorprone/annotations/CanIgnoreReturnValue.html https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/upstream/CmcdData.Factory#setDidRebuffer(boolean)(didRebuffer: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html)` Sets whether a rebuffering event occurred between the previous request and this one. |
| `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/upstream/CmcdData.Factory!` | `@https://checkerframework.org/api/com/google/errorprone/annotations/CanIgnoreReturnValue.html https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/upstream/CmcdData.Factory#setIsBufferEmpty(boolean)(isBufferEmpty: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html)` Sets whether the queue of buffered chunks is empty. |
| `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/upstream/CmcdData.Factory!` | `@https://checkerframework.org/api/com/google/errorprone/annotations/CanIgnoreReturnValue.html https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/upstream/CmcdData.Factory#setIsLive(boolean)(isLive: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html)` Sets whether the media content is being streamed live. |
| `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/upstream/CmcdData.Factory!` | `@https://checkerframework.org/api/com/google/errorprone/annotations/CanIgnoreReturnValue.html https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/upstream/CmcdData.Factory#setNextObjectRequest(java.lang.String)(nextObjectRequest: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html?)` Sets the relative path of the next object to be requested. |
| `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/upstream/CmcdData.Factory!` | `@https://checkerframework.org/api/com/google/errorprone/annotations/CanIgnoreReturnValue.html https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/upstream/CmcdData.Factory#setNextRangeRequest(java.lang.String)(nextRangeRequest: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html?)` Sets the byte range representing the partial object request. |
| `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/upstream/CmcdData.Factory!` | `@https://checkerframework.org/api/com/google/errorprone/annotations/CanIgnoreReturnValue.html https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/upstream/CmcdData.Factory#setObjectType(java.lang.String)(@https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/upstream/CmcdData.ObjectType objectType: @https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/upstream/CmcdData.ObjectType https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html?)` Sets the object type of the current object being requested. |
| `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/upstream/CmcdData.Factory!` | `@https://checkerframework.org/api/com/google/errorprone/annotations/CanIgnoreReturnValue.html https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/upstream/CmcdData.Factory#setPlaybackRate(float)(playbackRate: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html)` Sets the playback rate indicating the current speed of playback. |
| `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/upstream/CmcdData.Factory!` | `@https://checkerframework.org/api/com/google/errorprone/annotations/CanIgnoreReturnValue.html https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/upstream/CmcdData.Factory#setTrackSelection(androidx.media3.exoplayer.trackselection.ExoTrackSelection)(trackSelection: https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/trackselection/ExoTrackSelection!)` Sets the `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/trackselection/ExoTrackSelection` for the media being played. |

## Public constructors

### Factory

```
Factory(
    cmcdConfiguration: CmcdConfiguration!,
    @CmcdData.StreamingFormat streamingFormat: @CmcdData.StreamingFormat String!
)
```

Creates an instance.

| Parameters |
|---|---|
| `cmcdConfiguration: https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/upstream/CmcdConfiguration!` | The `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/upstream/CmcdConfiguration` for this source. |
| `@https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/upstream/CmcdData.StreamingFormat streamingFormat: @https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/upstream/CmcdData.StreamingFormat https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html!` | The streaming format of the media content. |

## Public functions

### createCmcdData

```
fun createCmcdData(): CmcdData!
```

Creates a `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/upstream/CmcdData` instance.

| Throws |
|---|---|
| `https://developer.android.com/reference/java/lang/IllegalStateException.html` | If any required parameters have not been set. |

### setBufferedDurationUs

```
@CanIgnoreReturnValue
fun setBufferedDurationUs(bufferedDurationUs: Long): CmcdData.Factory!
```

Sets the duration of media currently buffered from the current playback position, in microseconds.

Must be set to a non-negative value if the `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/upstream/CmcdData.Factory#setObjectType(java.lang.String)` is set and one of `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/upstream/CmcdData#OBJECT_TYPE_AUDIO_ONLY()`, `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/upstream/CmcdData#OBJECT_TYPE_VIDEO_ONLY()` or `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/upstream/CmcdData#OBJECT_TYPE_MUXED_AUDIO_AND_VIDEO()`.

Default value is `https://developer.android.com/reference/kotlin/androidx/media3/common/C#TIME_UNSET()`.

| Throws |
|---|---|
| `https://developer.android.com/reference/java/lang/IllegalArgumentException.html` | If `bufferedDurationUs` is negative. |

### setChunkDurationUs

```
@CanIgnoreReturnValue
fun setChunkDurationUs(chunkDurationUs: Long): CmcdData.Factory!
```

Sets the duration of current media chunk being requested, in microseconds.

Must be set to a non-negative value if the `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/upstream/CmcdData.Factory#setObjectType(java.lang.String)` is set and one of `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/upstream/CmcdData#OBJECT_TYPE_AUDIO_ONLY()`, `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/upstream/CmcdData#OBJECT_TYPE_VIDEO_ONLY()` or `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/upstream/CmcdData#OBJECT_TYPE_MUXED_AUDIO_AND_VIDEO()`.

Default value is `https://developer.android.com/reference/kotlin/androidx/media3/common/C#TIME_UNSET()`.

| Throws |
|---|---|
| `https://developer.android.com/reference/java/lang/IllegalArgumentException.html` | If `chunkDurationUs` is negative. |

### setDidRebuffer

```
@CanIgnoreReturnValue
fun setDidRebuffer(didRebuffer: Boolean): CmcdData.Factory!
```

Sets whether a rebuffering event occurred between the previous request and this one.

Default value is `false`.

### setIsBufferEmpty

```
@CanIgnoreReturnValue
fun setIsBufferEmpty(isBufferEmpty: Boolean): CmcdData.Factory!
```

Sets whether the queue of buffered chunks is empty.

Default value is `false`.

### setIsLive

```
@CanIgnoreReturnValue
fun setIsLive(isLive: Boolean): CmcdData.Factory!
```

Sets whether the media content is being streamed live.

Default value is `false`.

### setNextObjectRequest

```
@CanIgnoreReturnValue
fun setNextObjectRequest(nextObjectRequest: String?): CmcdData.Factory!
```

Sets the relative path of the next object to be requested. This can be used to trigger pre-fetching by the CDN.

Default is `null`.

### setNextRangeRequest

```
@CanIgnoreReturnValue
fun setNextRangeRequest(nextRangeRequest: String?): CmcdData.Factory!
```

Sets the byte range representing the partial object request. This can be used to trigger pre-fetching by the CDN.

Default is `null`.

### setObjectType

```
@CanIgnoreReturnValue
fun setObjectType(@CmcdData.ObjectType objectType: @CmcdData.ObjectType String?): CmcdData.Factory!
```

Sets the object type of the current object being requested.

Must be set if `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/upstream/CmcdData.Factory#setTrackSelection(androidx.media3.exoplayer.trackselection.ExoTrackSelection)` is not provided. If unset and a `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/upstream/CmcdData.Factory#setTrackSelection(androidx.media3.exoplayer.trackselection.ExoTrackSelection)` is provided, the object type is derived from it.

Default is `null`.

### setPlaybackRate

```
@CanIgnoreReturnValue
fun setPlaybackRate(playbackRate: Float): CmcdData.Factory!
```

Sets the playback rate indicating the current speed of playback.

Default value is `https://developer.android.com/reference/kotlin/androidx/media3/common/C#RATE_UNSET()`.

| Throws |
|---|---|
| `https://developer.android.com/reference/java/lang/IllegalArgumentException.html` | If `playbackRate` is non-positive and not `https://developer.android.com/reference/kotlin/androidx/media3/common/C#RATE_UNSET()`. |

### setTrackSelection

```
@CanIgnoreReturnValue
fun setTrackSelection(trackSelection: ExoTrackSelection!): CmcdData.Factory!
```

Sets the `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/trackselection/ExoTrackSelection` for the media being played.

Must be set to a non-null value if the `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/upstream/CmcdData.Factory#setObjectType(java.lang.String)` is not `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/upstream/CmcdData#OBJECT_TYPE_MANIFEST()`

Default is `null`.