This topic describes how to use the digital rights management (DRM) encryption feature and use ApsaraVideo Player SDK to play encrypted videos.
Limits
You can enable the DRM encryption feature only by using the ApsaraVideo VOD console.
The DRM encryption feature is supported only in the China (Shanghai), China (Beijing), and Singapore regions.
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 encryption.
DRM encryption compatibility
DRM solution | Mobile device | Browser |
widevine | Android | Chrome, Firefox 47 and later, Microsoft Edge, and Opera |
fairplay | iOS | Safari |
DRM encryption for videos
Step 1: (Optional) Apply for and upload a DRM certificate
If you want to use DRM encryption based on FairPlay Streaming, you must apply for a certificate from Apple and upload the certificate. If you want to use DRM encryption based on Widevine for Android, skip this step.
Apply for a FairPlay Streaming certificate.
For more information, see Apply for a FairPlay Streaming 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.
Content
The FairPlay Streaming certificate. Only .cer files are supported.
Private Key
The password-protected private key that is created when you apply for the FairPlay Streaming certificate.
PassPhrase
The key that is 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). The ASk is provided by Apple for you when you apply for the FairPlay Streaming certificate. The key must be 1 to 32 characters in length and can contain letters and digits.
Click OK.
Step 2: Create a transcoding template group and specify DRM encryption
Log on to the ApsaraVideo VOD console. In the left-side navigation pane, choose Configuration Management > Media Processing > Transcoding Template Groups.
On the Transcoding Template Groups page, click Create Transcoding Template Group to create a transcoding template group and specify DRM encryption.
You can specify DRM encryption in a regular transcoding template or a video packaging template. The following steps describe how to specify DRM encryption in a regular transcoding template:
In the Basic Parameters section, set Encapsulation Format to hls.
In the Advanced Parameters section, turn on Video Encryption and specify DRM Encryption for the Encryption Method parameter.
Configure other parameters based on your business requirements. For more information, see Configure regular transcoding templates.
Click Save.
After you create a transcoding template group, you can view the ID of the transcoding template group on the Transcoding Template Groups page. Save the ID for subsequent use.
Step 3: (Optional) Create a workflow and add the transcoding template group in which DRM encryption is specified
You can add media processing tasks such as transcoding, review, snapshot capture tasks to a workflow based on a specific order. This way, you can use the workflow to process media files in the specified order.
You can add a Transcode node to your workflow and use the transcoding template group in which DRM encryption is specified. You can create workflows only by using the ApsaraVideo VOD console. For more information, see Workflows.
Step 4: Start transcoding
You can trigger transcoding when and after you upload media files. To submit a transcoding task, you can specify a transcoding template group or a workflow that contains a Transcode node.
You can use a transcoding template group in which DRM encryption is specified or a workflow to trigger DRM encryption and transcoding when you upload a video. After the video is uploaded, you can use only a workflow to trigger DRM encryption and transcoding for the video. For more information about how to start transcoding by using the ApsaraVideo VOD console, see Step 2: Start transcoding. For more information about how to start transcoding by using the ApsaraVideo VOD API, see Step 2: Start transcoding.
Step 5: View the transcoding results
Obtain results from the callback
If you have configured event notifications, you can obtain the transcoding results from the StreamTranscodeComplete or TranscodeComplete callback. For more information, see Event notification.
Query the results
Play DRM-encrypted videos
DRM-encrypted videos can be played only by using ApsaraVideo Player.
ApsaraVideo Player SDK is supported on multiple platforms including iOS, Android, and Web (HTML and Flash players). You can use ApsaraVideo Player SDK to play DRM-encrypted videos in your application or website.
When you use ApsaraVideo Player SDK to play DRM-encrypted videos, take note of the following items:
The version of ApsaraVideo Player SDK must be 5.2.1 or later. FairPlay Streaming is supported for iOS and Widevine is supported for Android.
Before you use ApsaraVideo Player SDK, you must obtain a license. For more information, see Obtain a license.
Before you integrate ApsaraVideo Player SDK, make sure that you understand the compatibility of DRM encryption with ApsaraVideo Player SDKs on different platforms. For more information, see Compatibility of ApsaraVideo Player SDK.
For more information about how to use ApsaraVideo Player SDK to play encrypted videos, see Use ApsaraVideo Player SDK for Web, Use ApsaraVideo Player SDK for Android, and Use ApsaraVideo Player SDK for iOS.
Operations such as rotating, mirroring, and snapshot capture are not supported when you play high-security videos such as DRM-encrypted videos.