# MediaDrm.ErrorCodes

Added in[API level 31](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

# ErrorCodes

*** ** * ** ***

Kotlin\|[Java](https://developer.android.com/reference/android/media/MediaDrm.ErrorCodes "View this page in Java")  

```
class ErrorCodes
```

|---|------------------------------------------------------------------------------------------------------------------------|
| [kotlin.Any](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-any/index.html)                                         ||
| ↳ | [android.media.MediaDrm.ErrorCodes](https://developer.android.com/reference/kotlin/android/media/MediaDrm.ErrorCodes#) |

Error codes that may be returned from[android.media.MediaDrm.MediaDrmStateException#getErrorCode()](https://developer.android.com/reference/kotlin/android/media/MediaDrm.MediaDrmStateException#getErrorCode())and[android.media.MediaCodec.CryptoException#getErrorCode()](https://developer.android.com/reference/kotlin/android/media/MediaCodec.CryptoException#getErrorCode())

The description of each error code includes steps that may be taken to resolve the error condition. For some errors however, a recovery action cannot be predetermined. The description of those codes refers to a general strategy for handling the error condition programmatically, which is to try the following in listed order until successful:

1. retry the operation
2. if the operation is related to a session,[close](https://developer.android.com/reference/kotlin/android/media/MediaDrm#closeSession(kotlin.ByteArray))the session,[open](https://developer.android.com/reference/kotlin/android/media/MediaDrm#openSession())a new session, and retry the operation
3. [close](https://developer.android.com/reference/kotlin/android/media/MediaDrm#close())the[MediaDrm](https://developer.android.com/reference/kotlin/android/media/MediaDrm)instance and any other related components such as the[codec](https://developer.android.com/reference/kotlin/android/media/MediaCodec)and retry playback, or
4. try using a different configuration of the[MediaDrm](https://developer.android.com/reference/kotlin/android/media/MediaDrm)plugin, such as a different[security level](https://developer.android.com/reference/kotlin/android/media/MediaDrm#openSession(kotlin.Int)).

If the problem still persists after all the aforementioned steps, please report the failure to the[MediaDrm](https://developer.android.com/reference/kotlin/android/media/MediaDrm)plugin vendor along with the[log messages](https://developer.android.com/reference/kotlin/android/media/MediaDrm.LogMessage)returned by[android.media.MediaDrm#getLogMessages()](https://developer.android.com/reference/kotlin/android/media/MediaDrm#getLogMessages()), and a bugreport if possible.

## Summary

|                                                                                                                                                                                                                                        Constants                                                                                                                                                                                                                                        ||
|----------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| static[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) | [ERROR_CERTIFICATE_MALFORMED](https://developer.android.com/reference/kotlin/android/media/MediaDrm.ErrorCodes#ERROR_CERTIFICATE_MALFORMED:kotlin.Int) Certificate is malformed or is of the wrong type.                                                                                                                                                                                              |
| static[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) | [ERROR_CERTIFICATE_MISSING](https://developer.android.com/reference/kotlin/android/media/MediaDrm.ErrorCodes#ERROR_CERTIFICATE_MISSING:kotlin.Int) Certificate has not been set.                                                                                                                                                                                                                      |
| static[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) | [ERROR_CRYPTO_LIBRARY](https://developer.android.com/reference/kotlin/android/media/MediaDrm.ErrorCodes#ERROR_CRYPTO_LIBRARY:kotlin.Int) An error happened within the crypto library used by the drm plugin.                                                                                                                                                                                          |
| static[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) | [ERROR_FRAME_TOO_LARGE](https://developer.android.com/reference/kotlin/android/media/MediaDrm.ErrorCodes#ERROR_FRAME_TOO_LARGE:kotlin.Int) The video frame being decrypted exceeds the size of the device's protected output buffers.                                                                                                                                                                 |
| static[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) | [ERROR_GENERIC_OEM](https://developer.android.com/reference/kotlin/android/media/MediaDrm.ErrorCodes#ERROR_GENERIC_OEM:kotlin.Int) Unexpected error reported by the device OEM subsystem.                                                                                                                                                                                                             |
| static[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) | [ERROR_GENERIC_PLUGIN](https://developer.android.com/reference/kotlin/android/media/MediaDrm.ErrorCodes#ERROR_GENERIC_PLUGIN:kotlin.Int) Unexpected internal failure in[MediaDrm](https://developer.android.com/reference/kotlin/android/media/MediaDrm)/[MediaCrypto](https://developer.android.com/reference/kotlin/android/media/MediaCrypto).                                                     |
| static[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) | [ERROR_INIT_DATA](https://developer.android.com/reference/kotlin/android/media/MediaDrm.ErrorCodes#ERROR_INIT_DATA:kotlin.Int) The init data parameter passed to[MediaDrm.getKeyRequest](https://developer.android.com/reference/kotlin/android/media/MediaDrm#getKeyRequest(kotlin.ByteArray,%20kotlin.ByteArray,%20kotlin.String,%20kotlin.Int,%20java.util.HashMap))is empty or invalid.           |
| static[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) | [ERROR_INSUFFICIENT_OUTPUT_PROTECTION](https://developer.android.com/reference/kotlin/android/media/MediaDrm.ErrorCodes#ERROR_INSUFFICIENT_OUTPUT_PROTECTION:kotlin.Int) The output protection levels supported by the device are not sufficient to meet the requirements set by the content owner in the license policy.                                                                             |
| static[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) | [ERROR_INSUFFICIENT_SECURITY](https://developer.android.com/reference/kotlin/android/media/MediaDrm.ErrorCodes#ERROR_INSUFFICIENT_SECURITY:kotlin.Int) The security level of the device is not sufficient to meet the requirements set by the content owner in the license policy.                                                                                                                    |
| static[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) | [ERROR_KEY_EXPIRED](https://developer.android.com/reference/kotlin/android/media/MediaDrm.ErrorCodes#ERROR_KEY_EXPIRED:kotlin.Int) The key used for decryption is no longer valid due to license term expiration.                                                                                                                                                                                     |
| static[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) | [ERROR_KEY_NOT_LOADED](https://developer.android.com/reference/kotlin/android/media/MediaDrm.ErrorCodes#ERROR_KEY_NOT_LOADED:kotlin.Int) Either the key was not loaded from the license before attempting the operation, or the key ID parameter provided by the app is incorrect.                                                                                                                    |
| static[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) | [ERROR_LICENSE_PARSE](https://developer.android.com/reference/kotlin/android/media/MediaDrm.ErrorCodes#ERROR_LICENSE_PARSE:kotlin.Int) The license response was empty, fields are missing or otherwise unable to be parsed or decrypted.                                                                                                                                                              |
| static[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) | [ERROR_LICENSE_POLICY](https://developer.android.com/reference/kotlin/android/media/MediaDrm.ErrorCodes#ERROR_LICENSE_POLICY:kotlin.Int) The operation (e.g. to renew or persist a license) is prohibited by the license policy.                                                                                                                                                                      |
| static[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) | [ERROR_LICENSE_RELEASE](https://developer.android.com/reference/kotlin/android/media/MediaDrm.ErrorCodes#ERROR_LICENSE_RELEASE:kotlin.Int) Failed to generate a release request because a field in the offline license is empty or malformed.                                                                                                                                                         |
| static[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) | [ERROR_LICENSE_REQUEST_REJECTED](https://developer.android.com/reference/kotlin/android/media/MediaDrm.ErrorCodes#ERROR_LICENSE_REQUEST_REJECTED:kotlin.Int) The license server detected an error in the license request.                                                                                                                                                                             |
| static[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) | [ERROR_LICENSE_RESTORE](https://developer.android.com/reference/kotlin/android/media/MediaDrm.ErrorCodes#ERROR_LICENSE_RESTORE:kotlin.Int) Failed to restore an offline license because a field in the offline license is empty or malformed.                                                                                                                                                         |
| static[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) | [ERROR_LICENSE_STATE](https://developer.android.com/reference/kotlin/android/media/MediaDrm.ErrorCodes#ERROR_LICENSE_STATE:kotlin.Int) Offline license is in an invalid state for the attempted operation.                                                                                                                                                                                            |
| static[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) | [ERROR_LOST_STATE](https://developer.android.com/reference/kotlin/android/media/MediaDrm.ErrorCodes#ERROR_LOST_STATE:kotlin.Int) The session state has been invalidated.                                                                                                                                                                                                                              |
| static[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) | [ERROR_MEDIA_FRAMEWORK](https://developer.android.com/reference/kotlin/android/media/MediaDrm.ErrorCodes#ERROR_MEDIA_FRAMEWORK:kotlin.Int) Failure in the media framework.                                                                                                                                                                                                                            |
| static[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) | [ERROR_NO_KEY](https://developer.android.com/reference/kotlin/android/media/MediaDrm.ErrorCodes#ERROR_NO_KEY:kotlin.Int) The requested key was not found when trying to perform a decrypt operation.                                                                                                                                                                                                  |
| static[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) | [ERROR_PROVISIONING_CERTIFICATE](https://developer.android.com/reference/kotlin/android/media/MediaDrm.ErrorCodes#ERROR_PROVISIONING_CERTIFICATE:kotlin.Int) Error loading the provisioned certificate.                                                                                                                                                                                               |
| static[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) | [ERROR_PROVISIONING_CONFIG](https://developer.android.com/reference/kotlin/android/media/MediaDrm.ErrorCodes#ERROR_PROVISIONING_CONFIG:kotlin.Int) Required steps were not performed before provisioning was attempted.                                                                                                                                                                               |
| static[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) | [ERROR_PROVISIONING_PARSE](https://developer.android.com/reference/kotlin/android/media/MediaDrm.ErrorCodes#ERROR_PROVISIONING_PARSE:kotlin.Int) The provisioning response was empty, fields are missing or otherwise unable to be parsed.                                                                                                                                                            |
| static[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) | [ERROR_PROVISIONING_REQUEST_REJECTED](https://developer.android.com/reference/kotlin/android/media/MediaDrm.ErrorCodes#ERROR_PROVISIONING_REQUEST_REJECTED:kotlin.Int) The provisioning server detected an error in the provisioning request.                                                                                                                                                         |
| static[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) | [ERROR_PROVISIONING_RETRY](https://developer.android.com/reference/kotlin/android/media/MediaDrm.ErrorCodes#ERROR_PROVISIONING_RETRY:kotlin.Int) Provisioning failed in a way that is likely to succeed on a subsequent attempt.                                                                                                                                                                      |
| static[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) | [ERROR_RESOURCE_BUSY](https://developer.android.com/reference/kotlin/android/media/MediaDrm.ErrorCodes#ERROR_RESOURCE_BUSY:kotlin.Int) A required crypto resource was not able to be allocated while attempting the requested operation.                                                                                                                                                              |
| static[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) | [ERROR_RESOURCE_CONTENTION](https://developer.android.com/reference/kotlin/android/media/MediaDrm.ErrorCodes#ERROR_RESOURCE_CONTENTION:kotlin.Int) This indicates that apps using MediaDrm sessions are temporarily exceeding the capacity of available crypto resources.                                                                                                                             |
| static[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) | [ERROR_SECURE_STOP_RELEASE](https://developer.android.com/reference/kotlin/android/media/MediaDrm.ErrorCodes#ERROR_SECURE_STOP_RELEASE:kotlin.Int) Failed to generate a secure stop request because a field in the stored license is empty or malformed.                                                                                                                                              |
| static[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) | [ERROR_SESSION_NOT_OPENED](https://developer.android.com/reference/kotlin/android/media/MediaDrm.ErrorCodes#ERROR_SESSION_NOT_OPENED:kotlin.Int) Decryption was attempted on a session that is not opened, which could be due to a failure to open the session, closing the session prematurely, the session being reclaimed by the resource manager, or a non-existent session id.                   |
| static[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) | [ERROR_STORAGE_READ](https://developer.android.com/reference/kotlin/android/media/MediaDrm.ErrorCodes#ERROR_STORAGE_READ:kotlin.Int) The plugin was unable to read data from the filesystem.                                                                                                                                                                                                          |
| static[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) | [ERROR_STORAGE_WRITE](https://developer.android.com/reference/kotlin/android/media/MediaDrm.ErrorCodes#ERROR_STORAGE_WRITE:kotlin.Int) The plugin was unable to write data to the filesystem.                                                                                                                                                                                                         |
| static[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) | [ERROR_UNKNOWN](https://developer.android.com/reference/kotlin/android/media/MediaDrm.ErrorCodes#ERROR_UNKNOWN:kotlin.Int) ERROR_UNKNOWN is used where no other defined error code is applicable to the current failure.                                                                                                                                                                              |
| static[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) | [ERROR_UNSUPPORTED_OPERATION](https://developer.android.com/reference/kotlin/android/media/MediaDrm.ErrorCodes#ERROR_UNSUPPORTED_OPERATION:kotlin.Int) An operation was attempted that could not be supported by the crypto system of the device in its current configuration.                                                                                                                        |
| static[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) | [ERROR_ZERO_SUBSAMPLES](https://developer.android.com/reference/kotlin/android/media/MediaDrm.ErrorCodes#ERROR_ZERO_SUBSAMPLES:kotlin.Int) [MediaCodec.queueSecureInputBuffer](https://developer.android.com/reference/kotlin/android/media/MediaCodec#queueSecureInputBuffer(kotlin.Int,%20kotlin.Int,%20android.media.MediaCodec.CryptoInfo,%20kotlin.Long,%20kotlin.Int))called with 0 subsamples. |

## Constants

### ERROR_CERTIFICATE_MALFORMED

Added in[API level 31](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
static val ERROR_CERTIFICATE_MALFORMED: Int
```

Certificate is malformed or is of the wrong type.

Ensure the certificate provided by the app or returned from the license server is valid. Check with the[MediaDrm](https://developer.android.com/reference/kotlin/android/media/MediaDrm)plugin vendor for the expected certificate format.  

    Value: 10

### ERROR_CERTIFICATE_MISSING

Added in[API level 31](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
static val ERROR_CERTIFICATE_MISSING: Int
```

Certificate has not been set.

Ensure the certificate has been provided by the app. Check with the[MediaDrm](https://developer.android.com/reference/kotlin/android/media/MediaDrm)plugin vendor for the expected method to provide[MediaDrm](https://developer.android.com/reference/kotlin/android/media/MediaDrm)a certificate.  

    Value: 11

### ERROR_CRYPTO_LIBRARY

Added in[API level 31](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
static val ERROR_CRYPTO_LIBRARY: Int
```

An error happened within the crypto library used by the drm plugin.  

    Value: 12

### ERROR_FRAME_TOO_LARGE

Added in[API level 31](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
static val ERROR_FRAME_TOO_LARGE: Int
```

The video frame being decrypted exceeds the size of the device's protected output buffers.

When encountering this error the app should try playing content of a lower resolution or skipping the problematic frame.  

    Value: 8

### ERROR_GENERIC_OEM

Added in[API level 31](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
static val ERROR_GENERIC_OEM: Int
```

Unexpected error reported by the device OEM subsystem.

Please see the general error handling strategy for unexpected errors described in[ErrorCodes](https://developer.android.com/reference/kotlin/android/media/MediaDrm.ErrorCodes#).  

    Value: 13

### ERROR_GENERIC_PLUGIN

Added in[API level 31](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
static val ERROR_GENERIC_PLUGIN: Int
```

Unexpected internal failure in[MediaDrm](https://developer.android.com/reference/kotlin/android/media/MediaDrm)/[MediaCrypto](https://developer.android.com/reference/kotlin/android/media/MediaCrypto).

Please see the general error handling strategy for unexpected errors described in[ErrorCodes](https://developer.android.com/reference/kotlin/android/media/MediaDrm.ErrorCodes#).  

    Value: 14

### ERROR_INIT_DATA

Added in[API level 31](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
static val ERROR_INIT_DATA: Int
```

The init data parameter passed to[MediaDrm.getKeyRequest](https://developer.android.com/reference/kotlin/android/media/MediaDrm#getKeyRequest(kotlin.ByteArray,%20kotlin.ByteArray,%20kotlin.String,%20kotlin.Int,%20java.util.HashMap))is empty or invalid.

Init data is typically obtained from[android.media.MediaExtractor#getPsshInfo()](https://developer.android.com/reference/kotlin/android/media/MediaExtractor#getPsshInfo())or[android.media.MediaExtractor#getDrmInitData()](https://developer.android.com/reference/kotlin/android/media/MediaExtractor#getDrmInitData()). Check with the[MediaDrm](https://developer.android.com/reference/kotlin/android/media/MediaDrm)plugin vendor for the expected init data format.  

    Value: 15

### ERROR_INSUFFICIENT_OUTPUT_PROTECTION

Added in[API level 31](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
static val ERROR_INSUFFICIENT_OUTPUT_PROTECTION: Int
```

The output protection levels supported by the device are not sufficient to meet the requirements set by the content owner in the license policy.  

    Value: 4

### ERROR_INSUFFICIENT_SECURITY

Added in[API level 31](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
static val ERROR_INSUFFICIENT_SECURITY: Int
```

The security level of the device is not sufficient to meet the requirements set by the content owner in the license policy.  

    Value: 7

### ERROR_KEY_EXPIRED

Added in[API level 31](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
static val ERROR_KEY_EXPIRED: Int
```

The key used for decryption is no longer valid due to license term expiration.

The operation can be retried after updating the expired keys.  

    Value: 2

### ERROR_KEY_NOT_LOADED

Added in[API level 31](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
static val ERROR_KEY_NOT_LOADED: Int
```

Either the key was not loaded from the license before attempting the operation, or the key ID parameter provided by the app is incorrect.

Ensure the proper keys are in the license, and check the key ID parameter provided by the app is correct. Check with the[MediaDrm](https://developer.android.com/reference/kotlin/android/media/MediaDrm)plugin vendor for the expected license format.  

    Value: 16

### ERROR_LICENSE_PARSE

Added in[API level 31](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
static val ERROR_LICENSE_PARSE: Int
```

The license response was empty, fields are missing or otherwise unable to be parsed or decrypted.

Check for mistakes such as empty or overwritten buffers. Otherwise, check with the[MediaDrm](https://developer.android.com/reference/kotlin/android/media/MediaDrm)plugin vendor for the expected license format.  

    Value: 17

### ERROR_LICENSE_POLICY

Added in[API level 31](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
static val ERROR_LICENSE_POLICY: Int
```

The operation (e.g. to renew or persist a license) is prohibited by the license policy.

Check the license policy configuration on the license server.  

    Value: 18

### ERROR_LICENSE_RELEASE

Added in[API level 31](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
static val ERROR_LICENSE_RELEASE: Int
```

Failed to generate a release request because a field in the offline license is empty or malformed.

The license can't be released on the server, but the app may remove the offline license explicitly using[android.media.MediaDrm#removeOfflineLicense](https://developer.android.com/reference/kotlin/android/media/MediaDrm#removeOfflineLicense(kotlin.ByteArray)).  

    Value: 19

### ERROR_LICENSE_REQUEST_REJECTED

Added in[API level 31](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
static val ERROR_LICENSE_REQUEST_REJECTED: Int
```

The license server detected an error in the license request.

Check for errors on the license server.  

    Value: 20

### ERROR_LICENSE_RESTORE

Added in[API level 31](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
static val ERROR_LICENSE_RESTORE: Int
```

Failed to restore an offline license because a field in the offline license is empty or malformed.

Try requesting the license again if the device is online.  

    Value: 21

### ERROR_LICENSE_STATE

Added in[API level 31](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
static val ERROR_LICENSE_STATE: Int
```

Offline license is in an invalid state for the attempted operation.

Check the sequence of API calls made that can affect offline license state. For example, this could happen when the app attempts to restore a license after it has been released.  

    Value: 22

### ERROR_LOST_STATE

Added in[API level 31](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
static val ERROR_LOST_STATE: Int
```

The session state has been invalidated. This can occur on devices that are not capable of retaining crypto session state across device suspend/resume.

The session must be closed and a new session opened to resume operation.  

    Value: 9

### ERROR_MEDIA_FRAMEWORK

Added in[API level 31](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
static val ERROR_MEDIA_FRAMEWORK: Int
```

Failure in the media framework.

Try releasing media resources (e.g.[MediaCodec](https://developer.android.com/reference/kotlin/android/media/MediaCodec),[MediaDrm](https://developer.android.com/reference/kotlin/android/media/MediaDrm)), and restarting playback.  

    Value: 23

### ERROR_NO_KEY

Added in[API level 31](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
static val ERROR_NO_KEY: Int
```

The requested key was not found when trying to perform a decrypt operation.

The operation can be retried after adding the correct decryption key.  

    Value: 1

### ERROR_PROVISIONING_CERTIFICATE

Added in[API level 31](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
static val ERROR_PROVISIONING_CERTIFICATE: Int
```

Error loading the provisioned certificate.

Re-provisioning may resolve the problem; check with the[MediaDrm](https://developer.android.com/reference/kotlin/android/media/MediaDrm)plugin vendor for re-provisioning instructions. Otherwise, using a different security level may resolve the issue.  

    Value: 24

### ERROR_PROVISIONING_CONFIG

Added in[API level 31](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
static val ERROR_PROVISIONING_CONFIG: Int
```

Required steps were not performed before provisioning was attempted.

Ask the[MediaDrm](https://developer.android.com/reference/kotlin/android/media/MediaDrm)plugin vendor for situations where this error may occur.  

    Value: 25

### ERROR_PROVISIONING_PARSE

Added in[API level 31](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
static val ERROR_PROVISIONING_PARSE: Int
```

The provisioning response was empty, fields are missing or otherwise unable to be parsed.

Check for mistakes such as empty or overwritten buffers. Otherwise, check with the[MediaDrm](https://developer.android.com/reference/kotlin/android/media/MediaDrm)plugin vendor for the expected provisioning response format.  

    Value: 26

### ERROR_PROVISIONING_REQUEST_REJECTED

Added in[API level 31](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
static val ERROR_PROVISIONING_REQUEST_REJECTED: Int
```

The provisioning server detected an error in the provisioning request.

Check for errors on the provisioning server.  

    Value: 27

### ERROR_PROVISIONING_RETRY

Added in[API level 31](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
static val ERROR_PROVISIONING_RETRY: Int
```

Provisioning failed in a way that is likely to succeed on a subsequent attempt.

The app should retry the operation.  

    Value: 28

### ERROR_RESOURCE_BUSY

Added in[API level 31](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
static val ERROR_RESOURCE_BUSY: Int
```

A required crypto resource was not able to be allocated while attempting the requested operation.

The operation can be retried if the app is able to release resources.  

    Value: 3

### ERROR_RESOURCE_CONTENTION

Added in[API level 31](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
static val ERROR_RESOURCE_CONTENTION: Int
```

This indicates that apps using MediaDrm sessions are temporarily exceeding the capacity of available crypto resources.

The app should retry the operation later.  

    Value: 29

### ERROR_SECURE_STOP_RELEASE

Added in[API level 31](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
static val ERROR_SECURE_STOP_RELEASE: Int
```

Failed to generate a secure stop request because a field in the stored license is empty or malformed.

The secure stop can't be released on the server, but the app may remove it explicitly using[MediaDrm.removeSecureStop](https://developer.android.com/reference/kotlin/android/media/MediaDrm#removeSecureStop(kotlin.ByteArray)).  

    Value: 30

### ERROR_SESSION_NOT_OPENED

Added in[API level 31](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
static val ERROR_SESSION_NOT_OPENED: Int
```

Decryption was attempted on a session that is not opened, which could be due to a failure to open the session, closing the session prematurely, the session being reclaimed by the resource manager, or a non-existent session id.  

    Value: 5

### ERROR_STORAGE_READ

Added in[API level 31](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
static val ERROR_STORAGE_READ: Int
```

The plugin was unable to read data from the filesystem.

Please see the general error handling strategy for unexpected errors described in[ErrorCodes](https://developer.android.com/reference/kotlin/android/media/MediaDrm.ErrorCodes#).  

    Value: 31

### ERROR_STORAGE_WRITE

Added in[API level 31](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
static val ERROR_STORAGE_WRITE: Int
```

The plugin was unable to write data to the filesystem.

Please see the general error handling strategy for unexpected errors described in[ErrorCodes](https://developer.android.com/reference/kotlin/android/media/MediaDrm.ErrorCodes#).  

    Value: 32

### ERROR_UNKNOWN

Added in[API level 31](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
static val ERROR_UNKNOWN: Int
```

ERROR_UNKNOWN is used where no other defined error code is applicable to the current failure.

Please see the general error handling strategy for unexpected errors described in[ErrorCodes](https://developer.android.com/reference/kotlin/android/media/MediaDrm.ErrorCodes#).  

    Value: 0

### ERROR_UNSUPPORTED_OPERATION

Added in[API level 31](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
static val ERROR_UNSUPPORTED_OPERATION: Int
```

An operation was attempted that could not be supported by the crypto system of the device in its current configuration.

This may occur when the license policy requires device security features that aren't supported by the device, or due to an internal error in the crypto system that prevents the specified security policy from being met.  

    Value: 6

### ERROR_ZERO_SUBSAMPLES

Added in[API level 31](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
static val ERROR_ZERO_SUBSAMPLES: Int
```

[MediaCodec.queueSecureInputBuffer](https://developer.android.com/reference/kotlin/android/media/MediaCodec#queueSecureInputBuffer(kotlin.Int,%20kotlin.Int,%20android.media.MediaCodec.CryptoInfo,%20kotlin.Long,%20kotlin.Int))called with 0 subsamples.

Check the[MediaCodec.CryptoInfo](https://developer.android.com/reference/kotlin/android/media/MediaCodec.CryptoInfo)object passed to[android.media.MediaCodec#queueSecureInputBuffer](https://developer.android.com/reference/kotlin/android/media/MediaCodec#queueSecureInputBuffer(kotlin.Int,%20kotlin.Int,%20android.media.MediaCodec.CryptoInfo,%20kotlin.Long,%20kotlin.Int)).  

    Value: 33