1# Drm 2 3 4## Overview 5 6The Digital Rights Management (DRM) module provides C APIs to implement digital rights protection. 7 8You can refer to the corresponding development guide and samples based on your development requirements. 9 10- [DRM Development (C/C++)](../../media/drm/drm-c-dev-guide.md) 11- [Using AVCodec to Play DRM Content (C/C++)](../../media/drm/drm-avcodec-integration.md) 12 13 14**Since**: 11 15 16 17## Summary 18 19 20### Files 21 22| Name| Description| 23| -------- | -------- | 24| [native_drm_common.h](native__drm__common_8h.md) | Declares the DRM data types.| 25| [native_drm_err.h](native__drm__err_8h.md) | Declares the DRM error codes.| 26| [native_mediakeysession.h](native__mediakeysession_8h.md) | Declares the **MediaKeySession** APIs.| 27| [native_mediakeysystem.h](native__mediakeysystem_8h.md) | Declares the **MediaKeySystem** APIs.| 28 29 30### Structs 31 32| Name| Description| 33| -------- | -------- | 34| struct [DRM_MediaKeyRequestInfo](_d_r_m___media_key_request_info.md) | Describes the information about a media key request.| 35| struct [DRM_MediaKeyRequest](_d_r_m___media_key_request.md) | Describes a media key request.| 36| struct [DRM_Statistics](_d_r_m___statistics.md) | Describes the statistical information of a media key system.| 37| struct [DRM_OfflineMediakeyIdArray](_d_r_m___offline_mediakey_id_array.md) | Describes an array holding the IDs of offline media keys.| 38| struct [DRM_KeysInfo](_d_r_m___keys_info.md) | Describes the information about media keys.| 39| struct [DRM_MediaKeyStatus](_d_r_m___media_key_status.md) | Describes the media key status.| 40| struct [DRM_PsshInfo](_d_r_m___pssh_info.md) | Describes the Protection System Specific Header (PSSH) in DRM information.| 41| struct [DRM_MediaKeySystemInfo](_d_r_m___media_key_system_info.md) | Describes the DRM information, which is used to encrypt content.| 42| struct [MediaKeySession_Callback](_media_key_session___callback.md) | Describes a media key session callback, which is used to listen for events such as key changes. This struct applies to the scenario where a single media file is decrypted.| 43| struct [OH_MediaKeySession_Callback](_o_h___media_key_session___callback.md) | Describes a media key session callback, which is used to listen for events such as key changes. This struct applies to the scenario where multiple media files are decrypted.| 44| struct [DRM_MediaKeySystemDescription](_d_r_m___media_key_system_description.md) | Describes the DRM solution name and UUID list. | 45 46 47### Macros 48 49| Name| Description| 50| -------- | -------- | 51| [MAX_MEDIA_KEY_REQUEST_OPTION_COUNT](#max_media_key_request_option_count) 16 | Maximum number of optional data items in a media key request.| 52| [MAX_MEDIA_KEY_REQUEST_OPTION_NAME_LEN](#max_media_key_request_option_name_len) 64 | Maximum length of an optional data name in a media key request.| 53| [MAX_MEDIA_KEY_REQUEST_OPTION_DATA_LEN](#max_media_key_request_option_data_len) 128 | Maximum length of optional data in a media key request.| 54| [MAX_INIT_DATA_LEN](#max_init_data_len) 2048 | Maximum length of data in an initial request.| 55| [MAX_MIMETYPE_LEN](#max_mimetype_len) 64 | Maximum length of a MIME type.| 56| [MAX_MEDIA_KEY_REQUEST_DATA_LEN](#max_media_key_request_data_len) 8192 | Maximum length of data in a media key request.| 57| [MAX_DEFAULT_URL_LEN](#max_default_url_len) 2048 | Maximum length of a URL.| 58| [MAX_STATISTICS_COUNT](#max_statistics_count) 10 | Maximum number of statistical items.| 59| [MAX_STATISTICS_NAME_LEN](#max_statistics_name_len) 64 | Maximum length of a statistical item name.| 60| [MAX_STATISTICS_BUFFER_LEN](#max_statistics_buffer_len) 256 | Maximum length of a statistical item buffer.| 61| [MAX_OFFLINE_MEDIA_KEY_ID_COUNT](#max_offline_media_key_id_count) 512 | Maximum number of offline media key IDs.| 62| [MAX_OFFLINE_MEDIA_KEY_ID_LEN](#max_offline_media_key_id_len) 64 | Maximum length of an offline media key ID.| 63| [MAX_KEY_INFO_COUNT](#max_key_info_count) 64 | Maximum number of pieces of media key information.| 64| [MAX_KEY_ID_LEN](#max_key_id_len) 16 | Maximum length of a media key ID.| 65| [MAX_KEY_STATUS_VALUE_LEN](#max_key_status_value_len) 128 | Maximum length of a key status value.| 66| [MAX_MEDIA_KEY_STATUS_COUNT](#max_media_key_status_count) 64 | Maximum number of media key statuses.| 67| [MAX_MEDIA_KEY_STATUS_NAME_LEN](#max_media_key_status_name_len) 64 | Maximum length of a media key status name.| 68| [MAX_MEDIA_KEY_STATUS_VALUE_LEN](#max_media_key_status_value_len) 256 | Maximum length of a media key status value.| 69| [DRM_UUID_LEN](#drm_uuid_len) 16 | Length of the UUID of a DRM solution.| 70| [MAX_PSSH_DATA_LEN](#max_pssh_data_len) 2048 | Maximum length of PSSH data.| 71| [MAX_PSSH_INFO_COUNT](#max_pssh_info_count) 8 | Maximum number of pieces of PSSH data.| 72| [MAX_MEDIA_KEY_SYSTEM_NAME_LEN](#max_media_key_system_name_len) 128 | Maximum length of a **MediaKeySystem** instance name. | 73| [MAX_MEDIA_KEY_SYSTEM_NUM](#max_media_key_system_num) 8 | Maximum number of **MediaKeySystem** instances. | 74 75 76### Types 77 78| Name| Description| 79| -------- | -------- | 80| typedef enum [DRM_EventType](#drm_eventtype-1) [DRM_EventType](#drm_eventtype) | Defines an enum for the types of events that can be subscribed to.| 81| typedef enum [DRM_ContentProtectionLevel](#drm_contentprotectionlevel-1) [DRM_ContentProtectionLevel](#drm_contentprotectionlevel) | Defines an enum for the content protection levels.| 82| typedef enum [DRM_MediaKeyType](#drm_mediakeytype-1) [DRM_MediaKeyType](#drm_mediakeytype) | Defines an enum for the types of media keys.| 83| typedef enum [DRM_MediaKeyRequestType](#drm_mediakeyrequesttype-1) [DRM_MediaKeyRequestType](#drm_mediakeyrequesttype) | Defines an enum for the types of media key requests.| 84| typedef enum [DRM_OfflineMediaKeyStatus](#drm_offlinemediakeystatus-1) [DRM_OfflineMediaKeyStatus](#drm_offlinemediakeystatus) | Defines an enum for the statuses of offline media keys.| 85| typedef enum [DRM_CertificateStatus](#drm_certificatestatus-1) [DRM_CertificateStatus](#drm_certificatestatus) | Defines an enum for the DRM certificate statuses.| 86| typedef struct [DRM_MediaKeyRequestInfo](_d_r_m___media_key_request_info.md) [DRM_MediaKeyRequestInfo](#drm_mediakeyrequestinfo) | Defines a struct for the information about a media key request.| 87| typedef struct [DRM_MediaKeyRequest](_d_r_m___media_key_request.md) [DRM_MediaKeyRequest](#drm_mediakeyrequest) | Defines a struct for a media key request.| 88| typedef struct [DRM_Statistics](_d_r_m___statistics.md) [DRM_Statistics](#drm_statistics) | Defines a struct for the statistical information of a media key system.| 89| typedef struct [DRM_OfflineMediakeyIdArray](_d_r_m___offline_mediakey_id_array.md) [DRM_OfflineMediakeyIdArray](#drm_offlinemediakeyidarray) | Defines a struct for the array holding the IDs of offline media keys.| 90| typedef struct [DRM_KeysInfo](_d_r_m___keys_info.md) [DRM_KeysInfo](#drm_keysinfo) | Defines a struct for the information about media keys.| 91| typedef struct [DRM_MediaKeyStatus](_d_r_m___media_key_status.md) [DRM_MediaKeyStatus](#drm_mediakeystatus) | Defines a struct for the media key status.| 92| typedef struct [DRM_PsshInfo](_d_r_m___pssh_info.md) [DRM_PsshInfo](#drm_psshinfo) | Defines a struct for PSSH data in DRM information.| 93| typedef struct [DRM_MediaKeySystemInfo](_d_r_m___media_key_system_info.md) [DRM_MediaKeySystemInfo](#drm_mediakeysysteminfo) | Defines a struct for the DRM information, which is used to encrypt content.| 94| typedef struct [DRM_MediaKeySystemDescription](_d_r_m___media_key_system_description.md) [DRM_MediaKeySystemDescription](#drm_mediakeysystemdescription) | Defines a struct for the DRM solution name and UUID list. | 95| typedef void(\* [DRM_MediaKeySystemInfoCallback](#drm_mediakeysysteminfocallback)) ([DRM_MediaKeySystemInfo](_d_r_m___media_key_system_info.md) \*mediaKeySystemInfo) | Defines a callback for media key system information.| 96| typedef struct [MediaKeySystem](#mediakeysystem) [MediaKeySystem](#mediakeysystem) | Defines a struct for a media key system.| 97| typedef struct [MediaKeySession](#mediakeysession) [MediaKeySession](#mediakeysession) | Defines a struct for a media key session.| 98| typedef enum [Drm_ErrCode](#drm_errcode-1) [Drm_ErrCode](#drm_errcode) | Defines an enum for the DRM error codes.| 99| typedef [Drm_ErrCode](#drm_errcode)(\* [MediaKeySession_EventCallback](#mediakeysession_eventcallback)) ([DRM_EventType](#drm_eventtype) eventType, uint8_t \*info, int32_t infoLen, char \*extra) | Defines the callback that is invoked when a media key session event is triggered. No **MediaKeySession** instance is returned. This callback applies to the scenario where a single media file is decrypted.| 100| typedef [Drm_ErrCode](#drm_errcode)(\* [MediaKeySession_KeyChangeCallback](#mediakeysession_keychangecallback)) ([DRM_KeysInfo](_d_r_m___keys_info.md) \*keysInfo, bool newKeysAvailable) | Defines the callback that is invoked when the media key in a **MediaKeySession** instance is changed. No **MediaKeySession** instance is returned. This callback applies to the scenario where a single media file is decrypted.| 101| typedef struct [MediaKeySession_Callback](_media_key_session___callback.md) [MediaKeySession_Callback](#mediakeysession_callback) | Defines a struct for the media key session callback. This struct applies to the scenario where a single media file is decrypted.| 102| typedef [Drm_ErrCode](#drm_errcode)(\* [OH_MediaKeySession_EventCallback](#oh_mediakeysession_eventcallback)) ([MediaKeySession](#mediakeysession) \*mediaKeySession, [DRM_EventType](#drm_eventtype) eventType, uint8_t \*info, int32_t infoLen, char \*extra) | Defines the callback that is invoked when a media key session event is triggered. A **MediaKeySession** instance is returned. This callback applies to the scenario where multiple media files are decrypted.| 103| typedef [Drm_ErrCode](#drm_errcode)(\* [OH_MediaKeySession_KeyChangeCallback](#oh_mediakeysession_keychangecallback)) ([MediaKeySession](#mediakeysession) \*mediaKeySession, [DRM_KeysInfo](_d_r_m___keys_info.md) \*keysInfo, bool newKeysAvailable) | Defines the callback that is invoked when the media key in a **MediaKeySession** instance is changed. A **MediaKeySession** instance is returned. This callback applies to the scenario where multiple media files are decrypted.| 104| typedef struct [OH_MediaKeySession_Callback](_o_h___media_key_session___callback.md) [OH_MediaKeySession_Callback](#oh_mediakeysession_callback) | Defines a struct for the media key session callback. This struct applies to the scenario where multiple media files are decrypted.| 105| typedef [Drm_ErrCode](#drm_errcode)(\* [MediaKeySystem_Callback](#mediakeysystem_callback)) ([DRM_EventType](#drm_eventtype) eventType, uint8_t \*info, int32_t infoLen, char \*extra) | Defines the callback that is invoked when a media key system event is triggered. No **MediaKeySystem** instance is returned. This callback applies to the scenario where a single **MediaKeySystem** instance is used.| 106| typedef [Drm_ErrCode](#drm_errcode)(\* [OH_MediaKeySystem_Callback](#oh_mediakeysystem_callback)) (MediaKeySystem \*mediaKeySystem, [DRM_EventType](#drm_eventtype) eventType, uint8_t \*info, int32_t infoLen, char \*extra) | Defines the callback that is invoked when a media key system event is triggered. A **MediaKeySystem** instance is returned. This callback applies to the scenario where multiple **MediaKeySystem** instances are used.| 107 108 109### Enums 110 111| Name| Description| 112| -------- | -------- | 113| [DRM_EventType](#drm_eventtype-1) {<br>EVENT_DRM_BASE = 200, <br>EVENT_PROVISION_REQUIRED = 201, <br>EVENT_KEY_REQUIRED = 202, <br>EVENT_KEY_EXPIRED = 203,<br>EVENT_VENDOR_DEFINED = 204, <br>EVENT_EXPIRATION_UPDATE = 206<br>} | Enumerates the event types.| 114| [DRM_ContentProtectionLevel](#drm_contentprotectionlevel-1) {<br>CONTENT_PROTECTION_LEVEL_UNKNOWN = 0, <br>CONTENT_PROTECTION_LEVEL_SW_CRYPTO, <br>CONTENT_PROTECTION_LEVEL_HW_CRYPTO, <br>CONTENT_PROTECTION_LEVEL_ENHANCED_HW_CRYPTO,<br>CONTENT_PROTECTION_LEVEL_MAX<br>} | Enumerates the content protection levels.| 115| [DRM_MediaKeyType](#drm_mediakeytype-1) { <br>MEDIA_KEY_TYPE_OFFLINE = 0, <br>MEDIA_KEY_TYPE_ONLINE <br>} | Enumerates the types of media keys.| 116| [DRM_MediaKeyRequestType](#drm_mediakeyrequesttype-1) {<br>MEDIA_KEY_REQUEST_TYPE_UNKNOWN = 0, <br>MEDIA_KEY_REQUEST_TYPE_INITIAL, <br>MEDIA_KEY_REQUEST_TYPE_RENEWAL, <br>MEDIA_KEY_REQUEST_TYPE_RELEASE,<br>MEDIA_KEY_REQUEST_TYPE_NONE, <br>MEDIA_KEY_REQUEST_TYPE_UPDATE<br>} | Enumerates the types of media key requests.| 117| [DRM_OfflineMediaKeyStatus](#drm_offlinemediakeystatus-1) { <br>OFFLINE_MEDIA_KEY_STATUS_UNKNOWN = 0, <br>OFFLINE_MEDIA_KEY_STATUS_USABLE, <br>OFFLINE_MEDIA_KEY_STATUS_INACTIVE } | Enumerates the statuses of offline media keys.| 118| [DRM_CertificateStatus](#drm_certificatestatus-1) {<br>CERT_STATUS_PROVISIONED = 0, <br>CERT_STATUS_NOT_PROVISIONED, <br>CERT_STATUS_EXPIRED, <br>CERT_STATUS_INVALID,<br>CERT_STATUS_UNAVAILABLE<br>} | Enumerates the DRM certificate statuses.| 119| [Drm_ErrCode](#drm_errcode-1) {<br>DRM_ERR_OK = 0, <br>DRM_CAPI_ERR_BASE = 24700500, <br>DRM_ERR_NO_MEMORY = DRM_CAPI_ERR_BASE + 1, <br>DRM_ERR_OPERATION_NOT_PERMITTED = DRM_CAPI_ERR_BASE + 2,<br>DRM_ERR_INVALID_VAL = DRM_CAPI_ERR_BASE + 3, <br>DRM_ERR_IO = DRM_CAPI_ERR_BASE + 4, <br>DRM_ERR_TIMEOUT = DRM_CAPI_ERR_BASE + 5, <br>DRM_ERR_UNKNOWN = DRM_CAPI_ERR_BASE + 6,<br>DRM_ERR_SERVICE_DIED = DRM_CAPI_ERR_BASE + 7, <br>DRM_ERR_INVALID_STATE = DRM_CAPI_ERR_BASE + 8, <br>DRM_ERR_UNSUPPORTED = DRM_CAPI_ERR_BASE + 9, <br>DRM_ERR_MAX_SYSTEM_NUM_REACHED = DRM_CAPI_ERR_BASE + 10,<br>DRM_ERR_MAX_SESSION_NUM_REACHED = DRM_CAPI_ERR_BASE + 11, <br>DRM_ERR_EXTEND_START = DRM_CAPI_ERR_BASE + 100<br>} | Enumerates the DRM error codes.| 120 121 122### Functions 123 124| Name| Description| 125| -------- | -------- | 126| [Drm_ErrCode](#drm_errcode) [OH_MediaKeySession_GenerateMediaKeyRequest](#oh_mediakeysession_generatemediakeyrequest) ([MediaKeySession](#mediakeysession) \*mediaKeySession, [DRM_MediaKeyRequestInfo](_d_r_m___media_key_request_info.md) \*info, [DRM_MediaKeyRequest](_d_r_m___media_key_request.md) \*mediaKeyRequest) | Generates a media key request.| 127| [Drm_ErrCode](#drm_errcode) [OH_MediaKeySession_ProcessMediaKeyResponse](#oh_mediakeysession_processmediakeyresponse) ([MediaKeySession](#mediakeysession) \*mediaKeySession, uint8_t \*response, int32_t responseLen, uint8_t \*offlineMediaKeyId, int32_t \*offlineMediaKeyIdLen) | Processes a media key response.| 128| [Drm_ErrCode](#drm_errcode) [OH_MediaKeySession_CheckMediaKeyStatus](#oh_mediakeysession_checkmediakeystatus) ([MediaKeySession](#mediakeysession) \*mediaKeySession, [DRM_MediaKeyStatus](_d_r_m___media_key_status.md) \*mediaKeyStatus) | Checks the status of media keys.| 129| [Drm_ErrCode](#drm_errcode) [OH_MediaKeySession_ClearMediaKeys](#oh_mediakeysession_clearmediakeys) ([MediaKeySession](#mediakeysession) \*mediaKeySession) | Clears media keys.| 130| [Drm_ErrCode](#drm_errcode) [OH_MediaKeySession_GenerateOfflineReleaseRequest](#oh_mediakeysession_generateofflinereleaserequest) ([MediaKeySession](#mediakeysession) \*mediaKeySession, uint8_t \*offlineMediaKeyId, int32_t offlineMediaKeyIdLen, uint8_t \*releaseRequest, int32_t \*releaseRequestLen) | Generates a request to release offline media keys.| 131| [Drm_ErrCode](#drm_errcode) [OH_MediaKeySession_ProcessOfflineReleaseResponse](#oh_mediakeysession_processofflinereleaseresponse) ([MediaKeySession](#mediakeysession) \*mediaKeySession, uint8_t \*offlineMediaKeyId, int32_t offlineMediaKeyIdLen, uint8_t \*releaseReponse, int32_t releaseReponseLen) | Processes a response to a request for releasing offline media keys.| 132| [Drm_ErrCode](#drm_errcode) [OH_MediaKeySession_RestoreOfflineMediaKeys](#oh_mediakeysession_restoreofflinemediakeys) ([MediaKeySession](#mediakeysession) \*mediaKeySession, uint8_t \*offlineMediaKeyId, int32_t offlineMediaKeyIdLen) | Restores offline media keys.| 133| [Drm_ErrCode](#drm_errcode) [OH_MediaKeySession_GetContentProtectionLevel](#oh_mediakeysession_getcontentprotectionlevel) ([MediaKeySession](#mediakeysession) \*mediaKeySession, [DRM_ContentProtectionLevel](#drm_contentprotectionlevel) \*contentProtectionLevel) | Obtains the content protection level of a media key session.| 134| [Drm_ErrCode](#drm_errcode) [OH_MediaKeySession_RequireSecureDecoderModule](#oh_mediakeysession_requiresecuredecodermodule) ([MediaKeySession](#mediakeysession) \*mediaKeySession, const char \*mimeType, bool \*status) | Checks whether secure decoding is required.| 135| [Drm_ErrCode](#drm_errcode) [OH_MediaKeySession_SetMediaKeySessionCallback](#oh_mediakeysession_setmediakeysessioncallback) ([MediaKeySession](#mediakeysession) \*mediaKeySession, [MediaKeySession_Callback](_media_key_session___callback.md) \*callback) | Sets a media key session event callback. It applies to the scenario where a single media file is decrypted.| 136| [Drm_ErrCode](#drm_errcode) [OH_MediaKeySession_SetCallback](#oh_mediakeysession_setcallback) ([MediaKeySession](#mediakeysession) \*mediaKeySession, [OH_MediaKeySession_Callback](_o_h___media_key_session___callback.md) \*callback) | Sets a media key session event callback. It applies to the scenario where multiple media files are decrypted.| 137| [Drm_ErrCode](#drm_errcode) [OH_MediaKeySession_Destroy](#oh_mediakeysession_destroy) ([MediaKeySession](#mediakeysession) \*mediaKeySession) | Releases a **MediaKeySession** instance.| 138| [Drm_ErrCode](#drm_errcode) [OH_MediaKeySystem_SetCallback](#oh_mediakeysystem_setcallback) ([MediaKeySystem](#mediakeysystem) \*mediaKeySystem, [OH_MediaKeySystem_Callback](#oh_mediakeysystem_callback) callback) | Sets a media key system event callback.| 139| bool [OH_MediaKeySystem_IsSupported](#oh_mediakeysystem_issupported) (const char \*name) | Checks whether the device supports the specified DRM solution.| 140| bool [OH_MediaKeySystem_IsSupported2](#oh_mediakeysystem_issupported2) (const char \*name, const char \*mimeType) | Checks whether the device supports the combination of the DRM solution and MIME type.| 141| bool [OH_MediaKeySystem_IsSupported3](#oh_mediakeysystem_issupported3) (const char \*name, const char \*mimeType, [DRM_ContentProtectionLevel](#drm_contentprotectionlevel) contentProtectionLevel) | Checks whether the device supports the combination of the DRM solution, MIME type, and content protection level.| 142| [Drm_ErrCode](#drm_errcode) [OH_MediaKeySystem_GetMediaKeySystems](#oh_mediakeysystem_getmediakeysystems) ([DRM_MediaKeySystemDescription](#drm_mediakeysystemdescription) \*infos, uint32_t \*count) | Obtains the list of DRM solutions supported by the device.| 143| [Drm_ErrCode](#drm_errcode) [OH_MediaKeySystem_Create](#oh_mediakeysystem_create) (const char \*name, [MediaKeySystem](#mediakeysystem) \*\*mediaKeySystem) | Creates a **MediaKeySystem** instance.| 144| [Drm_ErrCode](#drm_errcode) [OH_MediaKeySystem_SetConfigurationString](#oh_mediakeysystem_setconfigurationstring) ([MediaKeySystem](#mediakeysystem) \*mediaKeySystem, const char \*configName, const char \*value) | Sets a configuration item in the form of a string.| 145| [Drm_ErrCode](#drm_errcode) [OH_MediaKeySystem_GetConfigurationString](#oh_mediakeysystem_getconfigurationstring) ([MediaKeySystem](#mediakeysystem) \*mediaKeySystem, const char \*configName, char \*value, int32_t valueLen) | Obtains the value of a configuration item in the form of a string.| 146| [Drm_ErrCode](#drm_errcode) [OH_MediaKeySystem_SetConfigurationByteArray](#oh_mediakeysystem_setconfigurationbytearray) ([MediaKeySystem](#mediakeysystem) \*mediaKeySystem, const char \*configName, uint8_t \*value, int32_t valueLen) | Sets a configuration item in the form of a byte array.| 147| [Drm_ErrCode](#drm_errcode) [OH_MediaKeySystem_GetConfigurationByteArray](#oh_mediakeysystem_getconfigurationbytearray) ([MediaKeySystem](#mediakeysystem) \*mediaKeySystem, const char \*configName, uint8_t \*value, int32_t \*valueLen) | Obtains the value of a configuration item in the form of a byte array.| 148| [Drm_ErrCode](#drm_errcode) [OH_MediaKeySystem_GetStatistics](#oh_mediakeysystem_getstatistics) ([MediaKeySystem](#mediakeysystem) \*mediaKeySystem, [DRM_Statistics](_d_r_m___statistics.md) \*statistics) | Obtains the statistical information of a media key system.| 149| [Drm_ErrCode](#drm_errcode) [OH_MediaKeySystem_GetMaxContentProtectionLevel](#oh_mediakeysystem_getmaxcontentprotectionlevel) ([MediaKeySystem](#mediakeysystem) \*mediaKeySystem, [DRM_ContentProtectionLevel](#drm_contentprotectionlevel) \*contentProtectionLevel) | Obtains the maximum content protection level supported by the current DRM solution.| 150| [Drm_ErrCode](#drm_errcode) [OH_MediaKeySystem_SetMediaKeySystemCallback](#oh_mediakeysystem_setmediakeysystemcallback) ([MediaKeySystem](#mediakeysystem) \*mediaKeySystem, [MediaKeySystem_Callback](#mediakeysystem_callback) callback) | Sets a media key system event callback.| 151| [Drm_ErrCode](#drm_errcode) [OH_MediaKeySystem_CreateMediaKeySession](#oh_mediakeysystem_createmediakeysession) ([MediaKeySystem](#mediakeysystem) \*mediaKeySystem, [DRM_ContentProtectionLevel](#drm_contentprotectionlevel) \*level, [MediaKeySession](#mediakeysession) \*\*mediaKeySession) | Creates a **MediaKeySession** instance.| 152| [Drm_ErrCode](#drm_errcode) [OH_MediaKeySystem_GenerateKeySystemRequest](#oh_mediakeysystem_generatekeysystemrequest) ([MediaKeySystem](#mediakeysystem) \*mediaKeySystem, uint8_t \*request, int32_t \*requestLen, char \*defaultUrl, int32_t defaultUrlLen) | Generates a provision request.| 153| [Drm_ErrCode](#drm_errcode) [OH_MediaKeySystem_ProcessKeySystemResponse](#oh_mediakeysystem_processkeysystemresponse) ([MediaKeySystem](#mediakeysystem) \*mediaKeySystem, uint8_t \*response, int32_t responseLen) | Processes a provision response.| 154| [Drm_ErrCode](#drm_errcode) [OH_MediaKeySystem_GetOfflineMediaKeyIds](#oh_mediakeysystem_getofflinemediakeyids) ([MediaKeySystem](#mediakeysystem) \*mediaKeySystem, [DRM_OfflineMediakeyIdArray](_d_r_m___offline_mediakey_id_array.md) \*offlineMediaKeyIds) | Obtains the IDs of offline media keys.| 155| [Drm_ErrCode](#drm_errcode) [OH_MediaKeySystem_GetOfflineMediaKeyStatus](#oh_mediakeysystem_getofflinemediakeystatus) ([MediaKeySystem](#mediakeysystem) \*mediaKeySystem, uint8_t \*offlineMediaKeyId, int32_t offlineMediaKeyIdLen, [DRM_OfflineMediaKeyStatus](#drm_offlinemediakeystatus) \*status) | Obtains the status of an offline media key.| 156| [Drm_ErrCode](#drm_errcode) [OH_MediaKeySystem_ClearOfflineMediaKeys](#oh_mediakeysystem_clearofflinemediakeys) ([MediaKeySystem](#mediakeysystem) \*mediaKeySystem, uint8_t \*offlineMediaKeyId, int32_t offlineMediaKeyIdLen) | Clears offline media keys.| 157| [Drm_ErrCode](#drm_errcode) [OH_MediaKeySystem_GetCertificateStatus](#oh_mediakeysystem_getcertificatestatus) ([MediaKeySystem](#mediakeysystem) \*mediaKeySystem, [DRM_CertificateStatus](#drm_certificatestatus) \*certStatus) | Obtains the status of a DRM certificate.| 158| [Drm_ErrCode](#drm_errcode) [OH_MediaKeySystem_Destroy](#oh_mediakeysystem_destroy) ([MediaKeySystem](#mediakeysystem) \*mediaKeySystem) | Destroys a **MediaKeySystem** instance.| 159 160 161### Variables 162 163| Name| Description| 164| -------- | -------- | 165| [DRM_MediaKeyType](#drm_mediakeytype) [DRM_MediaKeyRequestInfo::type](#type-12) | Type of the media key in a media key request.| 166| int32_t [DRM_MediaKeyRequestInfo::initDataLen](#initdatalen) | Initial data length.| 167| uint8_t [DRM_MediaKeyRequestInfo::initData](#initdata) [[MAX_INIT_DATA_LEN](#max_init_data_len)] | Initial data.| 168| char [DRM_MediaKeyRequestInfo::mimeType](#mimetype) [[MAX_MIMETYPE_LEN](#max_mimetype_len)] | MIME type.| 169| uint32_t [DRM_MediaKeyRequestInfo::optionsCount](#optionscount) | Number of optional data items.| 170| char [DRM_MediaKeyRequestInfo::optionName](#optionname) [[MAX_MEDIA_KEY_REQUEST_OPTION_COUNT](#max_media_key_request_option_count)][[MAX_MEDIA_KEY_REQUEST_OPTION_NAME_LEN](#max_media_key_request_option_name_len)] | Array of optional data names.| 171| char [DRM_MediaKeyRequestInfo::optionData](#optiondata) [[MAX_MEDIA_KEY_REQUEST_OPTION_COUNT](#max_media_key_request_option_count)][[MAX_MEDIA_KEY_REQUEST_OPTION_DATA_LEN](#max_media_key_request_option_data_len)] | Array of optional data.| 172| [DRM_MediaKeyRequestType](#drm_mediakeyrequesttype) [DRM_MediaKeyRequest::type](#type-22) | Type of a media key request.| 173| int32_t [DRM_MediaKeyRequest::dataLen](#datalen-12) | Length of data in a media key request.| 174| uint8_t [DRM_MediaKeyRequest::data](#data-12) [[MAX_MEDIA_KEY_REQUEST_DATA_LEN](#max_media_key_request_data_len)] | Data carried in a media key request.| 175| char [DRM_MediaKeyRequest::defaultUrl](#defaulturl) [[MAX_DEFAULT_URL_LEN](#max_default_url_len)] | DRM service URL.| 176| uint32_t [DRM_Statistics::statisticsCount](#statisticscount) | Number of statistical items.| 177| char [DRM_Statistics::statisticsName](#statisticsname) [[MAX_STATISTICS_COUNT](#max_statistics_count)][[MAX_STATISTICS_NAME_LEN](#max_statistics_name_len)] | Array of statistical item names.| 178| char [DRM_Statistics::statisticsDescription](#statisticsdescription) [[MAX_STATISTICS_COUNT](#max_statistics_count)][[MAX_STATISTICS_BUFFER_LEN](#max_statistics_buffer_len)] | Array of statistical descriptors.| 179| uint32_t [DRM_OfflineMediakeyIdArray::idsCount](#idscount) | Number of offline media key IDs.| 180| int32_t [DRM_OfflineMediakeyIdArray::idsLen](#idslen) [[MAX_OFFLINE_MEDIA_KEY_ID_COUNT](#max_offline_media_key_id_count)] | Length of offline media key IDs.| 181| uint8_t [DRM_OfflineMediakeyIdArray::ids](#ids) [[MAX_OFFLINE_MEDIA_KEY_ID_COUNT](#max_offline_media_key_id_count)][[MAX_OFFLINE_MEDIA_KEY_ID_LEN](#max_offline_media_key_id_len)] | Array of offline media key IDs.| 182| uint32_t [DRM_KeysInfo::keysInfoCount](#keysinfocount) | Number of media keys in the key information.| 183| uint8_t [DRM_KeysInfo::keyId](#keyid) [[MAX_KEY_INFO_COUNT](#max_key_info_count)][[MAX_KEY_ID_LEN](#max_key_id_len)] | Array of offline media key IDs.| 184| char [DRM_KeysInfo::statusValue](#statusvalue-12) [[MAX_KEY_INFO_COUNT](#max_key_info_count)][[MAX_KEY_STATUS_VALUE_LEN](#max_key_status_value_len)] | Media key status in the key information.| 185| uint32_t [DRM_MediaKeyStatus::statusCount](#statuscount) | Number of media key statuses.| 186| char [DRM_MediaKeyStatus::statusName](#statusname) [[MAX_MEDIA_KEY_STATUS_COUNT](#max_media_key_status_count)][[MAX_MEDIA_KEY_STATUS_NAME_LEN](#max_media_key_status_name_len)] | Array of media key status names.| 187| char [DRM_MediaKeyStatus::statusValue](#statusvalue-22) [[MAX_MEDIA_KEY_STATUS_COUNT](#max_media_key_status_count)][[MAX_MEDIA_KEY_STATUS_VALUE_LEN](#max_media_key_status_value_len)] | Array of media key status values.| 188| uint8_t [DRM_PsshInfo::uuid](#uuid-12) [[DRM_UUID_LEN](#drm_uuid_len)] | UUID of a DRM solution.| 189| int32_t [DRM_PsshInfo::dataLen](#datalen-22) | Length of PSSH data.| 190| uint8_t [DRM_PsshInfo::data](#data-22) [[MAX_PSSH_DATA_LEN](#max_pssh_data_len)] | PSSH data.| 191| uint32_t [DRM_MediaKeySystemInfo::psshCount](#psshcount) | Number of pieces of PSSH data.| 192| [DRM_PsshInfo](_d_r_m___pssh_info.md) [DRM_MediaKeySystemInfo::psshInfo](#psshinfo) [[MAX_PSSH_INFO_COUNT](#max_pssh_info_count)] | PSSH data.| 193| char [DRM_MediaKeySystemDescription::name](#name) [[MAX_MEDIA_KEY_SYSTEM_NAME_LEN](#max_media_key_system_name_len)] | DRM solution name. | 194| uint8_t [DRM_MediaKeySystemDescription::uuid](#uuid-22) [[DRM_UUID_LEN](#drm_uuid_len)] | UUID of a DRM solution. | 195| [MediaKeySession_EventCallback](#mediakeysession_eventcallback) [MediaKeySession_Callback::eventCallback](#eventcallback-12) | Media key session event callback, for example, a media key expiry event.| 196| [MediaKeySession_KeyChangeCallback](#mediakeysession_keychangecallback) [MediaKeySession_Callback::keyChangeCallback](#keychangecallback-12) | Callback of the media key change event| 197| [OH_MediaKeySession_EventCallback](#oh_mediakeysession_eventcallback) [OH_MediaKeySession_Callback::eventCallback](#eventcallback-22) | Media key session event callback, for example, a media key expiry event.| 198| [OH_MediaKeySession_KeyChangeCallback](#oh_mediakeysession_keychangecallback) [OH_MediaKeySession_Callback::keyChangeCallback](#keychangecallback-22) | Callback of the media key change event| 199 200 201 202## Macro Description 203 204 205### DRM_UUID_LEN 206 207``` 208#define DRM_UUID_LEN 16 209``` 210 211**Description** 212 213Length of the UUID of a DRM solution. 214 215**Since**: 11 216 217 218### MAX_DEFAULT_URL_LEN 219 220``` 221#define MAX_DEFAULT_URL_LEN 2048 222``` 223 224**Description** 225 226Maximum length of the URL of the DRM service. 227 228**Since**: 11 229 230 231### MAX_INIT_DATA_LEN 232 233``` 234#define MAX_INIT_DATA_LEN 2048 235``` 236 237**Description** 238 239Maximum length of data in an initial request. 240 241**Since**: 11 242 243 244### MAX_KEY_ID_LEN 245 246``` 247#define MAX_KEY_ID_LEN 16 248``` 249 250**Description** 251 252Maximum length of a media key ID. 253 254**Since**: 11 255 256 257### MAX_KEY_INFO_COUNT 258 259``` 260#define MAX_KEY_INFO_COUNT 64 261``` 262 263**Description** 264 265Maximum number of pieces of media key information. 266 267**Since**: 11 268 269 270### MAX_KEY_STATUS_VALUE_LEN 271 272``` 273#define MAX_KEY_STATUS_VALUE_LEN 128 274``` 275 276**Description** 277 278Maximum length of a media key status value. 279 280**Since**: 11 281 282 283### MAX_MEDIA_KEY_REQUEST_DATA_LEN 284 285``` 286#define MAX_MEDIA_KEY_REQUEST_DATA_LEN 8192 287``` 288 289**Description** 290 291Maximum length of a media key request. 292 293**Since**: 11 294 295 296### MAX_MEDIA_KEY_REQUEST_OPTION_COUNT 297 298``` 299#define MAX_MEDIA_KEY_REQUEST_OPTION_COUNT 16 300``` 301 302**Description** 303 304Maximum number of optional data items in a media key request. 305 306**Since**: 11 307 308 309### MAX_MEDIA_KEY_REQUEST_OPTION_DATA_LEN 310 311``` 312#define MAX_MEDIA_KEY_REQUEST_OPTION_DATA_LEN 128 313``` 314 315**Description** 316 317Maximum length of optional data in a media key request. 318 319**Since**: 11 320 321 322### MAX_MEDIA_KEY_REQUEST_OPTION_NAME_LEN 323 324``` 325#define MAX_MEDIA_KEY_REQUEST_OPTION_NAME_LEN 64 326``` 327 328**Description** 329 330Maximum length of an optional data name in a media key request. 331 332**Since**: 11 333 334 335### MAX_MEDIA_KEY_STATUS_COUNT 336 337``` 338#define MAX_MEDIA_KEY_STATUS_COUNT 64 339``` 340 341**Description** 342 343Maximum number of media key statuses. 344 345**Since**: 11 346 347 348### MAX_MEDIA_KEY_STATUS_NAME_LEN 349 350``` 351#define MAX_MEDIA_KEY_STATUS_NAME_LEN 64 352``` 353 354**Description** 355 356Maximum length of a media key status name. 357 358**Since**: 11 359 360 361### MAX_MEDIA_KEY_STATUS_VALUE_LEN 362 363``` 364#define MAX_MEDIA_KEY_STATUS_VALUE_LEN 256 365``` 366 367**Description** 368 369Maximum length of a media key status value. 370 371**Since**: 11 372 373 374### MAX_MEDIA_KEY_SYSTEM_NAME_LEN 375 376``` 377#define MAX_MEDIA_KEY_SYSTEM_NAME_LEN 128 378``` 379**Description** 380 381Maximum length of a DRM solution name. 382 383**Since**: 12 384 385 386### MAX_MEDIA_KEY_SYSTEM_NUM 387 388``` 389#define MAX_MEDIA_KEY_SYSTEM_NUM 8 390``` 391**Description** 392 393Maximum number of DRM solutions supported. 394 395**Since**: 12 396 397 398### MAX_MIMETYPE_LEN 399 400``` 401#define MAX_MIMETYPE_LEN 64 402``` 403 404**Description** 405 406Maximum length of a MIME type. 407 408**Since**: 11 409 410 411### MAX_OFFLINE_MEDIA_KEY_ID_COUNT 412 413``` 414#define MAX_OFFLINE_MEDIA_KEY_ID_COUNT 512 415``` 416 417**Description** 418 419Maximum number of offline media key IDs. 420 421**Since**: 11 422 423 424### MAX_OFFLINE_MEDIA_KEY_ID_LEN 425 426``` 427#define MAX_OFFLINE_MEDIA_KEY_ID_LEN 64 428``` 429 430**Description** 431 432Maximum length of an offline media key ID. 433 434**Since**: 11 435 436 437### MAX_PSSH_DATA_LEN 438 439``` 440#define MAX_PSSH_DATA_LEN 2048 441``` 442 443**Description** 444 445Maximum length of PSSH data. 446 447**Since**: 11 448 449 450### MAX_PSSH_INFO_COUNT 451 452``` 453#define MAX_PSSH_INFO_COUNT 8 454``` 455 456**Description** 457 458Maximum number of pieces of PSSH data. 459 460**Since**: 11 461 462 463### MAX_STATISTICS_BUFFER_LEN 464 465``` 466#define MAX_STATISTICS_BUFFER_LEN 256 467``` 468 469**Description** 470 471Maximum length of a statistical item buffer. 472 473**Since**: 11 474 475 476### MAX_STATISTICS_COUNT 477 478``` 479#define MAX_STATISTICS_COUNT 10 480``` 481 482**Description** 483 484Maximum number of statistical items. 485 486**Since**: 11 487 488 489### MAX_STATISTICS_NAME_LEN 490 491``` 492#define MAX_STATISTICS_NAME_LEN 64 493``` 494 495**Description** 496 497Maximum length of a statistical item name. 498 499**Since**: 11 500 501 502## Type Description 503 504 505### DRM_CertificateStatus 506 507``` 508typedef enum DRM_CertificateStatus DRM_CertificateStatus 509``` 510 511**Description** 512 513Defines an enum for the DRM certificate statuses. 514 515**System capability**: SystemCapability.Multimedia.Drm.Core 516 517**Since**: 11 518 519 520### DRM_ContentProtectionLevel 521 522``` 523typedef enum DRM_ContentProtectionLevel DRM_ContentProtectionLevel 524``` 525 526**Description** 527 528Defines an enum for the content protection levels. 529 530**System capability**: SystemCapability.Multimedia.Drm.Core 531 532**Since**: 11 533 534 535### Drm_ErrCode 536 537``` 538typedef enum Drm_ErrCode Drm_ErrCode 539``` 540 541**Description** 542 543Defines an enum for the DRM error codes. 544 545**System capability**: SystemCapability.Multimedia.Drm.Core 546 547**Since**: 11 548 549 550### DRM_EventType 551 552``` 553typedef enum DRM_EventType DRM_EventType 554``` 555 556**Description** 557 558Defines an enum for the types of events that can be subscribed to. 559 560**Since**: 11 561 562 563### DRM_KeysInfo 564 565``` 566typedef struct DRM_KeysInfo DRM_KeysInfo 567``` 568 569**Description** 570 571Defines a struct for the information about media keys. 572 573**Since**: 11 574 575 576### DRM_MediaKeyRequest 577 578``` 579typedef struct DRM_MediaKeyRequest DRM_MediaKeyRequest 580``` 581 582**Description** 583 584Defines a struct for a media key request. 585 586**Since**: 11 587 588 589### DRM_MediaKeyRequestInfo 590 591``` 592typedef struct DRM_MediaKeyRequestInfo DRM_MediaKeyRequestInfo 593``` 594 595**Description** 596 597Defines a struct for the information about a media key request. 598 599**Since**: 11 600 601 602### DRM_MediaKeyRequestType 603 604``` 605typedef enum DRM_MediaKeyRequestType DRM_MediaKeyRequestType 606``` 607 608**Description** 609 610Defines an enum for the types of media key requests. 611 612**System capability**: SystemCapability.Multimedia.Drm.Core 613 614**Since**: 11 615 616 617### DRM_MediaKeyStatus 618 619``` 620typedef struct DRM_MediaKeyStatus DRM_MediaKeyStatus 621``` 622 623**Description** 624 625Defines a struct for the media key status. 626 627**Since**: 11 628 629 630### DRM_MediaKeySystemDescription 631 632``` 633typedef struct DRM_MediaKeySystemDescription DRM_MediaKeySystemDescription 634``` 635**Description** 636 637Defines a struct for the name and UUID of a DRM solution. 638 639**Since**: 12 640 641 642### DRM_MediaKeySystemInfo 643 644``` 645typedef struct DRM_MediaKeySystemInfo DRM_MediaKeySystemInfo 646``` 647 648**Description** 649 650Defines a struct for the DRM information obtained by the player from a media source. 651 652**Since**: 11 653 654 655### DRM_MediaKeySystemInfoCallback 656 657``` 658typedef void(* DRM_MediaKeySystemInfoCallback) (DRM_MediaKeySystemInfo *mediaKeySystemInfo) 659``` 660 661**Description** 662 663Defines the callback used to obtain DRM information from a media source. 664 665**Since**: 11 666 667**Parameters** 668 669| Name| Description| 670| -------- | -------- | 671| mediaKeySystemInfo | Pointer to the DRM information obtained from the media source.| 672 673### DRM_MediaKeyType 674 675``` 676typedef enum DRM_MediaKeyType DRM_MediaKeyType 677``` 678 679**Description** 680 681Defines an enum for the types of media keys. 682 683**System capability**: SystemCapability.Multimedia.Drm.Core 684 685**Since**: 11 686 687 688### DRM_OfflineMediakeyIdArray 689 690``` 691typedef struct DRM_OfflineMediakeyIdArray DRM_OfflineMediakeyIdArray 692``` 693 694**Description** 695 696Defines a struct for an array holding the IDs of offline media keys. 697 698**Since**: 11 699 700 701### DRM_OfflineMediaKeyStatus 702 703``` 704typedef enum DRM_OfflineMediaKeyStatus DRM_OfflineMediaKeyStatus 705``` 706 707**Description** 708 709Defines an enum for the statuses of offline media keys. 710 711**System capability**: SystemCapability.Multimedia.Drm.Core 712 713**Since**: 11 714 715 716### DRM_PsshInfo 717 718``` 719typedef struct DRM_PsshInfo DRM_PsshInfo 720``` 721 722**Description** 723 724Defines a struct for the PSSH data that contains the UUID of a DRM solution. 725 726**Since**: 11 727 728 729### DRM_Statistics 730 731``` 732typedef struct DRM_Statistics DRM_Statistics 733``` 734 735**Description** 736 737Defines a struct for the statistical information of a media key system. 738 739**Since**: 11 740 741 742### MediaKeySession 743 744``` 745typedef struct MediaKeySession MediaKeySession 746``` 747 748**Description** 749 750Defines a struct for a media key session. 751 752**Since**: 11 753 754 755### MediaKeySession_Callback 756 757``` 758typedef struct MediaKeySession_Callback MediaKeySession_Callback 759``` 760 761**Description** 762 763Defines the callback used to listen for events such as media key expiry, without returning media key session instances. It applies to the scenario where a single media key session needs to be decrypted. 764 765**Since**: 11 766 767 768### MediaKeySession_EventCallback 769 770``` 771typedef Drm_ErrCode(* MediaKeySession_EventCallback) (DRM_EventType eventType, uint8_t *info, int32_t infoLen, char *extra) 772``` 773 774**Description** 775 776Defines the callback used to listen for media key session events, for example, a key expiration event. 777 778**Since**: 11 779 780**Parameters** 781 782| Name| Description| 783| -------- | -------- | 784| eventType | Event type.| 785| info | Pointer to the event information obtained from the media key session.| 786| infoLen | Length of the event information.| 787| extra | Pointer to the additional information obtained from the media key session.| 788 789**Returns** 790 791Returns an error code defined in **Drm_ErrCode**. 792 793 794### MediaKeySession_KeyChangeCallback 795 796``` 797typedef Drm_ErrCode(* MediaKeySession_KeyChangeCallback) (DRM_KeysInfo *keysInfo, bool newKeysAvailable) 798``` 799 800**Description** 801 802Defines the callback that is invoked when the key is changed. 803 804**Since**: 11 805 806**Parameters** 807 808| Name| Description| 809| -------- | -------- | 810| keysInfo | Pointer to the media key information.| 811| newKeysAvailable | Whether the new key is available.| 812 813**Returns** 814 815Returns **DRM_ERR_OK** is the call is successful; returns **DRM_ERR_INVALID_VAL** if the parameter check fails. 816 817 818### MediaKeySystem 819 820``` 821typedef struct MediaKeySystem MediaKeySystem 822``` 823 824**Description** 825 826Defines a struct for a media key system. 827 828**Since**: 11 829 830 831### MediaKeySystem_Callback 832 833``` 834typedef Drm_ErrCode(* MediaKeySystem_Callback) (DRM_EventType eventType, uint8_t *info, int32_t infoLen, char *extra) 835``` 836 837**Description** 838 839Defines the callback used to listen for media key system events. No **MediaKeySystem** instance is returned. This callback applies to the scenario where a single **MediaKeySystem** instance is used. 840 841**Since**: 11 842 843**Parameters** 844 845| Name| Description| 846| -------- | -------- | 847| eventType | Event type.| 848| info | Pointer to the event information.| 849| infoLen | Length of the event information.| 850| extra | Pointer to extended event information.| 851 852**Returns** 853 854Returns a result code defined in [Drm_ErrCode](#drm_errcode-1). 855- **DRM_ERR_OK**: The operation is successful. 856- **DRM_ERR_INVALID_VAL**: An input parameter is invalid. 857 858 859### OH_MediaKeySession_Callback 860 861``` 862typedef struct OH_MediaKeySession_CallbackOH_MediaKeySession_Callback 863``` 864 865**Description** 866 867Defines the callback used to listen for events such as media key expiry, with media key session instances returned. It applies to the scenario where multiple media key sessions need to be decrypted. 868 869**Since**: 12 870 871 872### OH_MediaKeySession_EventCallback 873 874``` 875typedef Drm_ErrCode(* OH_MediaKeySession_EventCallback) (MediaKeySession *mediaKeySession, DRM_EventType eventType, uint8_t *info, int32_t infoLen, char *extra) 876``` 877 878**Description** 879 880Defines the callback that is invoked when a media key system event is triggered. 881 882**Since**: 12 883 884**Parameters** 885 886| Name| Description| 887| -------- | -------- | 888| mediaKeySession | Pointer to the **MediaKeySession** instance.| 889| eventType | Event type.| 890| info | Pointer to the event information.| 891| infoLen | Length of the event information.| 892| extra | Pointer to extended event information.| 893 894**Returns** 895 896Returns an error code defined in **Drm_ErrCode**. 897 898 899### OH_MediaKeySession_KeyChangeCallback 900 901``` 902typedef Drm_ErrCode(* OH_MediaKeySession_KeyChangeCallback) (MediaKeySession *mediaKeySession, DRM_KeysInfo *keysInfo, bool newKeysAvailable) 903``` 904 905**Description** 906 907Defines the callback that is invoked when the key is changed. 908 909**Since**: 12 910 911**Parameters** 912 913| Name| Description| 914| -------- | -------- | 915| mediaKeySession | Pointer to the **MediaKeySession** instance.| 916| keysInfo | Pointer to the media key information.| 917| newKeysAvailable | Whether the new keys are available. The value **true** means that the new keys are available, and **false** means the opposite.| 918 919**Returns** 920 921Returns **DRM_ERR_OK** is the call is successful; returns **DRM_ERR_INVALID_VAL** if the parameter check fails. 922 923 924### OH_MediaKeySystem_Callback 925 926``` 927typedef Drm_ErrCode(* OH_MediaKeySystem_Callback) (MediaKeySystem *mediaKeySystem, DRM_EventType eventType, uint8_t *info, int32_t infoLen, char *extra) 928``` 929 930**Description** 931 932Defines the callback used to listen for media key system events. A **MediaKeySystem** instance is returned. This callback applies to the scenario where multiple **MediaKeySystem** instances are used. 933 934**Since**: 12 935 936**Parameters** 937 938| Name| Description| 939| -------- | -------- | 940| mediaKeySystem | Pointer to the **MediaKeySystem** instance.| 941| eventType | Event type.| 942| info | Pointer to the event information.| 943| infoLen | Length of the event information.| 944| extra | Pointer to extended event information.| 945 946**Returns** 947 948Returns a result code defined in [Drm_ErrCode](#drm_errcode-1). 949- **DRM_ERR_OK**: The operation is successful. 950- **DRM_ERR_INVALID_VAL**: An input parameter is invalid. 951 952 953## Enum Description 954 955 956### DRM_CertificateStatus 957 958``` 959enum DRM_CertificateStatus 960``` 961 962**Description** 963 964Enumerates the DRM certificate statuses. 965 966**System capability**: SystemCapability.Multimedia.Drm.Core 967 968**Since**: 11 969 970| Value| Description| 971| -------- | -------- | 972| CERT_STATUS_PROVISIONED | A DRM certificate has been installed on the device.| 973| CERT_STATUS_NOT_PROVISIONED | No device certificate is installed on the device or the certificate status is abnormal.| 974| CERT_STATUS_EXPIRED | The DRM certificate has expired.| 975| CERT_STATUS_INVALID | The DRM certificate is invalid.| 976| CERT_STATUS_UNAVAILABLE | The DRM certificate is unavailable.| 977 978 979### DRM_ContentProtectionLevel 980 981``` 982enum DRM_ContentProtectionLevel 983``` 984 985**Description** 986 987Enumerates the content protection levels. 988 989**System capability**: SystemCapability.Multimedia.Drm.Core 990 991**Since**: 11 992 993| Value| Description| 994| -------- | -------- | 995| CONTENT_PROTECTION_LEVEL_UNKNOWN | Unknown/Default content protection level.| 996| CONTENT_PROTECTION_LEVEL_SW_CRYPTO | Software content protection level.| 997| CONTENT_PROTECTION_LEVEL_HW_CRYPTO | Hardware content protection level.| 998| CONTENT_PROTECTION_LEVEL_ENHANCED_HW_CRYPTO | Hardware enhancement level.| 999| CONTENT_PROTECTION_LEVEL_MAX | Highest content protection level.| 1000 1001 1002### Drm_ErrCode 1003 1004``` 1005enum Drm_ErrCode 1006``` 1007 1008**Description** 1009 1010Enumerates the DRM error codes. 1011 1012**System capability**: SystemCapability.Multimedia.Drm.Core 1013 1014**Since**: 11 1015 1016| Value| Description| 1017| -------- | -------- | 1018| DRM_ERR_OK | Operation successful.| 1019| DRM_CAPI_ERR_BASE | Basic error.| 1020| DRM_ERR_NO_MEMORY | Insufficient memory.| 1021| DRM_ERR_OPERATION_NOT_PERMITTED | Operation not allowed.| 1022| DRM_ERR_INVALID_VAL | Invalid parameters.| 1023| DRM_ERR_IO | I/O error.| 1024| DRM_ERR_TIMEOUT | Network timeout.| 1025| DRM_ERR_UNKNOWN | Unknown error.| 1026| DRM_ERR_SERVICE_DIED | DRM service error.| 1027| DRM_ERR_INVALID_STATE | Invalid operation status.| 1028| DRM_ERR_UNSUPPORTED | Unsupported operation.| 1029| DRM_ERR_MAX_SYSTEM_NUM_REACHED | Too many **MediaKeySystem** instances.| 1030| DRM_ERR_MAX_SESSION_NUM_REACHED | Too many **MediaKeySession** instances.| 1031| DRM_ERR_EXTEND_START | Extended error.| 1032 1033 1034### DRM_EventType 1035 1036``` 1037enum DRM_EventType 1038``` 1039 1040**Description** 1041 1042Enumerates the types of events that can be subscribed to. 1043 1044**Since**: 11 1045 1046| Value| Description| 1047| -------- | -------- | 1048| EVENT_DRM_BASE | DRM event.| 1049| EVENT_PROVISION_REQUIRED | Event indicating that the application needs to request a DRM certificate.| 1050| EVENT_KEY_REQUIRED | Event indicating that the application needs to request a media key.| 1051| EVENT_KEY_EXPIRED | Event indicating that the media key expires.| 1052| EVENT_VENDOR_DEFINED | Vendor-defined event.| 1053| EVENT_EXPIRATION_UPDATE | Event indicating that the media key updates on expiry.| 1054 1055 1056### DRM_MediaKeyRequestType 1057 1058``` 1059enum DRM_MediaKeyRequestType 1060``` 1061 1062**Description** 1063 1064Enumerates the types of media key requests. 1065 1066**System capability**: SystemCapability.Multimedia.Drm.Core 1067 1068**Since**: 11 1069 1070| Value| Description| 1071| -------- | -------- | 1072| MEDIA_KEY_REQUEST_TYPE_UNKNOWN | Unknown type.| 1073| MEDIA_KEY_REQUEST_TYPE_INITIAL | Initial request.| 1074| MEDIA_KEY_REQUEST_TYPE_RENEWAL | Renewal request.| 1075| MEDIA_KEY_REQUEST_TYPE_RELEASE | Release request.| 1076| MEDIA_KEY_REQUEST_TYPE_NONE | None.| 1077| MEDIA_KEY_REQUEST_TYPE_UPDATE | Update request.| 1078 1079 1080### DRM_MediaKeyType 1081 1082``` 1083enum DRM_MediaKeyType 1084``` 1085 1086**Description** 1087 1088Enumerates the types of media keys. 1089 1090**System capability**: SystemCapability.Multimedia.Drm.Core 1091 1092**Since**: 11 1093 1094| Value| Description| 1095| -------- | -------- | 1096| MEDIA_KEY_TYPE_OFFLINE | Offline.| 1097| MEDIA_KEY_TYPE_ONLINE | Online.| 1098 1099 1100### DRM_OfflineMediaKeyStatus 1101 1102``` 1103enum DRM_OfflineMediaKeyStatus 1104``` 1105 1106**Description** 1107 1108Enumerates the statuses of offline media keys. 1109 1110**System capability**: SystemCapability.Multimedia.Drm.Core 1111 1112**Since**: 11 1113 1114| Value| Description| 1115| -------- | -------- | 1116| OFFLINE_MEDIA_KEY_STATUS_UNKNOWN | Unknown status.| 1117| OFFLINE_MEDIA_KEY_STATUS_USABLE | The media key is available.| 1118| OFFLINE_MEDIA_KEY_STATUS_INACTIVE | The media key is inactive.| 1119 1120 1121## Function Description 1122 1123 1124### OH_MediaKeySession_CheckMediaKeyStatus() 1125 1126``` 1127Drm_ErrCode OH_MediaKeySession_CheckMediaKeyStatus (MediaKeySession *mediaKeySession, DRM_MediaKeyStatus *mediaKeyStatus) 1128``` 1129 1130**Description** 1131 1132Checks the status of media keys. 1133 1134**Since**: 11 1135 1136**Parameters** 1137 1138| Name| Description| 1139| -------- | -------- | 1140| mediaKeySession | Pointer to the **MediaKeySession** instance.| 1141| mediaKeyStatus | Pointer to the media key status obtained.| 1142 1143**Returns** 1144 1145Returns a result code defined in [Drm_ErrCode](#drm_errcode-1). 1146- **DRM_ERR_OK**: The operation is successful. 1147- **DRM_ERR_NO_MEMORY**: The memory fails to be allocated due to insufficient memory. 1148- **DRM_ERR_INVALID_VAL**: The value of **mediaKeySession** is a null pointer or invalid, or the value of **mediaKeyStatus** is a null pointer. 1149- **DRM_ERR_UNKNOWN**: An internal error occurs. Check the log details. 1150 1151 1152### OH_MediaKeySession_ClearMediaKeys() 1153 1154``` 1155Drm_ErrCode OH_MediaKeySession_ClearMediaKeys (MediaKeySession *mediaKeySession) 1156``` 1157 1158**Description** 1159 1160Clears media keys. 1161 1162**Since**: 11 1163 1164**Parameters** 1165 1166| Name| Description| 1167| -------- | -------- | 1168| mediaKeySession | Pointer to the **MediaKeySession** instance.| 1169 1170**Returns** 1171 1172Returns a result code defined in [Drm_ErrCode](#drm_errcode-1). 1173- **DRM_ERR_OK**: The operation is successful. 1174- **DRM_ERR_INVALID_VAL**: The value of **mediaKeySession** is a null pointer or invalid. 1175- **DRM_ERR_UNKNOWN**: An internal error occurs. Check the log details. 1176 1177 1178### OH_MediaKeySession_Destroy() 1179 1180``` 1181Drm_ErrCode OH_MediaKeySession_Destroy (MediaKeySession *mediaKeySession) 1182``` 1183 1184**Description** 1185 1186Destroys a **MediaKeySession** instance. 1187 1188**Since**: 11 1189 1190**Parameters** 1191 1192| Name| Description| 1193| -------- | -------- | 1194| mediaKeySession | Pointer to the **MediaKeySession** instance.| 1195 1196**Returns** 1197 1198Returns a result code defined in [Drm_ErrCode](#drm_errcode-1). 1199- **DRM_ERR_OK**: The operation is successful. 1200- **DRM_ERR_INVALID_VAL**: The value of **mediaKeySession** is a null pointer or invalid. 1201- **DRM_ERR_UNKNOWN**: An internal error occurs. Check the log details. 1202 1203 1204### OH_MediaKeySession_GenerateMediaKeyRequest() 1205 1206``` 1207Drm_ErrCode OH_MediaKeySession_GenerateMediaKeyRequest (MediaKeySession *mediaKeySession, DRM_MediaKeyRequestInfo *info, DRM_MediaKeyRequest *mediaKeyRequest) 1208``` 1209 1210**Description** 1211 1212Generates a media key request. 1213 1214**Since**: 11 1215 1216**Parameters** 1217 1218| Name| Description| 1219| -------- | -------- | 1220| mediaKeySession | Pointer to the **MediaKeySession** instance.| 1221| info | Pointer to the information about the media key request.| 1222| mediaKeyRequest | Pointer to the media key request.| 1223 1224**Returns** 1225 1226Returns a result code defined in [Drm_ErrCode](#drm_errcode-1). 1227- **DRM_ERR_OK**: The operation is successful. 1228- **DRM_ERR_NO_MEMORY**: The memory fails to be allocated due to insufficient memory. 1229- **DRM_ERR_INVALID_VAL**: The value of **mediaKeySession** is a null pointer or invalid, or the value of **info** or **mediaKeyRequest** is a null pointer. 1230- **DRM_ERR_UNKNOWN**: An internal error occurs. Check the log details. 1231 1232 1233### OH_MediaKeySession_GenerateOfflineReleaseRequest() 1234 1235``` 1236Drm_ErrCode OH_MediaKeySession_GenerateOfflineReleaseRequest (MediaKeySession *mediaKeySession, uint8_t *offlineMediaKeyId, int32_t offlineMediaKeyIdLen, uint8_t *releaseRequest, int32_t *releaseRequestLen) 1237``` 1238 1239**Description** 1240 1241Generates a request to release offline media keys. 1242 1243**Since**: 11 1244 1245**Parameters** 1246 1247| Name| Description| 1248| -------- | -------- | 1249| mediaKeySession | Pointer to the **MediaKeySession** instance.| 1250| offlineMediaKeyId | Pointer to the ID of an offline media key.| 1251| offlineMediaKeyIdLen| Length of the offline media key ID.| 1252| releaseRequest| Pointer to a request to release offline media keys.| 1253| releaseRequestLen| Length of the request to release offline media keys.| 1254 1255**Returns** 1256 1257Returns a result code defined in [Drm_ErrCode](#drm_errcode-1). 1258- **DRM_ERR_OK**: The operation is successful. 1259- **DRM_ERR_NO_MEMORY**: The memory fails to be allocated due to insufficient memory. 1260- **DRM_ERR_INVALID_VAL**: The value of **mediaKeySession** is a null pointer or invalid, or the value of another parameter of the pointer type is a null pointer. 1261- **DRM_ERR_UNKNOWN**: An internal error occurs or the DRM solution on the device does not support offline media key release. Check the log details. 1262 1263 1264### OH_MediaKeySession_GetContentProtectionLevel() 1265 1266``` 1267Drm_ErrCode OH_MediaKeySession_GetContentProtectionLevel (MediaKeySession *mediaKeySession, DRM_ContentProtectionLevel *contentProtectionLevel) 1268``` 1269 1270**Description** 1271 1272Obtains the content protection level of a media key session. 1273 1274**Since**: 11 1275 1276**Parameters** 1277 1278| Name| Description| 1279| -------- | -------- | 1280| mediaKeySession | Pointer to the **MediaKeySession** instance.| 1281| contentProtectionLevel | Pointer to the content protection level.| 1282 1283**Returns** 1284 1285Returns a result code defined in [Drm_ErrCode](#drm_errcode-1). 1286- **DRM_ERR_OK**: The operation is successful. 1287- **DRM_ERR_INVALID_VAL**: The value of **mediaKeySession** is a null pointer or invalid, or the value of **contentProtectionLevel** is a null pointer. 1288- **DRM_ERR_UNKNOWN**: An internal error occurs. Check the log details. 1289 1290 1291### OH_MediaKeySession_ProcessMediaKeyResponse() 1292 1293``` 1294Drm_ErrCode OH_MediaKeySession_ProcessMediaKeyResponse (MediaKeySession *mediaKeySession, uint8_t *response, int32_t responseLen, uint8_t *offlineMediaKeyId, int32_t *offlineMediaKeyIdLen) 1295``` 1296 1297**Description** 1298 1299Processes a media key response. 1300 1301**Since**: 11 1302 1303**Parameters** 1304 1305| Name| Description| 1306| -------- | -------- | 1307| mediaKeySession | Pointer to the **MediaKeySession** instance.| 1308| response | Pointer to a media key response.| 1309| responseLen | Pointer to the length of the media key response.| 1310| offlineMediaKeyId | Pointer to the ID of an offline media key.| 1311| offlineMediaKeyIdLen | Length of the offline media key ID.| 1312 1313**Returns** 1314 1315Returns a result code defined in [Drm_ErrCode](#drm_errcode-1). 1316- **DRM_ERR_OK**: The operation is successful. 1317- **DRM_ERR_NO_MEMORY**: The memory fails to be allocated due to insufficient memory. 1318- **DRM_ERR_INVALID_VAL**: The value of **mediaKeySession** is a null pointer or invalid, or the value of another parameter of the pointer type is a null pointer. 1319- **DRM_ERR_UNKNOWN**: An internal error occurs. Check the log details. 1320 1321 1322### OH_MediaKeySession_ProcessOfflineReleaseResponse() 1323 1324``` 1325Drm_ErrCode OH_MediaKeySession_ProcessOfflineReleaseResponse (MediaKeySession *mediaKeySession, uint8_t *offlineMediaKeyId, int32_t offlineMediaKeyIdLen, uint8_t *releaseReponse, int32_t releaseReponseLen) 1326``` 1327 1328**Description** 1329 1330Processes a response to a request for releasing offline media keys. 1331 1332**Since**: 11 1333 1334**Parameters** 1335 1336| Name| Description| 1337| -------- | -------- | 1338| mediaKeySession | Pointer to the **MediaKeySession** instance.| 1339| offlineMediaKeyId | Pointer to the ID of an offline media key.| 1340| offlineMediaKeyIdLen | Length of the offline media key ID.| 1341| releaseReponse | Pointer to the response.| 1342| releaseReponseLen | Length of the response.| 1343 1344**Returns** 1345 1346Returns a result code defined in [Drm_ErrCode](#drm_errcode-1). 1347- **DRM_ERR_OK**: The operation is successful. 1348- **DRM_ERR_INVALID_VAL**: The value of **mediaKeySession** is a null pointer or invalid, or the value of another parameter of the pointer type is a null pointer. 1349- **DRM_ERR_UNKNOWN**: An internal error occurs or the DRM solution on the device does not support offline media key release. Check the log details. 1350 1351 1352### OH_MediaKeySession_RequireSecureDecoderModule() 1353 1354``` 1355Drm_ErrCode OH_MediaKeySession_RequireSecureDecoderModule (MediaKeySession *mediaKeySession, const char *mimeType, bool *status) 1356``` 1357 1358**Description** 1359 1360Checks whether secure decoding is required. 1361 1362**Since**: 11 1363 1364**Parameters** 1365 1366| Name| Description| 1367| -------- | -------- | 1368| mediaKeySession | Pointer to the **MediaKeySession** instance.| 1369| mimeType | Pointer to the MIME type. The supported MIME types depend on the DRM solution. Example types are video/avc and video/hev.| 1370| status | Pointer to the result indicating whether secure decoding is required.| 1371 1372**Returns** 1373 1374Returns a result code defined in [Drm_ErrCode](#drm_errcode-1). 1375- **DRM_ERR_OK**: The operation is successful. 1376- **DRM_ERR_INVALID_VAL**: The value of **mediaKeySession** is a null pointer or invalid, or the value of another parameter of the pointer type is a null pointer. 1377- **DRM_ERR_UNKNOWN**: An internal error occurs. Check the log details. 1378 1379 1380### OH_MediaKeySession_RestoreOfflineMediaKeys() 1381 1382``` 1383Drm_ErrCode OH_MediaKeySession_RestoreOfflineMediaKeys (MediaKeySession *mediaKeySession, uint8_t *offlineMediaKeyId, int32_t offlineMediaKeyIdLen) 1384``` 1385 1386**Description** 1387 1388Restores offline media keys. 1389 1390**Since**: 11 1391 1392**Parameters** 1393 1394| Name| Description| 1395| -------- | -------- | 1396| mediaKeySession | Pointer to the **MediaKeySession** instance.| 1397| offlineMediaKeyId | Pointer to the ID of an offline media key.| 1398| offlineMediaKeyIdLen | Length of the offline media key ID.| 1399 1400**Returns** 1401 1402Returns a result code defined in [Drm_ErrCode](#drm_errcode-1). 1403- **DRM_ERR_OK**: The operation is successful. 1404- **DRM_ERR_INVALID_VAL**: The value of **mediaKeySession** is a null pointer or invalid, or the value of another parameter of the pointer type is a null pointer. 1405- **DRM_ERR_UNKNOWN**: An internal error occurs. Check the log details. 1406 1407 1408### OH_MediaKeySession_SetCallback() 1409 1410``` 1411Drm_ErrCode OH_MediaKeySession_SetCallback (MediaKeySession *mediaKeySession, OH_MediaKeySession_Callback *callback) 1412``` 1413 1414**Description** 1415 1416Sets a media key session event callback. 1417 1418**Since**: 12 1419 1420**Parameters** 1421 1422| Name| Description| 1423| -------- | -------- | 1424| mediaKeySession | Pointer to the **MediaKeySession** instance.| 1425| callback | Pointer to the callback for the media key session event.| 1426 1427**Returns** 1428 1429Returns a result code defined in [Drm_ErrCode](#drm_errcode-1). 1430- **DRM_ERR_OK**: The operation is successful. 1431- **DRM_ERR_INVALID_VAL**: The value of **mediaKeySession** is a null pointer or invalid, or the value of **callback** is a null pointer. 1432 1433 1434### OH_MediaKeySession_SetMediaKeySessionCallback() 1435 1436``` 1437Drm_ErrCode OH_MediaKeySession_SetMediaKeySessionCallback (MediaKeySession *mediaKeySession, MediaKeySession_Callback *callback) 1438``` 1439 1440**Description** 1441 1442Sets a media key session event callback. 1443 1444**Since**: 11 1445 1446**Parameters** 1447 1448| Name| Description| 1449| -------- | -------- | 1450| mediaKeySession | Pointer to the **MediaKeySession** instance.| 1451| callback | Pointer to the callback for the media key session event.| 1452 1453**Returns** 1454 1455Returns a result code defined in [Drm_ErrCode](#drm_errcode-1). 1456- **DRM_ERR_OK**: The operation is successful. 1457- **DRM_ERR_INVALID_VAL**: The value of **mediaKeySession** is a null pointer or invalid, or the value of **callback** is a null pointer. 1458 1459 1460### OH_MediaKeySystem_ClearOfflineMediaKeys() 1461 1462``` 1463Drm_ErrCode OH_MediaKeySystem_ClearOfflineMediaKeys (MediaKeySystem *mediaKeySystem, uint8_t *offlineMediaKeyId, int32_t offlineMediaKeyIdLen) 1464``` 1465 1466**Description** 1467 1468Clears offline media keys by ID. 1469 1470**Since**: 11 1471 1472**Parameters** 1473 1474| Name| Description| 1475| -------- | -------- | 1476| mediaKeySystem | Pointer to the **MediaKeySystem** instance.| 1477| offlineMediaKeyId | Pointer to the ID of an offline media key.| 1478| offlineMediaKeyIdLen | Length of the offline media key ID.| 1479 1480**Returns** 1481 1482Returns a result code defined in [Drm_ErrCode](#drm_errcode-1). 1483- **DRM_ERR_OK**: The operation is successful. 1484- **DRM_ERR_INVALID_VAL**: The value of **mediaKeySystem** is a null pointer or invalid, or the value of **offlineMediaKeyId** is a null pointer. 1485- **DRM_ERR_UNKNOWN**: An internal error occurs. Check the log details. 1486 1487 1488### OH_MediaKeySystem_Create() 1489 1490``` 1491Drm_ErrCode OH_MediaKeySystem_Create (const char *name, MediaKeySystem **mediaKeySystem) 1492``` 1493 1494**Description** 1495 1496Creates a **MediaKeySystem** instance. 1497 1498**Since**: 11 1499 1500**Parameters** 1501 1502| Name| Description| 1503| -------- | -------- | 1504| name | Pointer to the DRM solution name.| 1505| mediaKeySystem | Double pointer to the **MediaKeySystem** instance.| 1506 1507**Returns** 1508 1509Returns a result code defined in [Drm_ErrCode](#drm_errcode-1). 1510- **DRM_ERR_OK**: The operation is successful. 1511- **DRM_ERR_INVALID_VAL**: The value of **name** is a null pointer or its length is 0, or the value of **mediaKeySystem** is a null pointer. 1512- **DRM_ERR_UNKNOWN**: An internal error occurs. Check the log details. 1513- **DRM_ERR_SERVICE_DIED**: The service is dead. 1514- DRM_ERR_MAX_SYSTEM_NUM_REACHED: The number of created **MediaKeySystem** instances has reached the upper limit (64). 1515 1516 1517### OH_MediaKeySystem_CreateMediaKeySession() 1518 1519``` 1520Drm_ErrCode OH_MediaKeySystem_CreateMediaKeySession (MediaKeySystem *mediaKeySystem, DRM_ContentProtectionLevel *level, MediaKeySession **mediaKeySession) 1521``` 1522 1523**Description** 1524 1525Creates a **MediaKeySession** instance. 1526 1527**Since**: 11 1528 1529**Parameters** 1530 1531| Name| Description| 1532| -------- | -------- | 1533| mediaKeySystem | Pointer to the **MediaKeySystem** instance.| 1534| level | Pointer to the content protection level.| 1535| mediaKeySession | Double pointer to the **MediaKeySession** instance created.| 1536 1537**Returns** 1538 1539Returns a result code defined in [Drm_ErrCode](#drm_errcode-1). 1540- **DRM_ERR_OK**: The operation is successful. 1541- **DRM_ERR_NO_MEMORY**: The memory fails to be allocated due to insufficient memory. 1542- **DRM_ERR_INVALID_VAL**: The value of **mediaKeySystem** is a null pointer or invalid, the value of **level** is out of range, or the value of **mediaKeySession** is a null pointer. 1543- **DRM_ERR_UNKNOWN**: An internal error occurs. Check the log details. 1544- **DRM_ERR_SERVICE_DIED**: The service is dead. 1545- **DRM_ERR_MAX_SESSION_NUM_REACHED**: The number of **MediaKeySession** instances created by the **MediaKeySystem** instance reaches the upper limit (64). 1546 1547 1548### OH_MediaKeySystem_Destroy() 1549 1550``` 1551Drm_ErrCode OH_MediaKeySystem_Destroy (MediaKeySystem *mediaKeySystem) 1552``` 1553 1554**Description** 1555 1556Destroys a **MediaKeySystem** instance. 1557 1558**Since**: 11 1559 1560**Parameters** 1561 1562| Name| Description| 1563| -------- | -------- | 1564| mediaKeySystem | Double pointer to the **MediaKeySystem** instance created.| 1565 1566**Returns** 1567 1568Returns a result code defined in [Drm_ErrCode](#drm_errcode-1). 1569- **DRM_ERR_OK**: The operation is successful. 1570- **DRM_ERR_INVALID_VAL**: The value of **mediaKeySystem** is a null pointer or invalid. 1571- **DRM_ERR_UNKNOWN**: An internal error occurs. Check the log details. 1572 1573 1574### OH_MediaKeySystem_GenerateKeySystemRequest() 1575 1576``` 1577Drm_ErrCode OH_MediaKeySystem_GenerateKeySystemRequest (MediaKeySystem *mediaKeySystem, uint8_t *request, int32_t *requestLen, char *defaultUrl, int32_t defaultUrlLen) 1578``` 1579 1580**Description** 1581 1582Generates a provision request. 1583 1584**Since**: 11 1585 1586**Parameters** 1587 1588| Name| Description| 1589| -------- | -------- | 1590| mediaKeySystem | Pointer to the **MediaKeySystem** instance.| 1591| request | Pointer to the provision request, which is used to request a DRM certificate from a provisioning server.| 1592| requestLen | Pointer to the length of the provision request.| 1593| defaultUrl | Pointer to the URL of the provisioning server.| 1594| defaultUrlLen | Length of the URL of the provisioning server.| 1595 1596**Returns** 1597 1598Returns a result code defined in [Drm_ErrCode](#drm_errcode-1). 1599- **DRM_ERR_OK**: The operation is successful. 1600- **DRM_ERR_NO_MEMORY**: The memory fails to be allocated due to insufficient memory. 1601- **DRM_ERR_INVALID_VAL**: The value of **mediaKeySystem** is a null pointer or invalid, or the value of another parameter of the pointer type is a null pointer. 1602- **DRM_ERR_UNKNOWN**: An internal error occurs. Check the log details. 1603 1604 1605### OH_MediaKeySystem_GetCertificateStatus() 1606 1607``` 1608Drm_ErrCode OH_MediaKeySystem_GetCertificateStatus (MediaKeySystem *mediaKeySystem, DRM_CertificateStatus *certStatus) 1609``` 1610 1611**Description** 1612 1613Obtains the status of a DRM certificate. 1614 1615**Since**: 11 1616 1617**Parameters** 1618 1619| Name| Description| 1620| -------- | -------- | 1621| mediaKeySystem | Pointer to the **MediaKeySystem** instance.| 1622| certStatus | Pointer to the DRM certificate status.| 1623 1624**Returns** 1625 1626Returns a result code defined in [Drm_ErrCode](#drm_errcode-1). 1627- **DRM_ERR_OK**: The operation is successful. 1628- **DRM_ERR_INVALID_VAL**: The value of **mediaKeySystem** is a null pointer or invalid, or the value of **certStatus** is a null pointer. 1629- **DRM_ERR_UNKNOWN**: An internal error occurs. Check the log details. 1630 1631 1632### OH_MediaKeySystem_GetConfigurationByteArray() 1633 1634``` 1635Drm_ErrCode OH_MediaKeySystem_GetConfigurationByteArray (MediaKeySystem *mediaKeySystem, const char *configName, uint8_t *value, int32_t *valueLen) 1636``` 1637 1638**Description** 1639 1640Obtains the value of a configuration item in the form of an array. 1641 1642**Since**: 11 1643 1644**Parameters** 1645 1646| Name| Description| 1647| -------- | -------- | 1648| mediaKeySystem | Pointer to the **MediaKeySystem** instance.| 1649| configName | Pointer to the name of the configuration item in the form of a character array. It is determined by the DRM solution on the device and cannot be empty.| 1650| value | Pointer to the value of the configuration item.| 1651| valueLen | Pointer to the length of the value.| 1652 1653**Returns** 1654 1655Returns a result code defined in [Drm_ErrCode](#drm_errcode-1). 1656- **DRM_ERR_OK**: The operation is successful. 1657- **DRM_ERR_NO_MEMORY**: The memory fails to be allocated due to insufficient memory. 1658- **DRM_ERR_INVALID_VAL**: The value of **mediaKeySystem** is a null pointer or invalid, or the value of **configName**, **value**, or **valueLen** is a null pointer. 1659- **DRM_ERR_UNKNOWN**: An internal error occurs. Check the log details. 1660 1661 1662### OH_MediaKeySystem_GetConfigurationString() 1663 1664``` 1665Drm_ErrCode OH_MediaKeySystem_GetConfigurationString (MediaKeySystem *mediaKeySystem, const char *configName, char *value, int32_t valueLen) 1666``` 1667 1668**Description** 1669 1670Obtains the value of a configuration item in the form of a string. 1671 1672**Since**: 11 1673 1674**Parameters** 1675 1676| Name| Description| 1677| -------- | -------- | 1678| mediaKeySystem | Pointer to the **MediaKeySystem** instance.| 1679| configName | Pointer to the name of the configuration item.| 1680| value | Pointer to the value of the configuration item.| 1681| valueLen | Length of the value.| 1682 1683**Returns** 1684 1685Returns a result code defined in [Drm_ErrCode](#drm_errcode-1). 1686- **DRM_ERR_OK**: The operation is successful. 1687- **DRM_ERR_NO_MEMORY**: The memory fails to be allocated due to insufficient memory. 1688- **DRM_ERR_INVALID_VAL**: The value of **mediaKeySystem** is a null pointer or invalid, or the value of **configName** or **value** is a null pointer. 1689- **DRM_ERR_UNKNOWN**: An internal error occurs. Check the log details. 1690 1691 1692### OH_MediaKeySystem_GetMaxContentProtectionLevel() 1693 1694``` 1695Drm_ErrCode OH_MediaKeySystem_GetMaxContentProtectionLevel (MediaKeySystem *mediaKeySystem, DRM_ContentProtectionLevel *contentProtectionLevel) 1696``` 1697 1698**Description** 1699 1700Obtains the maximum content protection level supported by the device. 1701 1702**Since**: 11 1703 1704**Parameters** 1705 1706| Name| Description| 1707| -------- | -------- | 1708| mediaKeySystem | Pointer to the **MediaKeySystem** instance.| 1709| contentProtectionLevel | Pointer to the content protection level.| 1710 1711**Returns** 1712 1713Returns a result code defined in [Drm_ErrCode](#drm_errcode-1). 1714- **DRM_ERR_OK**: The operation is successful. 1715- **DRM_ERR_INVALID_VAL**: The value of **mediaKeySystem** is a null pointer or invalid, or the value of **contentProtectionLevel** is a null pointer. 1716- **DRM_ERR_UNKNOWN**: An internal error occurs. Check the log details. 1717 1718 1719### OH_MediaKeySystem_GetMediaKeySystems() 1720 1721``` 1722Drm_ErrCode OH_MediaKeySystem_GetMediaKeySystems (DRM_MediaKeySystemDescription *infos, uint32_t *count) 1723``` 1724 1725**Description** 1726 1727Obtains the name and ID list of the DRM solutions supported by the device. 1728 1729**Since**: 12 1730 1731**Parameters** 1732 1733| Name| Description| 1734| -------- | -------- | 1735| infos | Pointer to the list of the names and UUIDs of DRM solutions.| 1736| count | Pointer to the length of the list.| 1737 1738**Returns** 1739 1740Returns a result code defined in [Drm_ErrCode](#drm_errcode-1). 1741- **DRM_ERR_OK**: The operation is successful. 1742- DRM_ERR_INVALID_VAL: The value of **infos** or **count** is a null pointer, or the length of **infos** is insufficient. 1743- **DRM_ERR_UNKNOWN**: An internal error occurs. Check the log details. 1744 1745 1746### OH_MediaKeySystem_GetOfflineMediaKeyIds() 1747 1748``` 1749Drm_ErrCode OH_MediaKeySystem_GetOfflineMediaKeyIds (MediaKeySystem *mediaKeySystem, DRM_OfflineMediakeyIdArray *offlineMediaKeyIds) 1750``` 1751 1752**Description** 1753 1754Obtains the list of offline media key IDs, which are used to manage offline media keys. 1755 1756**Since**: 11 1757 1758**Parameters** 1759 1760| Name| Description| 1761| -------- | -------- | 1762| mediaKeySystem | Pointer to the **MediaKeySystem** instance.| 1763| offlineMediaKeyIds | Pointer to the IDs of offline media keys.| 1764 1765**Returns** 1766 1767Returns a result code defined in [Drm_ErrCode](#drm_errcode-1). 1768- **DRM_ERR_OK**: The operation is successful. 1769- **DRM_ERR_NO_MEMORY**: The memory fails to be allocated due to insufficient memory. 1770- **DRM_ERR_INVALID_VAL**: The value of **mediaKeySystem** is a null pointer or invalid, or the value of **offlineMediaKeyIds** is a null pointer. 1771- **DRM_ERR_UNKNOWN**: An internal error occurs. Check the log details. 1772 1773 1774### OH_MediaKeySystem_GetOfflineMediaKeyStatus() 1775 1776``` 1777Drm_ErrCode OH_MediaKeySystem_GetOfflineMediaKeyStatus (MediaKeySystem *mediaKeySystem, uint8_t *offlineMediaKeyId, int32_t offlineMediaKeyIdLen, DRM_OfflineMediaKeyStatus *status) 1778``` 1779 1780**Description** 1781 1782Obtains the status of an offline media key. 1783 1784**Since**: 11 1785 1786**Parameters** 1787 1788| Name| Description| 1789| -------- | -------- | 1790| mediaKeySystem | Pointer to the **MediaKeySystem** instance.| 1791| offlineMediaKeyId | Pointer to the ID of an offline media key.| 1792| offlineMediaKeyIdLen | Length of the offline media key ID.| 1793| status | Pointer to the media key status obtained.| 1794 1795**Returns** 1796 1797Returns a result code defined in [Drm_ErrCode](#drm_errcode-1). 1798- **DRM_ERR_OK**: The operation is successful. 1799- **DRM_ERR_INVALID_VAL**: The value of **mediaKeySystem** is a null pointer or invalid, or the value of another parameter of the pointer type is a null pointer. 1800- **DRM_ERR_UNKNOWN**: An internal error occurs. Check the log details. 1801 1802 1803### OH_MediaKeySystem_GetStatistics() 1804 1805``` 1806Drm_ErrCode OH_MediaKeySystem_GetStatistics (MediaKeySystem *mediaKeySystem, DRM_Statistics *statistics) 1807``` 1808 1809**Description** 1810 1811Obtains the statistical information of a media key system. 1812 1813**Since**: 11 1814 1815**Parameters** 1816 1817| Name| Description| 1818| -------- | -------- | 1819| mediaKeySystem | Pointer to the **MediaKeySystem** instance.| 1820| statistics | Pointer to the statistical information.| 1821 1822**Returns** 1823 1824Returns a result code defined in [Drm_ErrCode](#drm_errcode-1). 1825- **DRM_ERR_OK**: The operation is successful. 1826- **DRM_ERR_NO_MEMORY**: The memory fails to be allocated due to insufficient memory. 1827- **DRM_ERR_INVALID_VAL**: The value of **mediaKeySystem** is a null pointer or invalid, or the value of **statistics** is a null pointer. 1828- **DRM_ERR_UNKNOWN**: An internal error occurs. Check the log details. 1829 1830 1831### OH_MediaKeySystem_IsSupported() 1832 1833``` 1834bool OH_MediaKeySystem_IsSupported (const char *name) 1835``` 1836 1837**Description** 1838 1839Checks whether the device supports the specified DRM solution. 1840 1841**Since**: 11 1842 1843**Parameters** 1844 1845| Name| Description| 1846| -------- | -------- | 1847| name | Pointer to the DRM solution name.| 1848 1849**Returns** 1850 1851Returns **true** if the device supports the DRM solution; returns **false** otherwise. 1852 1853 1854### OH_MediaKeySystem_IsSupported2() 1855 1856``` 1857bool OH_MediaKeySystem_IsSupported2 (const char *name, const char *mimeType) 1858``` 1859 1860**Description** 1861 1862Checks whether the device supports the combination of the specified DRM solution and MIME type. 1863 1864**Since**: 11 1865 1866**Parameters** 1867 1868| Name| Description| 1869| -------- | -------- | 1870| name | Pointer to the DRM solution name.| 1871| mimeType | Pointer to the MIME type. The supported MIME types depend on the DRM solution. Example types are video/avc and video/hev.| 1872 1873**Returns** 1874 1875Returns **true** if the device supports the combination; returns **false** otherwise. 1876 1877 1878### OH_MediaKeySystem_IsSupported3() 1879 1880``` 1881bool OH_MediaKeySystem_IsSupported3 (const char *name, const char *mimeType, DRM_ContentProtectionLevel contentProtectionLevel) 1882``` 1883 1884**Description** 1885 1886Checks whether the device supports the combination of the specified DRM solution, MIME type, and content protection level. 1887 1888**Since**: 11 1889 1890**Parameters** 1891 1892| Name| Description| 1893| -------- | -------- | 1894| name | Pointer to the DRM solution name.| 1895| mimeType | Pointer to the MIME type. The supported MIME types depend on the DRM solution. Example types are video/avc and video/hev.| 1896| contentProtectionLevel | Content protection level.| 1897 1898**Returns** 1899 1900Returns **true** if the device supports the combination; returns **false** otherwise. 1901 1902 1903### OH_MediaKeySystem_ProcessKeySystemResponse() 1904 1905``` 1906Drm_ErrCode OH_MediaKeySystem_ProcessKeySystemResponse (MediaKeySystem *mediaKeySystem, uint8_t *response, int32_t responseLen) 1907``` 1908 1909**Description** 1910 1911Processes a provision response. 1912 1913**Since**: 11 1914 1915**Parameters** 1916 1917| Name| Description| 1918| -------- | -------- | 1919| mediaKeySystem | Pointer to the **MediaKeySystem** instance.| 1920| response | Pointer to the provision response.| 1921| responseLen | Length of the provision response.| 1922 1923**Returns** 1924 1925Returns a result code defined in [Drm_ErrCode](#drm_errcode-1). 1926- **DRM_ERR_OK**: The operation is successful. 1927- **DRM_ERR_INVALID_VAL**: The value of **mediaKeySystem** is a null pointer or invalid, or the value of **response** is a null pointer. 1928- **DRM_ERR_UNKNOWN**: An internal error occurs. Check the log details. 1929 1930 1931### OH_MediaKeySystem_SetCallback() 1932 1933``` 1934Drm_ErrCode OH_MediaKeySystem_SetCallback (MediaKeySystem *mediaKeySystem, OH_MediaKeySystem_Callback callback) 1935``` 1936 1937**Description** 1938 1939Sets a media key system event callback. 1940 1941**Since**: 12 1942 1943**Parameters** 1944 1945| Name| Description| 1946| -------- | -------- | 1947| mediaKeySystem | Pointer to the **MediaKeySystem** instance.| 1948| callback | Callback.| 1949 1950**Returns** 1951 1952Returns a result code defined in [Drm_ErrCode](#drm_errcode-1). 1953- **DRM_ERR_OK**: The operation is successful. 1954- **DRM_ERR_INVALID_VAL**: An input parameter is invalid. 1955 1956 1957### OH_MediaKeySystem_SetConfigurationByteArray() 1958 1959``` 1960Drm_ErrCode OH_MediaKeySystem_SetConfigurationByteArray (MediaKeySystem *mediaKeySystem, const char *configName, uint8_t *value, int32_t valueLen) 1961``` 1962 1963**Description** 1964 1965Sets a configuration item in the form of an array. 1966 1967**Since**: 11 1968 1969**Parameters** 1970 1971| Name| Description| 1972| -------- | -------- | 1973| mediaKeySystem | Pointer to the **MediaKeySystem** instance.| 1974| configName | Pointer to the name of the configuration item in the form of a character array. It is determined by the DRM solution on the device and cannot be empty.| 1975| value | Pointer to the value of the configuration item in the form of a character array. It is determined by the DRM solution on the device and cannot be empty.| 1976| valueLen | Length of the value.| 1977 1978**Returns** 1979 1980Returns a result code defined in [Drm_ErrCode](#drm_errcode-1). 1981- **DRM_ERR_OK**: The operation is successful. 1982- **DRM_ERR_NO_MEMORY**: The memory fails to be allocated due to insufficient memory. 1983- **DRM_ERR_INVALID_VAL**: The value of **mediaKeySystem** is a null pointer or invalid, or the value of **configName** or **value** is a null pointer. 1984- **DRM_ERR_UNKNOWN**: An internal error occurs. Check the log details. 1985 1986### OH_MediaKeySystem_SetConfigurationString() 1987 1988``` 1989Drm_ErrCode OH_MediaKeySystem_SetConfigurationString (MediaKeySystem *mediaKeySystem, const char *configName, const char *value) 1990``` 1991 1992**Description** 1993 1994Sets a configuration item in the form of a string. 1995 1996**Since**: 11 1997 1998**Parameters** 1999 2000| Name| Description| 2001| -------- | -------- | 2002| mediaKeySystem | Pointer to the **MediaKeySystem** instance.| 2003| configName | Pointer to the name of the configuration item in the form of a string. It is determined by the DRM solution on the device and cannot be empty.| 2004| value | Pointer to the value of the configuration item in the form of a string. It is determined by the DRM solution on the device and cannot be empty.| 2005 2006**Returns** 2007 2008Returns a result code defined in [Drm_ErrCode](#drm_errcode-1). 2009- **DRM_ERR_OK**: The operation is successful. 2010- **DRM_ERR_INVALID_VAL**: The value of **mediaKeySystem** is a null pointer or invalid, or the value of **configName** or **value** is a null pointer. 2011 2012 2013### OH_MediaKeySystem_SetMediaKeySystemCallback() 2014 2015``` 2016Drm_ErrCode OH_MediaKeySystem_SetMediaKeySystemCallback (MediaKeySystem *mediaKeySystem, MediaKeySystem_Callback callback) 2017``` 2018 2019**Description** 2020 2021Sets a media key system event callback. 2022 2023**Since**: 11 2024 2025**Parameters** 2026 2027| Name| Description| 2028| -------- | -------- | 2029| mediaKeySystem | Pointer to the **MediaKeySystem** instance.| 2030| callback | Callback.| 2031 2032**Returns** 2033 2034Returns a result code defined in [Drm_ErrCode](#drm_errcode-1). 2035- **DRM_ERR_OK**: The operation is successful. 2036- **DRM_ERR_INVALID_VAL**: The value of **mediaKeySystem** is a null pointer or invalid. 2037 2038 2039## Variable Description 2040 2041 2042### data [1/2] 2043 2044``` 2045uint8_t DRM_MediaKeyRequest::data[MAX_MEDIA_KEY_REQUEST_DATA_LEN] 2046``` 2047 2048**Description** 2049 2050Data in a media key request sent to the DRM service. 2051 2052 2053### data [2/2] 2054 2055``` 2056uint8_t DRM_PsshInfo::data[MAX_PSSH_DATA_LEN] 2057``` 2058 2059**Description** 2060 2061PSSH data. 2062 2063 2064### dataLen [1/2] 2065 2066``` 2067int32_t DRM_MediaKeyRequest::dataLen 2068``` 2069 2070**Description** 2071 2072Length of data in a media key request. 2073 2074 2075### dataLen [2/2] 2076 2077``` 2078int32_t DRM_PsshInfo::dataLen 2079``` 2080 2081**Description** 2082 2083Length of PSSH data. 2084 2085 2086### defaultUrl 2087 2088``` 2089char DRM_MediaKeyRequest::defaultUrl[MAX_DEFAULT_URL_LEN] 2090``` 2091 2092**Description** 2093 2094URL of the license server (which provisions media keys). 2095 2096 2097### eventCallback [1/2] 2098 2099``` 2100MediaKeySession_EventCallback MediaKeySession_Callback::eventCallback 2101``` 2102 2103**Description** 2104 2105Media key session event callback, for example, a media key expiry event. 2106 2107 2108### eventCallback [2/2] 2109 2110``` 2111OH_MediaKeySession_EventCallback OH_MediaKeySession_Callback::eventCallback 2112``` 2113 2114**Description** 2115 2116Media key session event callback, for example, a media key expiry event. 2117 2118### ids 2119 2120``` 2121uint8_t DRM_OfflineMediakeyIdArray::ids[MAX_OFFLINE_MEDIA_KEY_ID_COUNT][MAX_OFFLINE_MEDIA_KEY_ID_LEN] 2122``` 2123 2124**Description** 2125 2126Array of offline media key IDs. 2127 2128 2129### idsCount 2130 2131``` 2132uint32_t DRM_OfflineMediakeyIdArray::idsCount 2133``` 2134 2135**Description** 2136 2137Number of offline media key IDs. 2138 2139 2140### idsLen 2141 2142``` 2143int32_t DRM_OfflineMediakeyIdArray::idsLen[MAX_OFFLINE_MEDIA_KEY_ID_COUNT] 2144``` 2145 2146**Description** 2147 2148Length of offline media key IDs. 2149 2150 2151### initData 2152 2153``` 2154uint8_t DRM_MediaKeyRequestInfo::initData[MAX_INIT_DATA_LEN] 2155``` 2156 2157**Description** 2158 2159Initial data in a media key request. 2160 2161 2162### initDataLen 2163 2164``` 2165int32_t DRM_MediaKeyRequestInfo::initDataLen 2166``` 2167 2168**Description** 2169 2170Length of the initial data in a media key request. 2171 2172 2173### keyChangeCallback [1/2] 2174 2175``` 2176MediaKeySession_KeyChangeCallback MediaKeySession_Callback::keyChangeCallback 2177``` 2178 2179**Description** 2180 2181Key change callback. 2182 2183 2184### keyChangeCallback [2/2] 2185 2186``` 2187OH_MediaKeySession_KeyChangeCallback OH_MediaKeySession_Callback::keyChangeCallback 2188``` 2189 2190**Description** 2191 2192Key change callback. 2193 2194### keyId 2195 2196``` 2197uint8_t DRM_KeysInfo::keyId[MAX_KEY_INFO_COUNT][MAX_KEY_ID_LEN] 2198``` 2199 2200**Description** 2201 2202Media key ID array. 2203 2204 2205### keysInfoCount 2206 2207``` 2208uint32_t DRM_KeysInfo::keysInfoCount 2209``` 2210 2211**Description** 2212 2213Number of media keys. 2214 2215 2216### mimeType 2217 2218``` 2219char DRM_MediaKeyRequestInfo::mimeType[MAX_MIMETYPE_LEN] 2220``` 2221 2222**Description** 2223 2224Media key type. 2225 2226 2227### name 2228 2229``` 2230char DRM_MediaKeySystemDescription::name[MAX_MEDIA_KEY_SYSTEM_NAME_LEN] 2231``` 2232**Description** 2233DRM solution name. 2234 2235 2236### optionData 2237 2238``` 2239char DRM_MediaKeyRequestInfo::optionData[MAX_MEDIA_KEY_REQUEST_OPTION_COUNT][MAX_MEDIA_KEY_REQUEST_OPTION_DATA_LEN] 2240``` 2241 2242**Description** 2243 2244Optional data set. 2245 2246 2247### optionName 2248 2249``` 2250char DRM_MediaKeyRequestInfo::optionName[MAX_MEDIA_KEY_REQUEST_OPTION_COUNT][MAX_MEDIA_KEY_REQUEST_OPTION_NAME_LEN] 2251``` 2252 2253**Description** 2254 2255Optional data name set. 2256 2257 2258### optionsCount 2259 2260``` 2261uint32_t DRM_MediaKeyRequestInfo::optionsCount 2262``` 2263 2264**Description** 2265 2266Number of optional data items. 2267 2268 2269### psshCount 2270 2271``` 2272uint32_t DRM_MediaKeySystemInfo::psshCount 2273``` 2274 2275**Description** 2276 2277Number of pieces of PSSH data in DRM information. 2278 2279 2280### psshInfo 2281 2282``` 2283DRM_PsshInfo DRM_MediaKeySystemInfo::psshInfo[MAX_PSSH_INFO_COUNT] 2284``` 2285 2286**Description** 2287 2288Array of PSSH data in DRM information. 2289 2290 2291### statisticsCount 2292 2293``` 2294uint32_t DRM_Statistics::statisticsCount 2295``` 2296 2297**Description** 2298 2299Number of statistical items. 2300 2301 2302### statisticsDescription 2303 2304``` 2305char DRM_Statistics::statisticsDescription[MAX_STATISTICS_COUNT][MAX_STATISTICS_BUFFER_LEN] 2306``` 2307 2308**Description** 2309 2310Statistical information set. 2311 2312 2313### statisticsName 2314 2315``` 2316char DRM_Statistics::statisticsName[MAX_STATISTICS_COUNT][MAX_STATISTICS_NAME_LEN] 2317``` 2318 2319**Description** 2320 2321Statistical item name set. 2322 2323 2324### statusCount 2325 2326``` 2327uint32_t DRM_MediaKeyStatus::statusCount 2328``` 2329 2330**Description** 2331 2332Length of the media key status array. 2333 2334 2335### statusName 2336 2337``` 2338char DRM_MediaKeyStatus::statusName[MAX_MEDIA_KEY_STATUS_COUNT][MAX_MEDIA_KEY_STATUS_NAME_LEN] 2339``` 2340 2341**Description** 2342 2343Array of media key status names. 2344 2345 2346### statusValue [1/2] 2347 2348``` 2349char DRM_KeysInfo::statusValue[MAX_KEY_INFO_COUNT][MAX_KEY_STATUS_VALUE_LEN] 2350``` 2351 2352**Description** 2353 2354Array of media key status values in the media key information. 2355 2356 2357### statusValue [2/2] 2358 2359``` 2360char DRM_MediaKeyStatus::statusValue[MAX_MEDIA_KEY_STATUS_COUNT][MAX_MEDIA_KEY_STATUS_VALUE_LEN] 2361``` 2362 2363**Description** 2364 2365Array of media key status values in a media key session. 2366 2367 2368### type [1/2] 2369 2370``` 2371DRM_MediaKeyType DRM_MediaKeyRequestInfo::type 2372``` 2373 2374**Description** 2375 2376Media key type, which can be online or offline, in a media key request. 2377 2378 2379### type [2/2] 2380 2381``` 2382DRM_MediaKeyRequestType DRM_MediaKeyRequest::type 2383``` 2384 2385**Description** 2386 2387Type of a media key request. 2388 2389 2390### uuid [1/2] 2391 2392``` 2393uint8_t DRM_PsshInfo::uuid[DRM_UUID_LEN] 2394``` 2395 2396**Description** 2397UUID of a DRM solution in PSSH data. 2398 2399 2400### uuid [2/2] 2401 2402``` 2403uint8_t DRM_MediaKeySystemDescription::uuid[DRM_UUID_LEN] 2404``` 2405**Description** 2406UUID of a DRM solution supported by the device. 2407