tencent cloud

Video on Demand

Encrypt Video Using MultiDRM

Download
Focus Mode
Font Size
Last updated: 2026-06-03 15:34:02
AI-Translated
This document aims to guide developers on how to pass Tencent Cloud Video on Demand (VOD) service to encrypt videos with Multi-DRM (encrypt only once while adapting to both Widevine and FairPlay protocols), and use Tencent Cloud Player for secure playback. The overall process covers preparation, hotlink protection configuration, transcoding encryption, signature generation, and multi-end playback integration, helping you build a complete video copyright protection implementation solution.

Prerequisites

Before you start, do the following:

Activating VOD

Follow the steps below to activate VOD:
2. Purchase VOD services. For details, see Billing Overview.
3. Go to the VOD console.
At this point, you have activated VOD.

Obtaining FairPlay certificate information

Submitting the certificate information

The example below shows how to enable key hotlink protection for the default distribution domain under your account:
Note:
We do not recommend enabling hotlink protection for a domain name already in use. Doing so may cause failure to play existing videos.
1. Log in to the VOD console, select Distribution and Playback > Domain Name on the left sidebar. Find the default distribution domain, click Set on the right, and select the Access Control tab.


2. Toggle on Key Hotlink Protection. In the pop-up window, click Generate to generate a random key (suppose it is vodtestkey). Copy the key and click Confirm. You will use the key later to generate playback signatures.
image-KEY



Step 2. Encrypt a Video

The encryption process for VOD (Video on Demand) is carried out simultaneously with the transcoding process. Therefore, you only need to configure the encryption method during transcoding setup. The following workflows are available to implement DRM encryption for videos.

Method 1: Use a task flow for MultiDRM encryption (Recommended)

Notes:
The task flow feature supports wrapping multiple media processing capabilities into a single task flow, which can be orchestrated according to your business needs for automated processing.
We have provided a rich set of preset task flow capabilities, while also supporting custom-defined task flows.
There are 2 ways to trigger a task flow:
Associate a task flow during video upload to automatically transcode and encrypt the video upon successful upload;
For existing videos that have already been uploaded, click on Media Processing to perform the operation.
For more information about task flows, please refer to the documentation: Video Processing Task System.

Description of Task Flow Usage

Preset Task Flow
Custom Task Flow
Our preset workflow includes multiple media processing operations, which will automatically perform the following on the video to be processed: HLS adaptive bitrate streaming, Multi-DRM encryption, sprite sheet generation, and cover image extraction.
For detailed task flow configuration, you can navigate in the console, enter the Media processing > Task Flow page, then select MultiDrm-WV-FP-V1-Preset in the task flow list and click View Details to learn about the specific preset task flow configuration.

You can also customize media processing task flows based on your business needs, and configure them by associating relevant media processing templates.
Create your own task flow
Create your own task flow

If you want to use the MultiDRM encryption capability, you need to select a transcoding template that supports adaptive bitrate streaming. Select the transcoding template: MultiDrm-WV-FP-V1-Preset (this is a preset encryption transcoding template provided by us; you can also create and configure your own transcoding template based on your specific business requirements).


Detailed Operation Steps

There are two methods available, and you can choose either one:
Automatic transcoding and encryption after upload.
For files that have already been uploaded, select them and then proceed with transcoding and encryption.
Automatic Transcoding and Encryption After Upload
Transcode and Encrypt Existing Files
1. Log in to the VOD Console, click Application Management in the left navigation bar, and go to the application list page.
2. Find the application for which you need to manage tasks, and click the application name to enter the application management page.
3. By default, you will be directed to Intelligent media assets > Audio/Video Management. Click Upload, and the operation page is shown in the figure below.

4. After clicking, you will be directed to the upload page. Under video processing, select Auto-processing after upload, then choose the corresponding encrypted transcoding workflow. Click Start Upload. The system will automatically execute the upload and media processing tasks in the background.

This operation can also be performed using the Upload SDK Python SDK.
1. Log in to the VOD Console, click on Application Management in the left navigation bar, and go to the Application List page.
2. Find the application whose tasks you need to manage, and click on the application name to enter the Application Management page.
3. By default, you will be directed to the Intelligent media assets management > Audio/Video Management page. Select the videos you want to process, click Media Processing, and the operation page is shown in the figure below.

4. After clicking, you will be directed to the Media Processing page. Set the Processing Type to Task Flow. Select the latest system-preset MultiDRM task flow template, click Confirm, and the system will proceed with transcoding and encryption processing.

5. After clicking Confirm and successfully submitting, a relevant notification will appear. You can check the specific task progress in the Task Center.

This operation also supports execution via API calls. For more details, please refer to the documentation Using Task Flow Templates for Video Processing.

Method 2: Custom Transcoding Template

You can create a custom adaptive bitrate streaming template in the VOD Console. When creating the template, select the corresponding encryption configuration. You can then use the API or the console to transcode and encrypt videos via a workflow or by directly invoking the template. For detailed documentation on adaptive bitrate streaming configuration, please refer to:
Media Processing Template Introduction: Media Processing Template Settings.
Adaptive Bitrate Streaming Operation Guide: Adaptive Bitrate Streaming Practice Tutorial.
Audio can also be encrypted by creating a custom adaptive bitrate streaming template for audio.

