# ErrorStateDrmSession

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

*** ** * ** ***

<br />

```
@UnstableApi
class ErrorStateDrmSession : DrmSession
```

<br />

*** ** * ** ***

A `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/drm/DrmSession` that's in a terminal error state.

## Summary

| ### Public constructors |
|---|
| `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/drm/ErrorStateDrmSession#ErrorStateDrmSession(androidx.media3.exoplayer.drm.DrmSession.DrmSessionException)(error: https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/drm/DrmSession.DrmSessionException!)` |

| ### Public functions |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/drm/ErrorStateDrmSession#acquire(androidx.media3.exoplayer.drm.DrmSessionEventListener.EventDispatcher)(eventDispatcher: https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/drm/DrmSessionEventListener.EventDispatcher?)` Increments the reference count. |
| `https://developer.android.com/reference/kotlin/androidx/media3/decoder/CryptoConfig?` | `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/drm/ErrorStateDrmSession#getCryptoConfig()()` Returns a `https://developer.android.com/reference/kotlin/androidx/media3/decoder/CryptoConfig` for the open session, or null if called before the session has been opened or after it's been released. |
| `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/exoplayer/drm/ErrorStateDrmSession#getOfflineLicenseKeySetId()()` Returns the key set id of the offline license loaded into this session, or null if there isn't one. |
| `https://developer.android.com/reference/java/util/UUID.html!` | `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/drm/ErrorStateDrmSession#getSchemeUuid()()` Returns the DRM scheme UUID for this session. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/drm/ErrorStateDrmSession#getState()()` Returns the current state of the session, which is one of `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/drm/DrmSession#STATE_ERROR()`, `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/drm/DrmSession#STATE_RELEASED()`, `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/drm/DrmSession#STATE_OPENING()`, `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/drm/DrmSession#STATE_OPENED()` and `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/drm/DrmSession#STATE_OPENED_WITH_KEYS()`. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/drm/ErrorStateDrmSession#playClearSamplesWithoutKeys()()` Returns whether this session allows playback of clear samples prior to keys being loaded. |
| `(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/exoplayer/drm/ErrorStateDrmSession#queryKeyStatus()()` Returns a map describing the key status for the session, or null if called before the session has been opened or after it's been released. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/drm/ErrorStateDrmSession#release(androidx.media3.exoplayer.drm.DrmSessionEventListener.EventDispatcher)(eventDispatcher: https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/drm/DrmSessionEventListener.EventDispatcher?)` Decrements the reference count. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/drm/ErrorStateDrmSession#requiresSecureDecoder(java.lang.String)(mimeType: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html!)` Returns whether this session requires use of a secure decoder for the given MIME type. |

| ### Public properties |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/drm/DrmSession.DrmSessionException!` | `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/drm/ErrorStateDrmSession#error()` |

### Inherited Constants

From [androidx.media3.exoplayer.drm.DrmSession](https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/drm/DrmSession) `const https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/drm/DrmSession#STATE_ERROR() = 1`

The session has encountered an error.
`const https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/drm/DrmSession#STATE_OPENED() = 3`

The session is open, but does not have keys required for decryption.
`const https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/drm/DrmSession#STATE_OPENED_WITH_KEYS() = 4`

The session is open and has keys required for decryption.
`const https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/drm/DrmSession#STATE_OPENING() = 2`

The session is being opened.
`const https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/drm/DrmSession#STATE_RELEASED() = 0`

The session has been released.

### Inherited functions

From [androidx.media3.exoplayer.drm.DrmSession](https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/drm/DrmSession) `java-static https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/drm/DrmSession#replaceSession(androidx.media3.exoplayer.drm.DrmSession,androidx.media3.exoplayer.drm.DrmSession)(previousSession: https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/drm/DrmSession?, newSession: https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/drm/DrmSession?)`

Acquires `newSession` then releases `previousSession`.

## Public constructors

### ErrorStateDrmSession

```
ErrorStateDrmSession(error: DrmSession.DrmSessionException!)
```

## Public functions

### acquire

```
fun acquire(eventDispatcher: DrmSessionEventListener.EventDispatcher?): 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/DrmSession#release(androidx.media3.exoplayer.drm.DrmSessionEventListener.EventDispatcher)` to decrement the reference count.

| Parameters |
|---|---|
| `eventDispatcher: https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/drm/DrmSessionEventListener.EventDispatcher?` | The `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/drm/DrmSessionEventListener.EventDispatcher` used to route DRM-related events dispatched from this session, or null if no event handling is needed. |

### getCryptoConfig

```
fun getCryptoConfig(): CryptoConfig?
```

Returns a `https://developer.android.com/reference/kotlin/androidx/media3/decoder/CryptoConfig` for the open session, or null if called before the session has been opened or after it's been released.

### getOfflineLicenseKeySetId

```
fun getOfflineLicenseKeySetId(): Array<Byte>?
```

Returns the key set id of the offline license loaded into this session, or null if there isn't one.

### getSchemeUuid

```
fun getSchemeUuid(): UUID!
```

Returns the DRM scheme UUID for this session.

### getState

```
fun getState(): Int
```

Returns the current state of the session, which is one of `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/drm/DrmSession#STATE_ERROR()`, `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/drm/DrmSession#STATE_RELEASED()`, `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/drm/DrmSession#STATE_OPENING()`, `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/drm/DrmSession#STATE_OPENED()` and `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/drm/DrmSession#STATE_OPENED_WITH_KEYS()`.

### playClearSamplesWithoutKeys

```
fun playClearSamplesWithoutKeys(): Boolean
```

Returns whether this session allows playback of clear samples prior to keys being loaded.

### queryKeyStatus

```
fun queryKeyStatus(): (Mutable)Map<String!, String!>?
```

Returns a map describing the key status for the session, or null if called before the session has been opened or after it's been released.

Since DRM license policies vary by vendor, the specific status field names are determined by each DRM vendor. Refer to your DRM provider documentation for definitions of the field names for a particular DRM engine plugin.

| 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!>?` | A map describing the key status for the session, or null if called before the session has been opened or after it's been released. |

| See also |
|---|---|
| `https://developer.android.com/reference/android/media/MediaDrm.html#queryKeyStatus(byte[])` |   |

### release

```
fun release(eventDispatcher: DrmSessionEventListener.EventDispatcher?): Unit
```

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

| Parameters |
|---|---|
| `eventDispatcher: https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/drm/DrmSessionEventListener.EventDispatcher?` | The `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/drm/DrmSessionEventListener.EventDispatcher` to disconnect when the session is released (the same instance (possibly null) that was passed by the caller to `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/drm/DrmSession#acquire(androidx.media3.exoplayer.drm.DrmSessionEventListener.EventDispatcher)`). |

### requiresSecureDecoder

```
fun requiresSecureDecoder(mimeType: String!): Boolean
```

Returns whether this 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.

The session must be in `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/drm/DrmSession#getState()``https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/drm/DrmSession#STATE_OPENED()` or `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/drm/DrmSession#STATE_OPENED_WITH_KEYS()`.

## Public properties

### error

```
val error: DrmSession.DrmSessionException!
```