Release Notes
Announcements
rtmp://[BucketName-APPID].[host]/live/[channel]?[params]
rtmp://examplebucket-1250000000.cos.ap-guangzhou.myqcloud.com/live/test-channel?q-sign-algorithm=sha1&q-ak=************************************&q-sign-time=1606445586;1606545646&q-key-time=1606445586;1606545646&q-signature=****************************************
APPID. It is similar to other COS HTTP requests.live.q-sign-algorithm=sha1&q-ak=************************************ order after the question mark (?). Currently, these parameters are used to deliver the signing information. The following describes how to generate the signature parameters:Signature Parameter | Description |
q-sign-algorithm | Signature algorithm. Currently, it is fixed to sha1. |
q-ak | |
q-sign-time | Start timestamp and end timestamp (in Unix format) of the signature validity period (e.g., 1557902800;1557910000) |
q-key-time | Start timestamp and end timestamp (in Unix format) of the key validity period. |
Other parameters | Other parameters will be extended in the future. You are advised to leave it empty for the time being. |
q-signature | The signature calculated with signature parameters |
q-signature in the push request is calculated as follows:Signaure=hmac-sha1(SecretKey , "sha1\\n" + KeyTime + "\\n" + sha1Hex(RtmpString) + "\\n")
EndTimestamp for the signature to expire according to StartTimestamp and the expected validity period of the signature.KeyTime by splicing the two timestamps above in StartTimestamp;EndTimestamp format (e.g., 1557902800;1557910000).RtmpString in CanonicalizedResource\\nCanonicalizedParams\\n format according to the resource information and parameters (empty currently) in the request.CanonicalizedResource is information about the requested resource. RTMP push requests take /[BucketName-APPID]/[channel].CanonicalizedParams is the request parameter information. Currently, you can leave it empty.\\n is a line break. If a string is empty, the line breaks before and after it need to be retained, for example, /examplebucket-1250000000/test-channel\\n\\n.StringToSign with KeyTime and RtmpString, in sha1\\nKeyTime\\nsha1Hex(RtmpString)\\n format.
Where:sha1 is a fixed string.\\n is a line break.sha1Hex(RtmpString) is the message digest of the RTMP string. It is a hexadecimal string (lowercase), for example, 54ecfe22f59d3514fdc764b87a32d8133ea611e6.SecretKey as the key and StringToSign as the message to calculate the message digest, that is, the Signature (for example, 01681b8c9d798a678e43b685a9f1bba0f6c0e012).SecretId, KeyTime, and Signature are generated, generate the complete signing information in the following format:q-sign-algorithm=sha1&q-ak=************************************&q-sign-time=KeyTime&q-key-time=KeyTime&q-signature=****************************************
KeyTime = [Now];[Expires]RtmpString = [CanonicalizedResource]\\n\\nStringToSign = sha1\\nKeyTime\\nSHA1(RtmpString)\\nSignature = HMAC-SHA1(SignKey, StringToSign)
HMAC-SHA1 using your preferred programming language, please see the Sample Code section in Request Signature.APPID, SecretId, and SecretKey. The following values are examples:APPID | SecretId | SecretKey |
1250000000 | ************************************ | ************************************ |
Region | Bucket Name | Channel Name |
ap-guangzhou | examplebucket-1250000000 | test-channel |
1606550430;1606554030/examplebucket-1250000000/test-channel/examplebucket-1250000000/test-channel\\n\\nsha1\\n1606550430;1606554030\\n44bb35a2713324b40406f7b4b457e33df378a346\\nffmpeg -re -i /data/example.mp4 -vcodec h264 -acodec aac -f flv -y "rtmp://examplebucket-1250000000.cos.ap-guangzhou.myqcloud.com/live/test-channel?q-sign-algorithm=sha1&q-ak=************************************&q-sign-time=1606550430;1606554030&q-key-time=1606550430;1606554030&q-signature=****************************************
Was this page helpful?
You can also Contact sales or Submit a Ticket for help.
Help us improve! Rate your documentation experience in 5 mins.
Feedback