# FrameworkMediaDrm

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/drm/FrameworkMediaDrm.java+class:androidx.media3.exoplayer.drm.FrameworkMediaDrm)

*** ** * ** ***

<br />

```
class FrameworkMediaDrm : ExoMediaDrm
```

<br />

*** ** * ** ***

An `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/drm/ExoMediaDrm` implementation that wraps the framework `https://developer.android.com/reference/android/media/MediaDrm.html`.

## Summary

| ### Constants |
|---|---|
| `const https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/drm/ExoMediaDrm.Provider!` | `@https://developer.android.com/reference/kotlin/androidx/media3/common/util/UnstableApi https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/drm/FrameworkMediaDrm#DEFAULT_PROVIDER()` `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/drm/ExoMediaDrm.Provider` that returns a new `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/drm/FrameworkMediaDrm` for the requested UUID. |

| ### Public functions |
|---|---|
| `synchronized https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `@https://developer.android.com/reference/kotlin/androidx/media3/common/util/UnstableApi https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/drm/FrameworkMediaDrm#acquire()()` Increments the reference count. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `@https://developer.android.com/reference/kotlin/androidx/media3/common/util/UnstableApi https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/drm/FrameworkMediaDrm#closeSession(byte[])(sessionId: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-byte-array/index.html<https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-byte/index.html>!)` Closes a DRM session. |
| `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/drm/FrameworkCryptoConfig!` | `@https://developer.android.com/reference/kotlin/androidx/media3/common/util/UnstableApi https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/drm/FrameworkMediaDrm#createCryptoConfig(byte[])(sessionId: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-byte-array/index.html<https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-byte/index.html>!)` Creates a `https://developer.android.com/reference/kotlin/androidx/media3/decoder/CryptoConfig` that can be passed to a compatible decoder to allow decryption of protected content using the specified session. |
| `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.CryptoType https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/drm/FrameworkMediaDrm#getCryptoType()()` Returns the `https://developer.android.com/reference/kotlin/androidx/media3/common/C.CryptoType` of `https://developer.android.com/reference/kotlin/androidx/media3/decoder/CryptoConfig` instances returned by `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/drm/ExoMediaDrm#createCryptoConfig(byte[])`. |
| `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/drm/ExoMediaDrm.KeyRequest!` | `@https://developer.android.com/reference/kotlin/androidx/media3/common/util/UnstableApi https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/drm/FrameworkMediaDrm#getKeyRequest(byte[],java.util.List<androidx.media3.common.DrmInitData.SchemeData>,int,java.util.HashMap<java.lang.String,java.lang.String>)( scope: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-byte-array/index.html<https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-byte/index.html>!, schemeDatas: (https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-mutable-list/index.html)https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-list/index.html<https://developer.android.com/reference/kotlin/androidx/media3/common/DrmInitData.SchemeData!>?, keyType: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, optionalParameters: https://developer.android.com/reference/java/util/HashMap.html<https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html!, https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html!>? )` Generates a key request. |
| `https://developer.android.com/reference/android/os/PersistableBundle.html?` | `@https://developer.android.com/reference/kotlin/androidx/media3/common/util/UnstableApi https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/drm/FrameworkMediaDrm#getMetrics()()` Returns metrics data for this ExoMediaDrm instance, or `null` if metrics are unavailable. |
| `(https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-mutable-list/index.html)https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-list/index.html<https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-array/index.html<https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-byte/index.html>!>!` | `@https://developer.android.com/reference/kotlin/androidx/media3/common/util/UnstableApi @https://developer.android.com/reference/kotlin/androidx/annotation/RequiresApi(value = 29) https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/drm/FrameworkMediaDrm#getOfflineLicenseKeySetIds()()` Returns a list of the `keySetIds` for all offline licenses. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-array/index.html<https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-byte/index.html>!` | `@https://developer.android.com/reference/kotlin/androidx/media3/common/util/UnstableApi https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/drm/FrameworkMediaDrm#getPropertyByteArray(java.lang.String)(propertyName: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html!)` Returns the value of a byte array property. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html!` | `@https://developer.android.com/reference/kotlin/androidx/media3/common/util/UnstableApi https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/drm/FrameworkMediaDrm#getPropertyString(java.lang.String)(propertyName: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html!)` Returns the value of a string property. |
| `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/drm/ExoMediaDrm.ProvisionRequest!` | `@https://developer.android.com/reference/kotlin/androidx/media3/common/util/UnstableApi https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/drm/FrameworkMediaDrm#getProvisionRequest()()` Generates a provisioning request. |
| `java-static https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/drm/FrameworkMediaDrm#isCryptoSchemeSupported(java.util.UUID)(uuid: https://developer.android.com/reference/java/util/UUID.html!)` Returns whether the DRM scheme with the given UUID is supported on this device. |
| `java-static https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/drm/FrameworkMediaDrm!` | `@https://developer.android.com/reference/kotlin/androidx/media3/common/util/UnstableApi https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/drm/FrameworkMediaDrm#newInstance(java.util.UUID)(uuid: https://developer.android.com/reference/java/util/UUID.html!)` Creates an instance with an initial reference count of 1. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-array/index.html<https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-byte/index.html>!` | `@https://developer.android.com/reference/kotlin/androidx/media3/common/util/UnstableApi https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/drm/FrameworkMediaDrm#openSession()()` Opens a new DRM session. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-array/index.html<https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-byte/index.html>?` | `@https://developer.android.com/reference/kotlin/androidx/media3/common/util/UnstableApi https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/drm/FrameworkMediaDrm#provideKeyResponse(byte[],byte[])(scope: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-byte-array/index.html<https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-byte/index.html>!, response: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-byte-array/index.html<https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-byte/index.html>!)` Provides a key response for the last request to be generated using `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/drm/ExoMediaDrm#getKeyRequest(byte[],java.util.List<androidx.media3.common.DrmInitData.SchemeData>,int,java.util.HashMap<java.lang.String,java.lang.String>)`. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `@https://developer.android.com/reference/kotlin/androidx/media3/common/util/UnstableApi https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/drm/FrameworkMediaDrm#provideProvisionResponse(byte[])(response: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-byte-array/index.html<https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-byte/index.html>!)` Provides a provisioning response for the last request to be generated using `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/drm/ExoMediaDrm#getProvisionRequest()`. |
| `(https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-mutable-map/index.html)https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-map/index.html<https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html!, https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html!>!` | `@https://developer.android.com/reference/kotlin/androidx/media3/common/util/UnstableApi https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/drm/FrameworkMediaDrm#queryKeyStatus(byte[])(sessionId: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-byte-array/index.html<https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-byte/index.html>!)` Returns the key status for a given session, as {name, value} pairs. |
| `synchronized https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `@https://developer.android.com/reference/kotlin/androidx/media3/common/util/UnstableApi https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/drm/FrameworkMediaDrm#release()()` Decrements the reference count. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `@https://developer.android.com/reference/kotlin/androidx/media3/common/util/UnstableApi @https://developer.android.com/reference/kotlin/androidx/annotation/RequiresApi(value = 29) https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/drm/FrameworkMediaDrm#removeOfflineLicense(byte[])(keySetId: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-byte-array/index.html<https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-byte/index.html>!)` Removes an offline license. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | `@https://developer.android.com/reference/kotlin/androidx/media3/common/util/UnstableApi https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/drm/FrameworkMediaDrm#requiresSecureDecoder(byte[],java.lang.String)(sessionId: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-byte-array/index.html<https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-byte/index.html>!, mimeType: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html!)` Returns whether the given session requires use of a secure decoder for the given MIME type. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `@https://developer.android.com/reference/kotlin/androidx/media3/common/util/UnstableApi https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/drm/FrameworkMediaDrm#restoreKeys(byte[],byte[])(sessionId: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-byte-array/index.html<https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-byte/index.html>!, keySetId: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-byte-array/index.html<https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-byte/index.html>!)` Restores persisted offline keys into a session. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `@https://developer.android.com/reference/kotlin/androidx/media3/common/util/UnstableApi https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/drm/FrameworkMediaDrm#setOnEventListener(androidx.media3.exoplayer.drm.ExoMediaDrm.OnEventListener)(listener: https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/drm/ExoMediaDrm.OnEventListener?)` Sets the listener for DRM events. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `@https://developer.android.com/reference/kotlin/androidx/media3/common/util/UnstableApi https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/drm/FrameworkMediaDrm#setOnExpirationUpdateListener(androidx.media3.exoplayer.drm.ExoMediaDrm.OnExpirationUpdateListener)( listener: https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/drm/ExoMediaDrm.OnExpirationUpdateListener? )` Sets the listener for session expiration events. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `@https://developer.android.com/reference/kotlin/androidx/media3/common/util/UnstableApi https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/drm/FrameworkMediaDrm#setOnKeyStatusChangeListener(androidx.media3.exoplayer.drm.ExoMediaDrm.OnKeyStatusChangeListener)( listener: https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/drm/ExoMediaDrm.OnKeyStatusChangeListener? )` Sets the listener for key status change events. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `@https://developer.android.com/reference/kotlin/androidx/media3/common/util/UnstableApi https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/drm/FrameworkMediaDrm#setPlayerIdForSession(byte[],androidx.media3.exoplayer.analytics.PlayerId)(sessionId: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-byte-array/index.html<https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-byte/index.html>!, playerId: https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/analytics/PlayerId!)` Sets the `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/analytics/PlayerId` of the player using a session. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `@https://developer.android.com/reference/kotlin/androidx/media3/common/util/UnstableApi https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/drm/FrameworkMediaDrm#setPropertyByteArray(java.lang.String,byte[])(propertyName: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html!, value: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-byte-array/index.html<https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-byte/index.html>!)` Sets the value of a byte array property. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `@https://developer.android.com/reference/kotlin/androidx/media3/common/util/UnstableApi https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/drm/FrameworkMediaDrm#setPropertyString(java.lang.String,java.lang.String)(propertyName: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html!, value: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html!)` Sets the value of a string property. |

