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