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

*** ** * ** ***


```
public final class CmcdData.Factory
```

<br />

*** ** * ** ***

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

## Summary

| ### Public constructors |
|---|
| `https://developer.android.com/reference/androidx/media3/exoplayer/upstream/CmcdData.Factory#Factory(androidx.media3.exoplayer.upstream.CmcdConfiguration,java.lang.String)( https://developer.android.com/reference/androidx/media3/exoplayer/upstream/CmcdConfiguration cmcdConfiguration, @https://developer.android.com/reference/androidx/media3/exoplayer/upstream/CmcdData.StreamingFormat @https://developer.android.com/reference/androidx/media3/exoplayer/upstream/CmcdData.StreamingFormat https://developer.android.com/reference/java/lang/String.html streamingFormat )` Creates an instance. |

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

## Public constructors

### Factory

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

Creates an instance.

| Parameters |
|---|---|
| `https://developer.android.com/reference/androidx/media3/exoplayer/upstream/CmcdConfiguration cmcdConfiguration` | The `https://developer.android.com/reference/androidx/media3/exoplayer/upstream/CmcdConfiguration` for this source. |
| `@https://developer.android.com/reference/androidx/media3/exoplayer/upstream/CmcdData.StreamingFormat @https://developer.android.com/reference/androidx/media3/exoplayer/upstream/CmcdData.StreamingFormat https://developer.android.com/reference/java/lang/String.html streamingFormat` | The streaming format of the media content. |

## Public methods

### createCmcdData

```
public CmcdData createCmcdData()
```

Creates a `https://developer.android.com/reference/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
public CmcdData.Factory setBufferedDurationUs(long bufferedDurationUs)
```

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/androidx/media3/exoplayer/upstream/CmcdData.Factory#setObjectType(java.lang.String)` is set and one of `https://developer.android.com/reference/androidx/media3/exoplayer/upstream/CmcdData#OBJECT_TYPE_AUDIO_ONLY()`, `https://developer.android.com/reference/androidx/media3/exoplayer/upstream/CmcdData#OBJECT_TYPE_VIDEO_ONLY()` or `https://developer.android.com/reference/androidx/media3/exoplayer/upstream/CmcdData#OBJECT_TYPE_MUXED_AUDIO_AND_VIDEO()`.

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

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

### setChunkDurationUs

```
@CanIgnoreReturnValue
public CmcdData.Factory setChunkDurationUs(long chunkDurationUs)
```

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/androidx/media3/exoplayer/upstream/CmcdData.Factory#setObjectType(java.lang.String)` is set and one of `https://developer.android.com/reference/androidx/media3/exoplayer/upstream/CmcdData#OBJECT_TYPE_AUDIO_ONLY()`, `https://developer.android.com/reference/androidx/media3/exoplayer/upstream/CmcdData#OBJECT_TYPE_VIDEO_ONLY()` or `https://developer.android.com/reference/androidx/media3/exoplayer/upstream/CmcdData#OBJECT_TYPE_MUXED_AUDIO_AND_VIDEO()`.

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

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

### setDidRebuffer

```
@CanIgnoreReturnValue
public CmcdData.Factory setDidRebuffer(boolean didRebuffer)
```

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

Default value is `false`.

### setIsBufferEmpty

```
@CanIgnoreReturnValue
public CmcdData.Factory setIsBufferEmpty(boolean isBufferEmpty)
```

Sets whether the queue of buffered chunks is empty.

Default value is `false`.

### setIsLive

```
@CanIgnoreReturnValue
public CmcdData.Factory setIsLive(boolean isLive)
```

Sets whether the media content is being streamed live.

Default value is `false`.

### setNextObjectRequest

```
@CanIgnoreReturnValue
public CmcdData.Factory setNextObjectRequest(@Nullable String nextObjectRequest)
```

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
public CmcdData.Factory setNextRangeRequest(@Nullable String nextRangeRequest)
```

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
public CmcdData.Factory setObjectType(
    @CmcdData.ObjectType @Nullable @CmcdData.ObjectType String objectType
)
```

Sets the object type of the current object being requested.

Must be set if `https://developer.android.com/reference/androidx/media3/exoplayer/upstream/CmcdData.Factory#setTrackSelection(androidx.media3.exoplayer.trackselection.ExoTrackSelection)` is not provided. If unset and a `https://developer.android.com/reference/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
public CmcdData.Factory setPlaybackRate(float playbackRate)
```

Sets the playback rate indicating the current speed of playback.

Default value is `https://developer.android.com/reference/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/androidx/media3/common/C#RATE_UNSET()`. |

### setTrackSelection

```
@CanIgnoreReturnValue
public CmcdData.Factory setTrackSelection(ExoTrackSelection trackSelection)
```

Sets the `https://developer.android.com/reference/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/androidx/media3/exoplayer/upstream/CmcdData.Factory#setObjectType(java.lang.String)` is not `https://developer.android.com/reference/androidx/media3/exoplayer/upstream/CmcdData#OBJECT_TYPE_MANIFEST()`

Default is `null`.