### Inherited Constants

From [androidx.media3.exoplayer.drm.ExoMediaDrm](https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/drm/ExoMediaDrm) `const 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/exoplayer/drm/ExoMediaDrm#EVENT_KEY_EXPIRED() = 3`

Event indicating that keys have expired, and are no longer usable.
`const 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/exoplayer/drm/ExoMediaDrm#EVENT_KEY_REQUIRED() = 2`

Event indicating that keys need to be requested from the license server.
`const 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/exoplayer/drm/ExoMediaDrm#EVENT_PROVISION_REQUIRED() = 1`

Event indicating that a certificate needs to be requested from the provisioning server.
`const 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/exoplayer/drm/ExoMediaDrm#KEY_TYPE_OFFLINE() = 2`

Key request type for keys that will be used for offline use.
`const 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/exoplayer/drm/ExoMediaDrm#KEY_TYPE_RELEASE() = 3`

Key request type indicating that saved offline keys should be released.
`const 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/exoplayer/drm/ExoMediaDrm#KEY_TYPE_STREAMING() = 1`

Key request type for keys that will be used for online use.

## Constants

### DEFAULT_PROVIDER

```
@UnstableApi
const val DEFAULT_PROVIDER: ExoMediaDrm.Provider!
```

`https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/drm/ExoMediaDrm.Provider` that returns a new `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/drm/FrameworkMediaDrm` for the requested UUID. Returns a `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/drm/DummyExoMediaDrm` if the protection scheme identified by the given UUID is not supported by the device.

