Stage 2. Play back a video with hotlink protection enabled

Last updated: 2020-09-24 10:27:33

    Overview

    VOD supports hotlink protection configuration, which allows you to set the validity period, number of viewers, playback duration, etc. This document describes how to use the superplayer to play back a video with hotlink protection enabled.

    Before reading this document, please make sure that you have read Stage 1. Play back a video with superplayer in the Superplayer Guide. This document uses the account activated and the video uploaded in stage 1.

    The following takes enabling key hotlink protection for the default distribution domain name under your account as an example:

    Note:

    Please do not directly enable hotlink protection for the domain name in your production environment; otherwise, playback of videos in the production environment may fail.

    1. Log in to the VOD Console, select Distribution and Playback Settings > Domain Management, and click Settings of the "default distribution domain name" to enter the settings page.
    2. Click Edit on the right of "Key Hotlink Protection", toggle on Enable Key Hotlink Protection, and click Generate Random Key to generate a random key (2WExxx48eW). Copy the generated key and click OK to save the configuration and make it take effect.

    Step 2. Preview video playback

    In the previous step, you have enabled hotlink protection for the default distribution domain name. 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 "default" as Superplayer Configuration.

      Note:

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

    3. 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 1 day, and the preview duration and maximum number of IPs allowed for playback are left empty).

    4. In Web Player, click the button in the middle of the player, and you can play back the video on web.

    Step 3. Use a demo for verification

    After hotlink protection is enabled, the superplayer requires a signature within its validity period to play back the video. You can use the signature tool to quickly generate a signature.

    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 1591516390 here.
      • Signature Expiration Unix Timestamp: signature expiration time, which can be left empty. The signature will expire in 1 day by default.
      • Link Expiration Time: expiration time of key hotlink protection, which can be set to the hexadecimal Unix time after 6 hours: 5edcf146.
      • Hotlink Protection Key: hotlink protection key obtained in the previous step, which is 2WExxx48eW.
    2. 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, please 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 use the superplayer to play back a video with hotlink protection enabled.

    You can also:

    Was this page helpful?

    Was this page helpful?

    • Not at all
    • Not very helpful
    • Somewhat helpful
    • Very helpful
    • Extremely helpful
    Send Feedback
    Help