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

*** ** * ** ***


```
@UnstableApi
public final class ErrorStateDrmSession implements DrmSession
```

<br />

*** ** * ** ***

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

## Summary

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

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

| ### Public methods |
|---|---|
| `void` | `https://developer.android.com/reference/androidx/media3/exoplayer/drm/ErrorStateDrmSession#acquire(androidx.media3.exoplayer.drm.DrmSessionEventListener.EventDispatcher)( @https://developer.android.com/reference/androidx/annotation/Nullable https://developer.android.com/reference/androidx/media3/exoplayer/drm/DrmSessionEventListener.EventDispatcher eventDispatcher )` Increments the reference count. |
| `@https://developer.android.com/reference/androidx/annotation/Nullable https://developer.android.com/reference/androidx/media3/decoder/CryptoConfig` | `https://developer.android.com/reference/androidx/media3/exoplayer/drm/ErrorStateDrmSession#getCryptoConfig()()` Returns a `https://developer.android.com/reference/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://developer.android.com/reference/androidx/annotation/Nullable https://developer.android.com/reference/androidx/media3/exoplayer/drm/DrmSession.DrmSessionException` | `https://developer.android.com/reference/androidx/media3/exoplayer/drm/ErrorStateDrmSession#getError()()` Returns the cause of the error state, or null if `https://developer.android.com/reference/androidx/media3/exoplayer/drm/DrmSession#getState()` is not `https://developer.android.com/reference/androidx/media3/exoplayer/drm/DrmSession#STATE_ERROR()`. |
| `@https://developer.android.com/reference/androidx/annotation/Nullable byte[]` | `https://developer.android.com/reference/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. |
| `final https://developer.android.com/reference/java/util/UUID.html` | `https://developer.android.com/reference/androidx/media3/exoplayer/drm/ErrorStateDrmSession#getSchemeUuid()()` Returns the DRM scheme UUID for this session. |
| `int` | `https://developer.android.com/reference/androidx/media3/exoplayer/drm/ErrorStateDrmSession#getState()()` Returns the current state of the session, which is one of `https://developer.android.com/reference/androidx/media3/exoplayer/drm/DrmSession#STATE_ERROR()`, `https://developer.android.com/reference/androidx/media3/exoplayer/drm/DrmSession#STATE_RELEASED()`, `https://developer.android.com/reference/androidx/media3/exoplayer/drm/DrmSession#STATE_OPENING()`, `https://developer.android.com/reference/androidx/media3/exoplayer/drm/DrmSession#STATE_OPENED()` and `https://developer.android.com/reference/androidx/media3/exoplayer/drm/DrmSession#STATE_OPENED_WITH_KEYS()`. |
| `boolean` | `https://developer.android.com/reference/androidx/media3/exoplayer/drm/ErrorStateDrmSession#playClearSamplesWithoutKeys()()` Returns whether this session allows playback of clear samples prior to keys being loaded. |
| `@https://developer.android.com/reference/androidx/annotation/Nullable https://developer.android.com/reference/java/util/Map.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/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. |
| `void` | `https://developer.android.com/reference/androidx/media3/exoplayer/drm/ErrorStateDrmSession#release(androidx.media3.exoplayer.drm.DrmSessionEventListener.EventDispatcher)( @https://developer.android.com/reference/androidx/annotation/Nullable https://developer.android.com/reference/androidx/media3/exoplayer/drm/DrmSessionEventListener.EventDispatcher eventDispatcher )` Decrements the reference count. |
| `boolean` | `https://developer.android.com/reference/androidx/media3/exoplayer/drm/ErrorStateDrmSession#requiresSecureDecoder(java.lang.String)(https://developer.android.com/reference/java/lang/String.html mimeType)` Returns whether this session requires use of a secure decoder for the given MIME type. |

