This topic describes how to use the Digital Rights Management (DRM) encryption feature of ApsaraVideo VOD. This includes how to encrypt videos with DRM and how to play DRM-encrypted videos using ApsaraVideo Player SDK.
Limits
You can enable DRM encryption only in the ApsaraVideo VOD console.
Billing
DRM encryption is implemented during video transcoding. You are charged only for transcoding when you transcode a video. You are charged for DRM encryption every time a device requests a license to play a DRM-encrypted video. For more information about billing, see DRM billing.
DRM encryption compatibility
DRM solution | Mobile device | Browser |
widevine | Android | Chrome, Firefox 47 and later, Microsoft Edge, and Opera |
fairplay | iOS | Safari |
Encrypt videos with DRM
Step 1: (Optional) Apply for and upload a DRM certificate
If you want to use the FairPlay scheme for DRM encryption on iOS, you must apply for and upload a FairPlay certificate. You can skip this step if you only need the Widevine scheme for DRM encryption on Android.
Apply for a FairPlay certificate.
For more information, see Apply for a FairPlay certificate.
Upload the FairPlay certificate.
Log on to the ApsaraVideo VOD console.
In the left-side navigation pane, choose Configuration Management > Media Processing > DRM Certificates.
Click Upload Certificate.

Parameter
Description
Certificate Name
The name of the certificate. The name must be 2 to 32 characters long.
Content
Upload the FairPlay Certificate. Only .cer files are supported.
Private Key
The password-protected private key that is created when you apply for the certificate.
Passphrase
The key used to decrypt the private key. The key must be 1 to 32 characters in length and can contain letters and digits.
ASk
The Application Secret Key (ASk). Apple provides the ASk when you apply for the certificate. The key must be 1 to 32 characters in length and can contain letters and digits.
Click OK to complete the upload.
Step 2: Create a transcoding template group for DRM encryption
Log on to the ApsaraVideo VOD console. In the navigation pane on the left, choose Configuration Management > Media Processing > Transcoding Template Groups.
On the Transcoding Template Groups page, click Create Transcoding Template Group to create a group for DRM encryption.
You can enable DRM encryption in a regular transcoding template or a video packaging template. The following example shows how to enable DRM encryption in a regular transcoding template:
In the Basic information section, set Encapsulation Format to HLS.
In the Advanced Parameters section, enable Video Encryption and select DRM Encryption.
Configure other parameters as needed. For more information, see Transcoding templates.

Click Save to create the template.
After the template is created, you can view the ID of the transcoding template group on the Transcoding Template Groups page. Save the ID for later use when you initiate a DRM-encrypted transcoding job.
Step 3: (Optional) Create a workflow and associate it with the DRM transcoding template group
You can orchestrate media processing tasks, such as transcoding, review, and snapshotting, into a workflow. When you trigger the workflow during media upload or processing, the media files are automatically processed according to the predefined workflow.
You can add a media transcoding node that is associated with the DRM transcoding template group to the workflow. Currently, you can create workflows only in the console. For more information, see Workflows.
Step 4: Initiate a DRM-encrypted transcoding job for a video
ApsaraVideo VOD lets you trigger transcoding during or after you upload a video. You can start a transcoding job directly from a transcoding template group or from a workflow that includes a media transcoding node.
You can use a transcoding template group or a workflow to trigger DRM-encrypted transcoding during video upload. After a video is uploaded, you can trigger DRM-encrypted transcoding only using a workflow. Using a transcoding template group to trigger the job after the upload is not supported. For more information about how to start transcoding in the console, see Audio and video transcoding. For more information about how to start transcoding using OpenAPI, see Audio and video transcoding.
Step 5: View the DRM-encrypted transcoding result
Wait for asynchronous notifications
If you have configured event notifications for ApsaraVideo VOD, you can receive callback messages for Single Definition Transcoding Complete or All Definitions Transcoding Complete to obtain the transcoding job information. To configure event notifications, see Event notifications.
Query the job synchronously
Play DRM-encrypted videos
Videos encrypted with DRM can be decrypted and played only using the ApsaraVideo Player SDK provided by ApsaraVideo VOD.
ApsaraVideo Player SDK provides player SDKs for multiple platforms, such as iOS, Android, and Web (HTML5 and Flash). You can integrate these SDKs to play DRM-encrypted videos in your applications or on your websites.
When you use ApsaraVideo Player SDK to play DRM-encrypted videos, note the following:
The ApsaraVideo Player SDK version must be 5.2.1 or later. Currently, FairPlay is supported on iOS, and Widevine is supported on Android.
Before you use ApsaraVideo Player SDK, you must obtain a player license. For more information, see Manage licenses.
Before you integrate the ApsaraVideo Player SDK, review the compatibility of the player SDKs with DRM encryption on different platforms. For more information, see Compatibility of player SDKs for encrypted playback.
For the specific steps to play DRM-encrypted videos using ApsaraVideo Player SDK, see Play encrypted videos, Play encrypted videos, and Play encrypted videos.
Operations such as rotating, mirroring, and taking screenshots are not supported when you play high-security videos, such as DRM-encrypted videos.