## Public functions

### acquire

```
@UnstableApi
synchronized fun acquire(): Unit
```

Increments the reference count. When the caller no longer needs to use the instance, it must call `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/drm/ExoMediaDrm#release()` to decrement the reference count.

A new instance will have an initial reference count of 1, and therefore it is not normally necessary for application code to call this method.

### closeSession

```
@UnstableApi
fun closeSession(sessionId: ByteArray<Byte>!): Unit
```

Closes a DRM session.

| Parameters |
|---|---|
| `sessionId: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-byte-array/index.html<https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-byte/index.html>!` | The ID of the session to close. |

### createCryptoConfig

```
@UnstableApi
fun createCryptoConfig(sessionId: ByteArray<Byte>!): FrameworkCryptoConfig!
```

Creates a `https://developer.android.com/reference/kotlin/androidx/media3/decoder/CryptoConfig` that can be passed to a compatible decoder to allow decryption of protected content using the specified session.

| Parameters |
|---|---|
| `sessionId: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-byte-array/index.html<https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-byte/index.html>!` | The ID of the session. |

| Returns |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/drm/FrameworkCryptoConfig!` | A `https://developer.android.com/reference/kotlin/androidx/media3/decoder/CryptoConfig` for the given session. |

| Throws |
|---|---|
| `https://developer.android.com/reference/android/media/MediaCryptoException.html` | If a `https://developer.android.com/reference/kotlin/androidx/media3/decoder/CryptoConfig` could not be created. |