| ### Inherited Constants |
|---|
| From [androidx.media3.exoplayer.drm.DrmSession](https://developer.android.com/reference/androidx/media3/exoplayer/drm/DrmSession) |---|---| | `static final int` | `https://developer.android.com/reference/androidx/media3/exoplayer/drm/DrmSession#STATE_ERROR() = 1` The session has encountered an error. | | `static final int` | `https://developer.android.com/reference/androidx/media3/exoplayer/drm/DrmSession#STATE_OPENED() = 3` The session is open, but does not have keys required for decryption. | | `static final int` | `https://developer.android.com/reference/androidx/media3/exoplayer/drm/DrmSession#STATE_OPENED_WITH_KEYS() = 4` The session is open and has keys required for decryption. | | `static final int` | `https://developer.android.com/reference/androidx/media3/exoplayer/drm/DrmSession#STATE_OPENING() = 2` The session is being opened. | | `static final int` | `https://developer.android.com/reference/androidx/media3/exoplayer/drm/DrmSession#STATE_RELEASED() = 0` The session has been released. | |

| ### Inherited methods |
|---|
| From [androidx.media3.exoplayer.drm.DrmSession](https://developer.android.com/reference/androidx/media3/exoplayer/drm/DrmSession) |---|---| | `static void` | `https://developer.android.com/reference/androidx/media3/exoplayer/drm/DrmSession#replaceSession(androidx.media3.exoplayer.drm.DrmSession,androidx.media3.exoplayer.drm.DrmSession)( @https://developer.android.com/reference/androidx/annotation/Nullable https://developer.android.com/reference/androidx/media3/exoplayer/drm/DrmSession previousSession, @https://developer.android.com/reference/androidx/annotation/Nullable https://developer.android.com/reference/androidx/media3/exoplayer/drm/DrmSession newSession )` Acquires `newSession` then releases `previousSession`. | |

## Public fields

### error

```
public final DrmSession.DrmSessionException error
```

## Public constructors

### ErrorStateDrmSession

```
public ErrorStateDrmSession(DrmSession.DrmSessionException error)
```

## Public methods

### acquire

```
public void acquire(
    @Nullable DrmSessionEventListener.EventDispatcher eventDispatcher
)
```

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

| Parameters |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/Nullable https://developer.android.com/reference/androidx/media3/exoplayer/drm/DrmSessionEventListener.EventDispatcher eventDispatcher` | The `https://developer.android.com/reference/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

```
public @Nullable CryptoConfig getCryptoConfig()
```

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

### getError

```
public @Nullable DrmSession.DrmSessionException getError()
```

Returns the cause of the error state, or null if `https://developer.android.com/reference/androidx/media3/exoplayer/drm/DrmSession#getState()` is not `https://developer.android.com/reference/androidx/media3/exoplayer/drm/DrmSession#STATE_ERROR()`.

### getOfflineLicenseKeySetId

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

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

### getSchemeUuid

```
public final UUID getSchemeUuid()
```

Returns the DRM scheme UUID for this session.

### getState

```
public int getState()
```

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

### playClearSamplesWithoutKeys

```
public boolean playClearSamplesWithoutKeys()
```

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

### queryKeyStatus

```
public @Nullable Map<String, String> 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.

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://developer.android.com/reference/androidx/annotation/Nullable https://developer.android.com/reference/java/util/Map.html<https://developer.android.com/reference/java/lang/String.html, https://developer.android.com/reference/java/lang/String.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

```
public void release(
    @Nullable DrmSessionEventListener.EventDispatcher eventDispatcher
)
```

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

| Parameters |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/Nullable https://developer.android.com/reference/androidx/media3/exoplayer/drm/DrmSessionEventListener.EventDispatcher eventDispatcher` | The `https://developer.android.com/reference/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/androidx/media3/exoplayer/drm/DrmSession#acquire(androidx.media3.exoplayer.drm.DrmSessionEventListener.EventDispatcher)`). |

### requiresSecureDecoder

```
public boolean requiresSecureDecoder(String mimeType)
```

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/androidx/media3/exoplayer/drm/DrmSession#getState()``https://developer.android.com/reference/androidx/media3/exoplayer/drm/DrmSession#STATE_OPENED()` or `https://developer.android.com/reference/androidx/media3/exoplayer/drm/DrmSession#STATE_OPENED_WITH_KEYS()`.