# MediaItem.DrmConfiguration

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

*** ** * ** ***

<br />

```
public final class MediaItem.DrmConfiguration
```

<br />

*** ** * ** ***

DRM configuration for a media item.

## Summary

| ### Nested types |
|---|
| `public final class https://developer.android.com/reference/androidx/media3/common/MediaItem.DrmConfiguration.Builder` Builder for `https://developer.android.com/reference/androidx/media3/common/MediaItem.DrmConfiguration`. |

| ### Public fields |
|---|---|
| `final boolean` | `https://developer.android.com/reference/androidx/media3/common/MediaItem.DrmConfiguration#forceDefaultLicenseUri()` Whether to force use of `https://developer.android.com/reference/androidx/media3/common/MediaItem.DrmConfiguration#licenseUri()` even if the media specifies its own DRM license server URI. |
| `final https://guava.dev/releases/snapshot-android/api/docs/com/google/common/collect/ImmutableList.html<@https://developer.android.com/reference/androidx/media3/common/C.TrackType https://developer.android.com/reference/java/lang/Integer.html>` | `https://developer.android.com/reference/androidx/media3/common/MediaItem.DrmConfiguration#forcedSessionTrackTypes()` The types of tracks for which to always use a DRM session even if the content is unencrypted. |
| `final @https://developer.android.com/reference/androidx/annotation/Nullable byte[]` | `https://developer.android.com/reference/androidx/media3/common/MediaItem.DrmConfiguration#keySetId()` |
| `final https://guava.dev/releases/snapshot-android/api/docs/com/google/common/collect/ImmutableMap.html<https://developer.android.com/reference/java/lang/String.html, https://developer.android.com/reference/java/lang/String.html>` | `https://developer.android.com/reference/androidx/media3/common/MediaItem.DrmConfiguration#licenseRequestHeaders()` The headers to attach to requests sent to the DRM license server. |
| `final @https://developer.android.com/reference/androidx/annotation/Nullable https://developer.android.com/reference/android/net/Uri.html` | `https://developer.android.com/reference/androidx/media3/common/MediaItem.DrmConfiguration#licenseUri()` Optional default DRM license server `https://developer.android.com/reference/android/net/Uri.html`. |
| `final boolean` | `https://developer.android.com/reference/androidx/media3/common/MediaItem.DrmConfiguration#multiSession()` Whether the DRM configuration is multi session enabled. |
| `final boolean` | `https://developer.android.com/reference/androidx/media3/common/MediaItem.DrmConfiguration#playClearContentWithoutKey()` Whether clear samples within protected content should be played when keys for the encrypted part of the content have yet to be loaded. |
| `final https://guava.dev/releases/snapshot-android/api/docs/com/google/common/collect/ImmutableMap.html<https://developer.android.com/reference/java/lang/String.html, https://developer.android.com/reference/java/lang/String.html>` | `@https://developer.android.com/reference/androidx/media3/common/util/UnstableApi https://developer.android.com/reference/androidx/media3/common/MediaItem.DrmConfiguration#requestHeaders()` **This field is deprecated.** Use `https://developer.android.com/reference/androidx/media3/common/MediaItem.DrmConfiguration#licenseRequestHeaders()` instead. <br /> |
| `final https://developer.android.com/reference/java/util/UUID.html` | `https://developer.android.com/reference/androidx/media3/common/MediaItem.DrmConfiguration#scheme()` The UUID of the protection scheme. |
| `final https://guava.dev/releases/snapshot-android/api/docs/com/google/common/collect/ImmutableList.html<@https://developer.android.com/reference/androidx/media3/common/C.TrackType https://developer.android.com/reference/java/lang/Integer.html>` | `@https://developer.android.com/reference/androidx/media3/common/util/UnstableApi https://developer.android.com/reference/androidx/media3/common/MediaItem.DrmConfiguration#sessionForClearTypes()` **This field is deprecated.** Use `https://developer.android.com/reference/androidx/media3/common/MediaItem.DrmConfiguration#forcedSessionTrackTypes()`. <br /> |
| `final https://developer.android.com/reference/java/util/UUID.html` | `@https://developer.android.com/reference/androidx/media3/common/util/UnstableApi https://developer.android.com/reference/androidx/media3/common/MediaItem.DrmConfiguration#uuid()` **This field is deprecated.** Use `https://developer.android.com/reference/androidx/media3/common/MediaItem.DrmConfiguration#scheme()` instead. <br /> |

