tencent cloud

Feedback

Stage 4. Play back an encrypted video

Last updated: 2022-05-26 16:10:08

    Overview

    This document describes how to encrypt a video and use the superplayer to play back the encrypted video.

    Before reading this document, make sure that you have read Stage 1. Play back a video with superplayer and Stage 2. Play back a video with hotlink protection enabled in the Superplayer Guide. This document uses the account activated and the video uploaded in stage 1, and hotlink protection needs to be enabled as instructed in stage 2.

    Step 1. Encrypt a video

    1. Select Media Assets > Video Management in the VOD console, select the target video (FileId: 528xxx3757278095), and click Process Video.
    2. On the video processing page:
    • Select Task Flow for Processing Type.
    • Select SimpleAesEncryptPreset for Task Flow Template.
      Note:

      • SimpleAesEncryptPreset is a preset task flow, which uses template 12 for adaptive bitrate streaming, template 10 for thumbnail generating, and template 10 for image sprite capturing.
      • Adaptive bitrate streaming with template 12 is to output an encrypted multi-bitrate stream.
    1. Click Confirm and wait until the Video Status changes from "Processing" to "Normal", which indicates that video processing is completed.
    2. Click Manage in the Operation column of the video to enter the management page:
    • Click the Basic Info tab, and you can view the generated thumbnail and output encrypted adaptive bitstream (template ID: 12).
    • Click the Screenshot Info tab, and you can view the generated image sprite (template ID: 10).

    Step 2. Preview video playback

    In the previous step, you have uploaded and processed the video. Now, you can use the superplayer for web, iOS, and Android to quickly preview video playback.

    1. Select Media Assets > Video Management, find the video uploaded and processed in step 1, click Manage in the Operation column, and select Superplayer Preview.
    2. Select basicDrmPreset for Superplayer Configuration.
    Note:

    basicDrmPreset is a preset superplayer configuration, which is used to output the adaptive bitstream with template 12 and the image sprite with template 10.

    1. As hotlink protection is enabled for the default distribution domain name, you can set the hotlink protection expiration time and the preview duration on the Playback Control tab. You can use the default parameter settings here (the default expiration time of playback hotlink protection is one day, and the preview duration and maximum number of IPs allowed for playback are left empty).
    2. In Web Player, click the button in the middle of the player to play back the video on web.
    3. In Mobile Player, click Scan code to download and install "Tencent Cloud Toolkit".
    4. Open Tencent Cloud Toolkit on your mobile phone, select Player > Superplayer, click the top-right corner to scan the QR code, and you can play back the video on your phone.

    Step 3. Use a demo for verification

    The superplayer requires a signature within its validity period to play back the encrypted video. You can use the signature tool to quickly generate a signature as shown below.

    1. Enter the Superplayer - Signature Generation Tool page and enter the following parameters:
    • User appId: appId of video 1400xxx357(if a subapplication is used, enter the subapplication's appId).
    • Video fileId: Video FileId, which is 528xxx3757278095.
    • Current Unix Timestamp: Current Unix time automatically generated by the tool, which does not need to be entered manually and is 1591756516 here.
    • Superplayer Configuration: Preset superplayer configuration name: basicDrmPreset.
    • Signature Expiration Unix Timestamp: Signature expiration time, which can be left empty. The signature will expire in one day by default.
    • URL Expiration Time: Expiration time of key hotlink protection, which can be set to the hexadecimal Unix time after six hours: 5ee09b44.
    • Hotlink Protection Key: Previously obtained hotlink protection key, which is 2WExxx48eW.
      Note:

      basicDrmPreset is a preset superplayer configuration, which is used to output the adaptive bitstream with template 12 and the image sprite with template 10.

    1. Click Generate Signature, and the generated signature will be displayed in the Signature Generation Result text box.

    After getting the superplayer signature, you can use the superplayer demos for web, Android, and iOS for verification. For more information, see the demo source code.

    Note:

    In Media Assets > Video Management > Superplayer Preview in the console, you can get the corresponding web player source code for video preview for your reference.

    Summary

    At this point, you have understood how to encrypt a video and use the superplayer to play back the encrypted video.

    Contact Us

    Contact our sales team or business advisors to help your business.

    Technical Support

    Open a ticket if you're looking for further assistance. Our Ticket is 7x24 avaliable.

    7x24 Phone Support