### getCryptoType

```
@UnstableApi
@C.CryptoType
fun getCryptoType(): Int
```

Returns the `https://developer.android.com/reference/kotlin/androidx/media3/common/C.CryptoType` of `https://developer.android.com/reference/kotlin/androidx/media3/decoder/CryptoConfig` instances returned by `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/drm/ExoMediaDrm#createCryptoConfig(byte[])`.

### getKeyRequest

```
@UnstableApi
fun getKeyRequest(
    scope: ByteArray<Byte>!,
    schemeDatas: (Mutable)List<DrmInitData.SchemeData!>?,
    keyType: Int,
    optionalParameters: HashMap<String!, String!>?
): ExoMediaDrm.KeyRequest!
```

Generates a key request.

| Parameters |
|---|---|
| `scope: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-byte-array/index.html<https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-byte/index.html>!` | If `keyType` is `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/drm/ExoMediaDrm#KEY_TYPE_STREAMING()` or `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/drm/ExoMediaDrm#KEY_TYPE_OFFLINE()`, the ID of the session that the keys will be provided to. If `keyType` is `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/drm/ExoMediaDrm#KEY_TYPE_RELEASE()`, the `keySetId` of the keys to release. |
| `schemeDatas: (https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-mutable-list/index.html)https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-list/index.html<https://developer.android.com/reference/kotlin/androidx/media3/common/DrmInitData.SchemeData!>?` | If key type is `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/drm/ExoMediaDrm#KEY_TYPE_STREAMING()` or `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/drm/ExoMediaDrm#KEY_TYPE_OFFLINE()`, a list of `https://developer.android.com/reference/kotlin/androidx/media3/common/DrmInitData.SchemeData` instances extracted from the media. Null otherwise. |
| `keyType: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | The type of the request. Either `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/drm/ExoMediaDrm#KEY_TYPE_STREAMING()` to acquire keys for streaming, `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/drm/ExoMediaDrm#KEY_TYPE_OFFLINE()` to acquire keys for offline usage, or `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/drm/ExoMediaDrm#KEY_TYPE_RELEASE()` to release acquired keys. Releasing keys invalidates them for all sessions. |
| `optionalParameters: https://developer.android.com/reference/java/util/HashMap.html<https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html!, https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html!>?` | Are included in the key request message to allow a client application to provide additional message parameters to the server. This may be `null` if no additional parameters are to be sent. |

| Returns |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/drm/ExoMediaDrm.KeyRequest!` | The generated key request. |

| Throws |
|---|---|
| `https://developer.android.com/reference/android/media/NotProvisionedException.html` |   |

| See also |
|---|---|
| `https://developer.android.com/reference/android/media/MediaDrm.html#getKeyRequest(byte[], byte[], java.lang.String, int, java.util.HashMap&lt;java.lang.String,java.lang.String&gt;)` |   |

### getMetrics

```
@UnstableApi
fun getMetrics(): PersistableBundle?
```

Returns metrics data for this ExoMediaDrm instance, or `null` if metrics are unavailable.

### getOfflineLicenseKeySetIds

```
@UnstableApi
@RequiresApi(value = 29)
fun getOfflineLicenseKeySetIds(): (Mutable)List<Array<Byte>!>!
```

Returns a list of the `keySetIds` for all offline licenses.