Step 3: Generate a Player Signature

Player signature, used for subsequent playback information queries. For generation methods, please refer to Player Signature.

Step 4: Play DRM-Encrypted Videos Using the Player

Supports playing encrypted videos using Tencent Cloud Player as well as other third-party players.

Using Tencent Cloud Player

Tencent Cloud Player related documentation:Player SDK Documentation
Web
iOS
Android
You only need to pass in the necessary playback file parameters (step 3) when initializing the player to play DRM-encrypted videos.

Step 1: Import files into the page

Import the player style file and related script files in the appropriate location:
<link href="https://web.sdk.qcloud.com/player/tcplayer/release/v4.5.4/tcplayer.min.css" rel="stylesheet"/>
<!--If you need to play WebRTC videos via H5 in modern browsers such as Chrome and Firefox, import TXLivePlayer-x.x.x.min.js before tcplayer.vx.x.x.min.js.-->
<!--Some browser environments do not support WebRTC. The player will automatically convert WebRTC stream URLs to HLS format, so hls.min.x.xx.xm.js also needs to be imported for live streaming scenarios.-->
<script src="https://web.sdk.qcloud.com/player/tcplayer/release/v4.5.4/libs/TXLivePlayer-1.2.3.min.js"></script>
<!--If you need to play HLS protocol videos via H5 in modern browsers such as Chrome and Firefox, import hls.min.x.xx.xm.js before tcplayer.vx.x.x.min.js.-->
<script src="https://web.sdk.qcloud.com/player/tcplayer/release/v4.5.4/libs/hls.min.1.1.5.js"></script>
<!--If you need to play FLV format videos via H5 in modern browsers such as Chrome and Firefox, import flv.min.x.x.x.js before tcplayer.vx.x.x.min.js.-->
<script src="https://web.sdk.qcloud.com/player/tcplayer/release/v4.5.4/libs/flv.min.1.6.3.js"></script>
<!--If you need to play DASH videos via H5 in modern browsers such as Chrome and Firefox, import dash.min.x.x.x.js before tcplayer.vx.x.x.min.js.-->
<script src="https://web.sdk.qcloud.com/player/tcplayer/release/v4.5.4/libs/dash.all.min.4.4.1.js"></script>
<!--Player script file-->
<script src="https://web.sdk.qcloud.com/player/tcplayer/release/v4.5.4/tcplayer.v4.5.4.min.js"></script>

Step 2: Place the Player Container

Add the player container at the desired position on the page where the player should be displayed. The code is as follows:
<video id="player-container-id" width="414" height="270" preload="auto" playsinline webkit-playsinline>
</video>
Note:
The container ID, width, and height can all be customized.

Step 3: Initialization Code

Add the following initialization script to the page initialization code, passing in the required initialization parameters (including the player signature psign generated in Step 3). The code is as follows:
For other parameters, please refer to the developer documentation Web Options parameter list.
var player = TCPlayer('player-container-id', {
appID: '1500014561', // Please enter the appID of the VOD account (required)
fileID: '387702304941991610', // Please enter the video filID you want to play (required)
psign: 'eyJhbGciOiJIUzI1NiJ9.eyJhcHBJZCI6MTUwMDAxNDU2MSwiZmlsZUlkIjoiMzg3NzAyMzA0OTQxOTkxNjEwIiwiY3VycmVudFRpbWVTdGFtcCI6MTY2MTE2MzM3MywiZXhwaXJlVGltZVN0YW1wIjoyNjQ4NTU3OTE5LCJwY2ZnIjoiYWR2YW5jZURybVByZXNldCJ9.rEZLhjgsoLc2htIUI_HckxvhVmdBhQyf5d-2Kku1JeA',
});
Please refer to the Integration Guide (via FileId method) to play DRM-encrypted videos. Note that the player signature (psign) generated in Step 3 is required during this process.
Notes:
Before getting started, please submit a ticket. Contact Us Obtain the SDK that supports the DRM feature.
Please refer to the Integration Guide (via FileId method) to play DRM-encrypted videos. Note that the player signature (psign) generated in Step 3 is required during this process.
For an introduction to the signature and how to generate it, please refer to the document.
Notes:
Before getting started, please submit a ticket. Contact Us Obtain the SDK that supports the DRM feature.
// It is recommended to use the new API below.
// psign is the player signature.
TXPlayInfoParams playInfoParam = new TXPlayInfoParams(1252463788, // Tencentcloud VOD appId
"4564972819220421305", // fileId
"psignxxxxxxx"); // Player Signature
mVodPlayer.startVodPlay(playInfoParam);

// Legacy API, not recommended for use.
TXPlayerAuthBuilder authBuilder = new TXPlayerAuthBuilder();
authBuilder.setAppId(1252463788);
authBuilder.setFileId("4564972819220421305");
mVodPlayer.startVodPlay(authBuilder);

Using a Third-Party Player



Help and Support

Was this page helpful?

Help us improve! Rate your documentation experience in 5 mins.

Feedback