# CmcdData

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)

*** ** * ** ***


```
@UnstableApi
public final class CmcdData
```

<br />

*** ** * ** ***

This class provides functionality for generating and adding Common Media Client Data (CMCD) data to adaptive streaming formats, DASH, HLS, and SmoothStreaming.

It encapsulates the necessary attributes and information relevant to media content playback, following the guidelines specified in the CMCD standard document [CTA-5004](https://cdn.cta.tech/cta/media/media/resources/standards/pdfs/cta-5004-final.pdf).

## Summary

| ### Nested types |
|---|
| `public final class https://developer.android.com/reference/androidx/media3/exoplayer/upstream/CmcdData.Factory` `https://developer.android.com/reference/androidx/media3/exoplayer/upstream/CmcdData.Factory` for `https://developer.android.com/reference/androidx/media3/exoplayer/upstream/CmcdData` instances. |
| `@https://developer.android.com/reference/java/lang/annotation/Retention.html(value = https://developer.android.com/reference/java/lang/annotation/RetentionPolicy.html#SOURCE) @https://developer.android.com/reference/androidx/annotation/StringDef(value = ) @https://developer.android.com/reference/java/lang/annotation/Documented.html @https://developer.android.com/reference/java/lang/annotation/Target.html(value = https://developer.android.com/reference/java/lang/annotation/ElementType.html#TYPE_USE) public annotation https://developer.android.com/reference/androidx/media3/exoplayer/upstream/CmcdData.ObjectType` Indicates the media type of current object being requested. |
| `@https://developer.android.com/reference/java/lang/annotation/Retention.html(value = https://developer.android.com/reference/java/lang/annotation/RetentionPolicy.html#SOURCE) @https://developer.android.com/reference/androidx/annotation/StringDef(value = ) @https://developer.android.com/reference/java/lang/annotation/Documented.html @https://developer.android.com/reference/java/lang/annotation/Target.html(value = https://developer.android.com/reference/java/lang/annotation/ElementType.html#TYPE_USE) public annotation https://developer.android.com/reference/androidx/media3/exoplayer/upstream/CmcdData.StreamType` Indicates the type of streaming for media content. |
| `@https://developer.android.com/reference/java/lang/annotation/Retention.html(value = https://developer.android.com/reference/java/lang/annotation/RetentionPolicy.html#SOURCE) @https://developer.android.com/reference/androidx/annotation/StringDef(value = ) @https://developer.android.com/reference/java/lang/annotation/Documented.html @https://developer.android.com/reference/java/lang/annotation/Target.html(value = https://developer.android.com/reference/java/lang/annotation/ElementType.html#TYPE_USE) public annotation https://developer.android.com/reference/androidx/media3/exoplayer/upstream/CmcdData.StreamingFormat` Indicates the streaming format used for media content. |

| ### Constants |
|---|---|
| `static final https://developer.android.com/reference/java/lang/String.html` | `https://developer.android.com/reference/androidx/media3/exoplayer/upstream/CmcdData#OBJECT_TYPE_AUDIO_ONLY() = "a"` Represents the object type for audio-only content in a media container. |
| `static final https://developer.android.com/reference/java/lang/String.html` | `https://developer.android.com/reference/androidx/media3/exoplayer/upstream/CmcdData#OBJECT_TYPE_INIT_SEGMENT() = "i"` Represents the object type for an initialization segment in a media container. |
| `static final https://developer.android.com/reference/java/lang/String.html` | `https://developer.android.com/reference/androidx/media3/exoplayer/upstream/CmcdData#OBJECT_TYPE_MANIFEST() = "m"` Represents the object type for a manifest or playlist file, in a media container. |
| `static final https://developer.android.com/reference/java/lang/String.html` | `https://developer.android.com/reference/androidx/media3/exoplayer/upstream/CmcdData#OBJECT_TYPE_MUXED_AUDIO_AND_VIDEO() = "av"` Represents the object type for muxed audio and video content in a media container. |
| `static final https://developer.android.com/reference/java/lang/String.html` | `https://developer.android.com/reference/androidx/media3/exoplayer/upstream/CmcdData#OBJECT_TYPE_VIDEO_ONLY() = "v"` Represents the object type for video-only content in a media container. |
| `static final https://developer.android.com/reference/java/lang/String.html` | `https://developer.android.com/reference/androidx/media3/exoplayer/upstream/CmcdData#STREAMING_FORMAT_DASH() = "d"` Represents the Dynamic Adaptive Streaming over HTTP (DASH) format. |
| `static final https://developer.android.com/reference/java/lang/String.html` | `https://developer.android.com/reference/androidx/media3/exoplayer/upstream/CmcdData#STREAMING_FORMAT_HLS() = "h"` Represents the HTTP Live Streaming (HLS) format. |
| `static final https://developer.android.com/reference/java/lang/String.html` | `https://developer.android.com/reference/androidx/media3/exoplayer/upstream/CmcdData#STREAMING_FORMAT_SS() = "s"` Represents the Smooth Streaming (SS) format. |
| `static final https://developer.android.com/reference/java/lang/String.html` | `https://developer.android.com/reference/androidx/media3/exoplayer/upstream/CmcdData#STREAM_TYPE_LIVE() = "l"` Represents the Live Streaming stream type. |
| `static final https://developer.android.com/reference/java/lang/String.html` | `https://developer.android.com/reference/androidx/media3/exoplayer/upstream/CmcdData#STREAM_TYPE_VOD() = "v"` Represents the Video on Demand (VOD) stream type. |

| ### Public methods |
|---|---|
| `https://developer.android.com/reference/androidx/media3/datasource/DataSpec` | `https://developer.android.com/reference/androidx/media3/exoplayer/upstream/CmcdData#addToDataSpec(androidx.media3.datasource.DataSpec)(https://developer.android.com/reference/androidx/media3/datasource/DataSpec dataSpec)` Adds Common Media Client Data (CMCD) related information to the provided `https://developer.android.com/reference/androidx/media3/datasource/DataSpec` object. |
| `static https://developer.android.com/reference/androidx/media3/datasource/DataSpec` | `https://developer.android.com/reference/androidx/media3/exoplayer/upstream/CmcdData#removeFromDataSpec(androidx.media3.datasource.DataSpec)(https://developer.android.com/reference/androidx/media3/datasource/DataSpec dataSpec)` Removes Common Media Client Data (CMCD) related information from the provided `https://developer.android.com/reference/androidx/media3/datasource/DataSpec` object. |
| `static https://developer.android.com/reference/android/net/Uri.html` | `https://developer.android.com/reference/androidx/media3/exoplayer/upstream/CmcdData#removeFromUri(android.net.Uri)(https://developer.android.com/reference/android/net/Uri.html uri)` Removes Common Media Client Data (CMCD) related information from the provided `https://developer.android.com/reference/android/net/Uri.html`. |

## Constants

### OBJECT_TYPE_AUDIO_ONLY

```
public static final String OBJECT_TYPE_AUDIO_ONLY = "a"
```

Represents the object type for audio-only content in a media container.

### OBJECT_TYPE_INIT_SEGMENT

```
public static final String OBJECT_TYPE_INIT_SEGMENT = "i"
```

Represents the object type for an initialization segment in a media container.

### OBJECT_TYPE_MANIFEST

```
public static final String OBJECT_TYPE_MANIFEST = "m"
```

Represents the object type for a manifest or playlist file, in a media container.

### OBJECT_TYPE_MUXED_AUDIO_AND_VIDEO

```
public static final String OBJECT_TYPE_MUXED_AUDIO_AND_VIDEO = "av"
```

Represents the object type for muxed audio and video content in a media container.

### OBJECT_TYPE_VIDEO_ONLY

```
public static final String OBJECT_TYPE_VIDEO_ONLY = "v"
```

Represents the object type for video-only content in a media container.

### STREAMING_FORMAT_DASH

```
public static final String STREAMING_FORMAT_DASH = "d"
```

Represents the Dynamic Adaptive Streaming over HTTP (DASH) format.

### STREAMING_FORMAT_HLS

```
public static final String STREAMING_FORMAT_HLS = "h"
```

Represents the HTTP Live Streaming (HLS) format.

### STREAMING_FORMAT_SS

```
public static final String STREAMING_FORMAT_SS = "s"
```

Represents the Smooth Streaming (SS) format.

### STREAM_TYPE_LIVE

```
public static final String STREAM_TYPE_LIVE = "l"
```

Represents the Live Streaming stream type.

### STREAM_TYPE_VOD

```
public static final String STREAM_TYPE_VOD = "v"
```

Represents the Video on Demand (VOD) stream type.

## Public methods

### addToDataSpec

```
public DataSpec addToDataSpec(DataSpec dataSpec)
```

Adds Common Media Client Data (CMCD) related information to the provided `https://developer.android.com/reference/androidx/media3/datasource/DataSpec` object.

### removeFromDataSpec

```
public static DataSpec removeFromDataSpec(DataSpec dataSpec)
```

Removes Common Media Client Data (CMCD) related information from the provided `https://developer.android.com/reference/androidx/media3/datasource/DataSpec` object.

### removeFromUri

```
public static Uri removeFromUri(Uri uri)
```

Removes Common Media Client Data (CMCD) related information from the provided `https://developer.android.com/reference/android/net/Uri.html`.