Stay organized with collections
Save and categorize content based on your preferences.
KeyStatus
class KeyStatus
Defines the status of a key. A KeyStatus for each key in a session is provided to the OnKeyStatusChangeListener.onKeyStatusChange
listener.
Summary
Constants |
static Int |
The key is no longer usable to decrypt media data because its expiration time has passed.
|
static Int |
The key is not currently usable to decrypt media data because of an internal error in processing unrelated to input parameters.
|
static Int |
The key is not currently usable to decrypt media data because its output requirements cannot currently be met.
|
static Int |
The status of the key is not yet known and is being determined.
|
static Int |
The key is currently usable to decrypt media data
|
static Int |
The key is not yet usable to decrypt media because the start time is in the future.
|
Public methods |
ByteArray |
Returns the id for the key
|
Int |
Returns the status code for the key
|
Constants
STATUS_EXPIRED
static val STATUS_EXPIRED: Int
The key is no longer usable to decrypt media data because its expiration time has passed.
Value: 1
STATUS_INTERNAL_ERROR
static val STATUS_INTERNAL_ERROR: Int
The key is not currently usable to decrypt media data because of an internal error in processing unrelated to input parameters. This error is not actionable by an app.
Value: 4
STATUS_OUTPUT_NOT_ALLOWED
static val STATUS_OUTPUT_NOT_ALLOWED: Int
The key is not currently usable to decrypt media data because its output requirements cannot currently be met.
Value: 2
STATUS_PENDING
static val STATUS_PENDING: Int
The status of the key is not yet known and is being determined. The status will be updated with the actual status when it has been determined.
Value: 3
STATUS_USABLE
static val STATUS_USABLE: Int
The key is currently usable to decrypt media data
Value: 0
STATUS_USABLE_IN_FUTURE
static val STATUS_USABLE_IN_FUTURE: Int
The key is not yet usable to decrypt media because the start time is in the future. The key will become usable when its start time is reached.
Value: 5
Public methods
getKeyId
fun getKeyId(): ByteArray
Returns the id for the key
getStatusCode
fun getStatusCode(): Int
Returns the status code for the key
Content and code samples on this page are subject to the licenses described in the Content License. Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.
Last updated 2025-02-10 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-02-10 UTC."],[],[],null,["# MediaDrm.KeyStatus\n\nAdded in [API level 23](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)\n\nKeyStatus\n=========\n\n*** ** * ** ***\n\nKotlin \\|[Java](/reference/android/media/MediaDrm.KeyStatus \"View this page in Java\") \n\n```\nclass KeyStatus\n```\n\n|---|---------------------------------------|\n| [kotlin.Any](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-any/index.html) ||\n| ↳ | [android.media.MediaDrm.KeyStatus](#) |\n\nDefines the status of a key. A KeyStatus for each key in a session is provided to the [OnKeyStatusChangeListener.onKeyStatusChange](/reference/kotlin/android/media/MediaDrm.OnKeyStatusChangeListener#onKeyStatusChange(android.media.MediaDrm,%20kotlin.ByteArray,%20kotlin.collections.MutableList,%20kotlin.Boolean)) listener.\n\nSummary\n-------\n\n| Constants ||\n|-----------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| static [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) | [STATUS_EXPIRED](#STATUS_EXPIRED:kotlin.Int) The key is no longer usable to decrypt media data because its expiration time has passed. |\n| static [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) | [STATUS_INTERNAL_ERROR](#STATUS_INTERNAL_ERROR:kotlin.Int) The key is not currently usable to decrypt media data because of an internal error in processing unrelated to input parameters. |\n| static [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) | [STATUS_OUTPUT_NOT_ALLOWED](#STATUS_OUTPUT_NOT_ALLOWED:kotlin.Int) The key is not currently usable to decrypt media data because its output requirements cannot currently be met. |\n| static [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) | [STATUS_PENDING](#STATUS_PENDING:kotlin.Int) The status of the key is not yet known and is being determined. |\n| static [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) | [STATUS_USABLE](#STATUS_USABLE:kotlin.Int) The key is currently usable to decrypt media data |\n| static [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) | [STATUS_USABLE_IN_FUTURE](#STATUS_USABLE_IN_FUTURE:kotlin.Int) The key is not yet usable to decrypt media because the start time is in the future. |\n\n| Public methods ||\n|-----------------------------------------------------------------------------------------|---------------------------------------------------------------------------|\n| [ByteArray](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-byte-array/index.html) | [getKeyId](#getKeyId())`()` Returns the id for the key |\n| [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) | [getStatusCode](#getStatusCode())`()` Returns the status code for the key |\n\nConstants\n---------\n\n### STATUS_EXPIRED\n\nAdded in [API level 23](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nstatic val STATUS_EXPIRED: Int\n```\n\nThe key is no longer usable to decrypt media data because its expiration time has passed. \n\n Value: 1\n\n### STATUS_INTERNAL_ERROR\n\nAdded in [API level 23](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nstatic val STATUS_INTERNAL_ERROR: Int\n```\n\nThe key is not currently usable to decrypt media data because of an internal error in processing unrelated to input parameters. This error is not actionable by an app. \n\n Value: 4\n\n### STATUS_OUTPUT_NOT_ALLOWED\n\nAdded in [API level 23](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nstatic val STATUS_OUTPUT_NOT_ALLOWED: Int\n```\n\nThe key is not currently usable to decrypt media data because its output requirements cannot currently be met. \n\n Value: 2\n\n### STATUS_PENDING\n\nAdded in [API level 23](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nstatic val STATUS_PENDING: Int\n```\n\nThe status of the key is not yet known and is being determined. The status will be updated with the actual status when it has been determined. \n\n Value: 3\n\n### STATUS_USABLE\n\nAdded in [API level 23](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nstatic val STATUS_USABLE: Int\n```\n\nThe key is currently usable to decrypt media data \n\n Value: 0\n\n### STATUS_USABLE_IN_FUTURE\n\nAdded in [API level 29](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nstatic val STATUS_USABLE_IN_FUTURE: Int\n```\n\nThe key is not yet usable to decrypt media because the start time is in the future. The key will become usable when its start time is reached. \n\n Value: 5\n\nPublic methods\n--------------\n\n### getKeyId\n\nAdded in [API level 23](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nfun getKeyId(): ByteArray\n```\n\nReturns the id for the key\n\n| Return ||\n|-----------------------------------------------------------------------------------------|------------------------------|\n| [ByteArray](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-byte-array/index.html) | This value cannot be `null`. |\n\n### getStatusCode\n\nAdded in [API level 23](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nfun getStatusCode(): Int\n```\n\nReturns the status code for the key\n\n| Return ||\n|----------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) | Value is [android.media.MediaDrm.KeyStatus#STATUS_USABLE](#STATUS_USABLE:kotlin.Int), [android.media.MediaDrm.KeyStatus#STATUS_EXPIRED](#STATUS_EXPIRED:kotlin.Int), [android.media.MediaDrm.KeyStatus#STATUS_OUTPUT_NOT_ALLOWED](#STATUS_OUTPUT_NOT_ALLOWED:kotlin.Int), [android.media.MediaDrm.KeyStatus#STATUS_PENDING](#STATUS_PENDING:kotlin.Int), [android.media.MediaDrm.KeyStatus#STATUS_INTERNAL_ERROR](#STATUS_INTERNAL_ERROR:kotlin.Int), or [android.media.MediaDrm.KeyStatus#STATUS_USABLE_IN_FUTURE](#STATUS_USABLE_IN_FUTURE:kotlin.Int) |"]]