| ### Public methods |
|---|---|
| `https://developer.android.com/reference/androidx/media3/common/MediaItem.DrmConfiguration.Builder` | `https://developer.android.com/reference/androidx/media3/common/MediaItem.DrmConfiguration#buildUpon()()` Returns a `https://developer.android.com/reference/androidx/media3/common/MediaItem.DrmConfiguration.Builder` initialized with the values of this instance. |
| `boolean` | `https://developer.android.com/reference/androidx/media3/common/MediaItem.DrmConfiguration#equals(java.lang.Object)(@https://developer.android.com/reference/androidx/annotation/Nullable https://developer.android.com/reference/java/lang/Object.html obj)` |
| `static https://developer.android.com/reference/androidx/media3/common/MediaItem.DrmConfiguration` | `@https://developer.android.com/reference/androidx/media3/common/util/UnstableApi https://developer.android.com/reference/androidx/media3/common/MediaItem.DrmConfiguration#fromBundle(android.os.Bundle)(https://developer.android.com/reference/android/os/Bundle.html bundle)` Restores a `DrmConfiguration` from a `https://developer.android.com/reference/android/os/Bundle.html`. |
| `@https://developer.android.com/reference/androidx/annotation/Nullable byte[]` | `https://developer.android.com/reference/androidx/media3/common/MediaItem.DrmConfiguration#getKeySetId()()` Returns the key set ID of the offline license. |
| `int` | `https://developer.android.com/reference/androidx/media3/common/MediaItem.DrmConfiguration#hashCode()()` |
| `https://developer.android.com/reference/android/os/Bundle.html` | `@https://developer.android.com/reference/androidx/media3/common/util/UnstableApi https://developer.android.com/reference/androidx/media3/common/MediaItem.DrmConfiguration#toBundle()()` |

## Public fields

### forceDefaultLicenseUri

```
public final boolean forceDefaultLicenseUri
```

Whether to force use of `https://developer.android.com/reference/androidx/media3/common/MediaItem.DrmConfiguration#licenseUri()` even if the media specifies its own DRM license server URI.

### forcedSessionTrackTypes

```
public final ImmutableList<@C.TrackType Integer> forcedSessionTrackTypes
```

The types of tracks for which to always use a DRM session even if the content is unencrypted.

### keySetId

```
public final @Nullable byte[] keySetId
```

### licenseRequestHeaders

```
public final ImmutableMap<String, String> licenseRequestHeaders
```

The headers to attach to requests sent to the DRM license server.

### licenseUri

```
public final @Nullable Uri licenseUri
```

Optional default DRM license server `https://developer.android.com/reference/android/net/Uri.html`. If `null` then the DRM license server must be specified by the media.

### multiSession

```
public final boolean multiSession
```

Whether the DRM configuration is multi session enabled.

### playClearContentWithoutKey

```
public final boolean playClearContentWithoutKey
```

Whether clear samples within protected content should be played when keys for the encrypted part of the content have yet to be loaded.

### requestHeaders

```
@UnstableApi
public final ImmutableMap<String, String> requestHeaders
```

> [!CAUTION]
> **This field is deprecated.**   
>
> Use `https://developer.android.com/reference/androidx/media3/common/MediaItem.DrmConfiguration#licenseRequestHeaders()` instead.

### scheme

```
public final UUID scheme
```

The UUID of the protection scheme.

### sessionForClearTypes

```
@UnstableApi
public final ImmutableList<@C.TrackType Integer> sessionForClearTypes
```

> [!CAUTION]
> **This field is deprecated.**   
>
> Use `https://developer.android.com/reference/androidx/media3/common/MediaItem.DrmConfiguration#forcedSessionTrackTypes()`.

### uuid

```
@UnstableApi
public final UUID uuid
```

> [!CAUTION]
> **This field is deprecated.**   
>
> Use `https://developer.android.com/reference/androidx/media3/common/MediaItem.DrmConfiguration#scheme()` instead.

## Public methods

### buildUpon

```
public MediaItem.DrmConfiguration.Builder buildUpon()
```

Returns a `https://developer.android.com/reference/androidx/media3/common/MediaItem.DrmConfiguration.Builder` initialized with the values of this instance.

### equals

```
public boolean equals(@Nullable Object obj)
```

### fromBundle

```
@UnstableApi
public static MediaItem.DrmConfiguration fromBundle(Bundle bundle)
```

Restores a `DrmConfiguration` from a `https://developer.android.com/reference/android/os/Bundle.html`.

### getKeySetId

```
public @Nullable byte[] getKeySetId()
```

Returns the key set ID of the offline license.

### hashCode

```
public int hashCode()
```

### toBundle

```
@UnstableApi
public Bundle toBundle()
```