This is an optional method, and some implementations may only support it on certain Android API levels.

See `https://developer.android.com/reference/android/media/MediaDrm.html#getOfflineLicenseKeySetIds()` for more details.

| Returns |
|---|---|
| `(https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-mutable-list/index.html)https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-list/index.html<https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-array/index.html<https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-byte/index.html>!>!` | The list of `keySetIds` for all offline licenses. |

| Throws |
|---|---|
| `https://developer.android.com/reference/java/lang/UnsupportedOperationException.html` | if the implementation doesn't support this method. |

### getPropertyByteArray

```
@UnstableApi
fun getPropertyByteArray(propertyName: String!): Array<Byte>!
```

Returns the value of a byte array property. For standard property names, see `https://developer.android.com/reference/android/media/MediaDrm.html#getPropertyByteArray(java.lang.String)`.

| Parameters |
|---|---|
| `propertyName: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html!` | The property name. |

| Returns |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-array/index.html<https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-byte/index.html>!` | The property value. |

| Throws |
|---|---|
| `https://developer.android.com/reference/java/lang/IllegalArgumentException.html` | If the underlying DRM plugin does not support the property. |

### getPropertyString

```
@UnstableApi
fun getPropertyString(propertyName: String!): String!
```

Returns the value of a string property. For standard property names, see `https://developer.android.com/reference/android/media/MediaDrm.html#getPropertyString(java.lang.String)`.

| Parameters |
|---|---|
| `propertyName: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html!` | The property name. |

| Returns |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html!` | The property value. |

| Throws |
|---|---|
| `https://developer.android.com/reference/java/lang/IllegalArgumentException.html` | If the underlying DRM plugin does not support the property. |

### getProvisionRequest

```
@UnstableApi
fun getProvisionRequest(): ExoMediaDrm.ProvisionRequest!
```

Generates a provisioning request.

| Returns |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/drm/ExoMediaDrm.ProvisionRequest!` | The generated provisioning request. |

### isCryptoSchemeSupported

```
java-static fun isCryptoSchemeSupported(uuid: UUID!): Boolean
```

Returns whether the DRM scheme with the given UUID is supported on this device.

| See also |
|---|---|
| `https://developer.android.com/reference/android/media/MediaDrm.html#isCryptoSchemeSupported(java.util.UUID)` |   |

### newInstance

```
@UnstableApi
java-static fun newInstance(uuid: UUID!): FrameworkMediaDrm!
```

Creates an instance with an initial reference count of 1. `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/drm/FrameworkMediaDrm#release()` must be called on the instance when it's no longer required.

| Parameters |
|---|---|
| `uuid: https://developer.android.com/reference/java/util/UUID.html!` | The scheme uuid. |

| Returns |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/drm/FrameworkMediaDrm!` | The created instance. |

| Throws |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/drm/UnsupportedDrmException` | If the DRM scheme is unsupported or cannot be instantiated. |

### openSession

```
@UnstableApi
fun openSession(): Array<Byte>!
```

Opens a new DRM session. A session ID is returned.

| Returns |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-array/index.html<https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-byte/index.html>!` | The session ID. |

| Throws |
|---|---|
| `https://developer.android.com/reference/android/media/NotProvisionedException.html` | If provisioning is needed. |
| `https://developer.android.com/reference/android/media/ResourceBusyException.html` | If required resources are in use. |
| `https://developer.android.com/reference/android/media/MediaDrmException.html` | If the session could not be opened. |

### provideKeyResponse

```
@UnstableApi
fun provideKeyResponse(scope: ByteArray<Byte>!, response: ByteArray<Byte>!): Array<Byte>?
```

Provides a key response for the last request to be generated using `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/drm/ExoMediaDrm#getKeyRequest(byte[],java.util.List<androidx.media3.common.DrmInitData.SchemeData>,int,java.util.HashMap<java.lang.String,java.lang.String>)`.

