KEY
) to generate a signature and add it to a playback URL. As long as the key is not disclosed, the URL cannot be forged.http://example.vod2.myqcloud.com/dir1/dir2/myVideo.mp4?t=[t]&exper=[exper]&rlimit=[rlimit]&us=[us]&whreg=[whreg]&whref=[whref]&sign=[sign]
Parameter | Required | Description |
KEY | Yes | The key used when key hotlink protection is enabled. It can contain 8–20 letters (a–Z) or digits (0–9). We recommend you generate this key in the console. For detailed directions, see Setting Hotlink Protection. |
Dir | Yes | The part of the original video URL with the filename removed. For example, if the original URL is http://example.vod2.myqcloud.com/dir1/dir2/myVideo.mp4 , then the playback path is /dir1/dir2/ . |
t | Yes | The expiration time of the playback URL, which is a Unix hexadecimal timestamp in lowercase. Once expired, the URL will become invalid, and a 403 error will be returned. Given the potential time differences between devices, we recommend you set the expiration time five minutes (300 seconds) later than the actual time you want the URL to expire. The validity period of the URL should be longer than the video length so that the full video can be played. |
exper | No | The preview duration in decimal seconds. If this parameter is left empty or set to 0, preview is disabled (the full video will be returned). The preview duration must be shorter than the original video duration; otherwise, playback may fail. |
rlimit | No | The maximum number (decimal) of IP addresses allowed to play the video. The maximum value is 9. If this parameter is left empty, there is no restriction. Suppose you want your video to be played by only one user. We do not recommend setting rlimit to 1 (instead, set it to 3, for example). This is because the IP of a mobile device may change after a reconnection. |
us | No | The URL ID, which randomizes a hotlink protection URL and improves its uniqueness. We recommend you use a random us value every time you generate a hotlink protection URL. |
whreg | No | A list of regions allowed to play the video. You can specify 1-10 three-letter region codes. Separate the codes with commas. |
bkreg | No | A list of regions banned from playing the video. You can specify 1-10 three-letter region codes. Separate the codes with commas. |
whref | No | A list of domains allowed to play the video. You can specify 1-10 domains. Leave out the http:// and https:// prefix, and separate the domains with commas. If you pass in abc.com , it will cover lower-level domains such as abc.com/123 and abc.com.cn . Wildcards are supported. For example, you can pass in *.abc.com . |
bkref | No | A list of domains banned from playing the video. You can specify 1-10 domains. Leave out the http:// and https:// prefix, and separate the domains with commas. If you pass in abc.com , it will cover lower-level domains such as abc.com/123 and abc.com.cn . Wildcards are supported. For example, you can pass in *.abc.com . |
sign | Yes | The hotlink protection signature, which verifies the validity of a hotlink protection URL. It must be a 32-character hexadecimal number. A 403 error will be returned if a URL fails to pass the signature verification. For how to generate the signature, see below. |
sign = md5(KEY + Dir + t + exper + rlimit + us + whref + bkref + whreg + bkreg)
+
in the formula is used to concatenate two strings. Optional parameters can be empty strings.http://example.vod2.myqcloud.com/dir1/dir2/myVideo.mp4
. You have enabled key hotlink protection. The generated key is 24FEQmTzro4V5u3D5epW
, and the generated random string is 72d4cd1101
, and now you want to:Parameter | Value | Description |
KEY | 24FEQmTzro4V5u3D5epW | The key you set when enabling key hotlink protection. |
Dir | /dir1/dir2/ | The part of the original video URL with the filename myVideo.mp4 removed. |
t | 5a71afc0 | The expiration timestamp (1517400000) converted to hexadecimal. |
us | 72d4cd1101 | The generated random string. |
sign = md5("24FEQmTzro4V5u3D5epW/dir1/dir2/5a71afc072d4cd1101") = "3d8488faeb37d52d6bf63b63c1b171c3"
http://example.vod2.myqcloud.com/dir1/dir2/myVideo.mp4?t=5a71afc0&us=72d4cd1101&sign=3d8488faeb37d52d6bf63b63c1b171c3
Parameter | Value | Description |
KEY | 24FEQmTzro4V5u3D5epW | The key you set when enabling key hotlink protection. |
Dir | /dir1/dir2/ | The part of the original video URL with the filename myVideo.mp4 removed. |
t | 5a71afc0 | The expiration timestamp (1517400000) converted to hexadecimal. |
rlimit | 3 | Allow up to three IP addresses to play the video. |
us | 72d4cd1101 | The generated random string. |
sign = md5("24FEQmTzro4V5u3D5epW/dir1/dir2/5a71afc0372d4cd1101") = "c5214f0d5961b13acd558b4957c4dfc5"
http://example.vod2.myqcloud.com/dir1/dir2/myVideo.mp4?t=5a71afc0&rlimit=3&us=72d4cd1101&sign=c5214f0d5961b13acd558b4957c4dfc5
Parameter | Value | Description |
KEY | 24FEQmTzro4V5u3D5epW | The key you set when enabling key hotlink protection. |
Dir | /dir1/dir2/ | The part of the original video URL with the filename myVideo.mp4 removed. |
t | 5a71afc0 | The expiration timestamp (1517400000) converted to hexadecimal. |
exper | 300 | Set the preview duration to five minutes (300 seconds). |
us | 72d4cd1101 | The generated random string. |
sign = md5("24FEQmTzro4V5u3D5epW/dir1/dir2/5a71afc030072d4cd1101") = "547d98c4b91e81b5ea55c95cef63223f"
http://example.vod2.myqcloud.com/dir1/dir2/myVideo.mp4?t=5a71afc0&exper=300&us=72d4cd1101&sign=547d98c4b91e81b5ea55c95cef63223f
KEY
) must contain 8–20 letters or digits.t
, exper
, rlimit
, us
, and sign
; otherwise, playback will fail.
Was this page helpful?