The initial APIs of this module are supported since API version 11. Newly added APIs will be marked with a superscript to indicate their earliest API version.
Enumerates the DRM error codes.
Atomic service API: This API can be used in atomic services since API version 14.
System capability: SystemCapability.Multimedia.Drm.Core
| Name | Value | Description |
|---|---|---|
| ERROR_UNKNOWN | 24700101 | Unknown error. Returned when an unclassifiable exception occurs. It is recommended that you check whether the input parameters are valid and whether the DRM service is running properly. |
| MAX_SYSTEM_NUM_REACHED | 24700103 | The number of MediaKeySystem instances exceeds the upper limit (64). Call the destroy method to destroy the unneeded MediaKeySystem instances and try again. |
| MAX_SESSION_NUM_REACHED | 24700104 | The number of MediaKeySession instances exceeds the upper limit (64). Call the destroy method to destroy the unneeded MediaKeySession instances and try again. |
| SERVICE_FATAL_ERROR | 24700201 | DRM service error. Returned when a fatal error occurs in the DRM service. Possible causes: insufficient system resources, DRM service process crash, or system exception. It is recommended that you restart the application or the device and try again. |
Enumerates the predefined configuration properties.
Atomic service API: This API can be used in atomic services since API version 14.
System capability: SystemCapability.Multimedia.Drm.Core
| Name | Value | Description |
|---|---|---|
| CONFIG_DEVICE_VENDOR | 'vendor' | Plugin vendor name, which corresponds to the value of vendor in the return value of getConfigurationString. |
| CONFIG_DEVICE_VERSION | 'version' | Plugin version number. Obtains the corresponding configuration value of the version through the getConfigurationString API. |
| CONFIG_DEVICE_DESCRIPTION | 'description' | Device description. Obtains the corresponding configuration value of the description through the getConfigurationString API. |
| CONFIG_DEVICE_ALGORITHMS | 'algorithms' | Supported algorithms, which correspond to the value of algorithms in the return value of getConfigurationString. |
| CONFIG_DEVICE_UNIQUE_ID | 'deviceUniqueId' | Unique device ID, which corresponds to the value of deviceUniqueId in the return value of getConfigurationByteArray. |
| CONFIG_SESSION_MAX | 'maxSessionNum' | Maximum number of supported sessions, which corresponds to the value of maxSessionNum in the return value of getConfigurationString. |
| CONFIG_SESSION_CURRENT | 'currentSessionNum' | Number of active sessions, which corresponds to the value of currentSessionNum in the return value of getConfigurationString. |
Enumerates the types of media keys.
Atomic service API: This API can be used in atomic services since API version 14.
System capability: SystemCapability.Multimedia.Drm.Core
| Name | Value | Description |
|---|---|---|
| MEDIA_KEY_TYPE_OFFLINE | 0 | Offline media key, used in offline playback scenarios. |
| MEDIA_KEY_TYPE_ONLINE | 1 | Online media key, used in online playback scenarios. |
Enumerates the statuses of offline media keys.
Atomic service API: This API can be used in atomic services since API version 14.
System capability: SystemCapability.Multimedia.Drm.Core
| Name | Value | Description |
|---|---|---|
| OFFLINE_MEDIA_KEY_STATUS_UNKNOWN | 0 | Unknown status. |
| OFFLINE_MEDIA_KEY_STATUS_USABLE | 1 | The media key is available. |
| OFFLINE_MEDIA_KEY_STATUS_INACTIVE | 2 | Inactive state, possibly caused by key expiration or being disabled by the server, requiring the key to be obtained again. |
Enumerates the statuses of device certificates.
Atomic service API: This API can be used in atomic services since API version 14.
System capability: SystemCapability.Multimedia.Drm.Core
| Name | Value | Description |
|---|---|---|
| CERT_STATUS_PROVISIONED | 0 | A device certificate is provisioned. |
| CERT_STATUS_NOT_PROVISIONED | 1 | A device certificate is not provisioned. |
| CERT_STATUS_EXPIRED | 2 | The device certificate has expired. Reapply for a device certificate. |
| CERT_STATUS_INVALID | 3 | The device certificate is invalid. |
| CERT_STATUS_UNAVAILABLE | 4 | The device certificate is unavailable. |
Enumerates the types of media key requests.
Atomic service API: This API can be used in atomic services since API version 12.
System capability: SystemCapability.Multimedia.Drm.Core
| Name | Value | Description |
|---|---|---|
| MEDIA_KEY_REQUEST_TYPE_UNKNOWN | 0 | Unknown type. |
| MEDIA_KEY_REQUEST_TYPE_INITIAL | 1 | Initial request, triggered when the media key is obtained for the first time. |
| MEDIA_KEY_REQUEST_TYPE_RENEWAL | 2 | Renewal request, triggered when the license is about to expire or its validity period needs to be extended. |
| MEDIA_KEY_REQUEST_TYPE_RELEASE | 3 | Release request, triggered when the offline media key is actively released or the session is closed, used to notify the server to release resources. |
| MEDIA_KEY_REQUEST_TYPE_NONE | 4 | No request. |
| MEDIA_KEY_REQUEST_TYPE_UPDATE | 5 | Update request. |
Enumerates the content protection levels.
Atomic service API: This API can be used in atomic services since API version 12.
System capability: SystemCapability.Multimedia.Drm.Core
| Name | Value | Description |
|---|---|---|
| CONTENT_PROTECTION_LEVEL_UNKNOWN | 0 | Unknown content protection level. |
| CONTENT_PROTECTION_LEVEL_SW_CRYPTO | 1 | Software content protection level, which uses software decryption and is suitable for playback scenarios with low security requirements. |
| CONTENT_PROTECTION_LEVEL_HW_CRYPTO | 2 | Hardware content protection level, which uses hardware decryption, provides higher security, and is suitable for most commercial content playback scenarios. |
| CONTENT_PROTECTION_LEVEL_ENHANCED_HW | 3 | Hardware-enhanced content protection level, which uses a hardware security module for decryption, provides the highest security, and is suitable for high-value content playback scenarios. |
| CONTENT_PROTECTION_LEVEL_MAX | 4 | Maximum content protection level. |