| Parameters |
|---|---|
| `scope: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-byte-array/index.html<https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-byte/index.html>!` | If the request had type `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/drm/ExoMediaDrm#KEY_TYPE_STREAMING()` or `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/drm/ExoMediaDrm#KEY_TYPE_OFFLINE()`, the ID of the session to provide the keys to. If `keyType` is `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/drm/ExoMediaDrm#KEY_TYPE_RELEASE()`, the `keySetId` of the keys being released. |
| `response: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-byte-array/index.html<https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-byte/index.html>!` | The response data from the server. |

| Returns |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-array/index.html<https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-byte/index.html>?` | If the request had type `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/drm/ExoMediaDrm#KEY_TYPE_OFFLINE()`, the `keySetId` for the offline keys. An empty byte array or `null` may be returned for other cases. |

| Throws |
|---|---|
| `https://developer.android.com/reference/android/media/NotProvisionedException.html` | If the response indicates that provisioning is needed. |
| `https://developer.android.com/reference/android/media/DeniedByServerException.html` | If the response indicates that the server rejected the request. |

### provideProvisionResponse

```
@UnstableApi
fun provideProvisionResponse(response: ByteArray<Byte>!): Unit
```

Provides a provisioning response for the last request to be generated using `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/drm/ExoMediaDrm#getProvisionRequest()`.

| Parameters |
|---|---|
| `response: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-byte-array/index.html<https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-byte/index.html>!` | The response data from the server. |

| Throws |
|---|---|
| `https://developer.android.com/reference/android/media/DeniedByServerException.html` | If the response indicates that the server rejected the request. |

### queryKeyStatus

```
@UnstableApi
fun queryKeyStatus(sessionId: ByteArray<Byte>!): (Mutable)Map<String!, String!>!
```

Returns the key status for a given session, as {name, value} pairs. Since DRM license policies vary by vendor, the returned entries depend on the DRM plugin being used. Refer to your DRM provider's documentation for more information.

| Parameters |
|---|---|
| `sessionId: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-byte-array/index.html<https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-byte/index.html>!` | The ID of the session being queried. |

| Returns |
|---|---|
| `(https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-mutable-map/index.html)https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-map/index.html<https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html!, https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html!>!` | The key status for the session. |

### release

```
@UnstableApi
synchronized fun release(): Unit
```

Decrements the reference count. If the reference count drops to 0 underlying resources are released, and the instance cannot be re-used.

### removeOfflineLicense

```
@UnstableApi
@RequiresApi(value = 29)
fun removeOfflineLicense(keySetId: ByteArray<Byte>!): Unit
```

Removes an offline license.

This method is generally not needed, and should only be used if the preferred approach of generating a license release request by passing `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/drm/ExoMediaDrm#KEY_TYPE_RELEASE()` to `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/drm/ExoMediaDrm#getKeyRequest(byte[],java.util.List<androidx.media3.common.DrmInitData.SchemeData>,int,java.util.HashMap<java.lang.String,java.lang.String>)` is not possible.

This is an optional method, and some implementations may only support it on certain Android API levels.

See `https://developer.android.com/reference/android/media/MediaDrm.html#removeOfflineLicense(byte[])` for more details.

| Parameters |
|---|---|
| `keySetId: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-byte-array/index.html<https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-byte/index.html>!` | The `keySetId` of the license to remove. |

| Throws |
|---|---|
| `https://developer.android.com/reference/java/lang/UnsupportedOperationException.html` | if the implementation doesn't support this method. |

### requiresSecureDecoder

```
@UnstableApi
fun requiresSecureDecoder(sessionId: ByteArray<Byte>!, mimeType: String!): Boolean
```

Returns whether the given session requires use of a secure decoder for the given MIME type. Assumes a license policy that requires the highest level of security supported by the session.

| Parameters |
|---|---|
| `sessionId: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-byte-array/index.html<https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-byte/index.html>!` | The ID of the session. |
| `mimeType: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html!` | The content MIME type to query. |

### restoreKeys

```
@UnstableApi
fun restoreKeys(sessionId: ByteArray<Byte>!, keySetId: ByteArray<Byte>!): Unit
```

Restores persisted offline keys into a session.

| Parameters |
|---|---|
| `sessionId: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-byte-array/index.html<https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-byte/index.html>!` | The ID of the session into which the keys will be restored. |
| `keySetId: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-byte-array/index.html<https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-byte/index.html>!` | The `keySetId` of the keys to restore, as provided by the call to `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/drm/ExoMediaDrm#provideKeyResponse(byte[],byte[])` that persisted them. |

### setOnEventListener

```
@UnstableApi
fun setOnEventListener(listener: ExoMediaDrm.OnEventListener?): Unit
```

Sets the listener for DRM events.

This is an optional method, and some implementations may only support it on certain Android API levels.

| Parameters |
|---|---|
| `listener: https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/drm/ExoMediaDrm.OnEventListener?` | The listener to receive events, or `null` to stop receiving events. |

| Throws |
|---|---|
| `https://developer.android.com/reference/java/lang/UnsupportedOperationException.html` | if the implementation doesn't support this method. |

| See also |
|---|---|
| `https://developer.android.com/reference/android/media/MediaDrm.html#setOnEventListener(android.media.MediaDrm.OnEventListener)` |   |

### setOnExpirationUpdateListener

```
@UnstableApi
fun setOnExpirationUpdateListener(
    listener: ExoMediaDrm.OnExpirationUpdateListener?
): Unit
```

Sets the listener for session expiration events.

This is an optional method, and some implementations may only support it on certain Android API levels.

| Parameters |
|---|---|
| `listener: https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/drm/ExoMediaDrm.OnExpirationUpdateListener?` | The listener to receive events, or `null` to stop receiving events. |

| Throws |
|---|---|
| `https://developer.android.com/reference/java/lang/UnsupportedOperationException.html` | if the implementation doesn't support this method. |

| See also |
|---|---|
| `https://developer.android.com/reference/android/media/MediaDrm.html#setOnExpirationUpdateListener(android.media.MediaDrm.OnExpirationUpdateListener, android.os.Handler)` |   |

### setOnKeyStatusChangeListener

```
@UnstableApi
fun setOnKeyStatusChangeListener(
    listener: ExoMediaDrm.OnKeyStatusChangeListener?
): Unit
```

Sets the listener for key status change events.

This is an optional method, and some implementations may only support it on certain Android API levels.

| Parameters |
|---|---|
| `listener: https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/drm/ExoMediaDrm.OnKeyStatusChangeListener?` | The listener to receive events, or `null` to stop receiving events. |

| Throws |
|---|---|
| `https://developer.android.com/reference/java/lang/UnsupportedOperationException.html` | if the implementation doesn't support this method. |

| See also |
|---|---|
| `https://developer.android.com/reference/android/media/MediaDrm.html#setOnKeyStatusChangeListener(android.media.MediaDrm.OnKeyStatusChangeListener, android.os.Handler)` |   |

### setPlayerIdForSession

```
@UnstableApi
fun setPlayerIdForSession(sessionId: ByteArray<Byte>!, playerId: PlayerId!): Unit
```

Sets the `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/analytics/PlayerId` of the player using a session.

| Parameters |
|---|---|
| `sessionId: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-byte-array/index.html<https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-byte/index.html>!` | The ID of the session. |
| `playerId: https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/analytics/PlayerId!` | The `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/analytics/PlayerId` of the player using the session. |

### setPropertyByteArray

```
@UnstableApi
fun setPropertyByteArray(propertyName: String!, value: ByteArray<Byte>!): Unit
```

Sets the value of a byte array property.

| Parameters |
|---|---|
| `propertyName: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html!` | The property name. |
| `value: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-byte-array/index.html<https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-byte/index.html>!` | The value. |

| Throws |
|---|---|
| `https://developer.android.com/reference/java/lang/IllegalArgumentException.html` | If the underlying DRM plugin does not support the property. |

### setPropertyString

```
@UnstableApi
fun setPropertyString(propertyName: String!, value: String!): Unit
```

Sets the value of a string property.

| Parameters |
|---|---|
| `propertyName: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html!` | The property name. |
| `value: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html!` | The value. |

| Throws |
|---|---|
| `https://developer.android.com/reference/java/lang/IllegalArgumentException.html` | If the underlying DRM plugin does not support the property. |