To protect your live streaming content, push authentication is enabled for push domains by default. You can use the address generator on the details page of a push domain to generate a push URL, which you can use to push streams (upload live videos) to the CSS platform.
xxxx.tlivepush.com
. You can use it to test live push, but you’re not advised to use it as the push domain name for business purposes. You have activated the CSS service.
Note:The primary key is required and the backup key is optional. Entering both allows you to switch to the other key when one key is disclosed.
2021-06-30 19:26:02
.StreamName
, such as liveteststream
.StreamName
.StreamName
with your stream name and you can use the corresponding playback URLs to play the stream.An RTMP push URL looks like this:
rtmp://domain/AppName/StreamName?txSecret=Md5(key+StreamName+hex(time))&txTime=hex(time)
It includes the following fields:
domain
: Push domain nameAppName
: Live streaming application name, which is live
by default and is customizableStreamName
: Custom stream name used to identify a live streamtxSecret
: Authentication string generated after push authentication is enabledtxTime
: Expiration timestamp set for the push URL in the consoleNote:
- If you have enabled authentication, the actual expiration time of a URL will be
txTime
plus the validity period of the key.- For the sake of convenience, the time you set in the console is the actual expiration time. If you enable authentication, the system will calculate the
txTime
when generating push URLs.- As long as you start push or playback before the expiration time and the stream is not interrupted, the push or playback can continue even after the URL expires.
We offer sample code in PHP and Java for generating push URLs. To view the code, follow the steps below:
/**
* Get the push URL
* If you do not pass in the authentication key and URL expiration time, a URL without hotlink protection will be returned.
* @param domain: Your push domain name
* streamName: A unique stream name to identify the push URL
* key: Authentication key
* time: Expiration time (accurate to the second). Example: 2016-11-12 12:00:00
* @return String url
function getPushUrl($domain, $streamName, $key = null, $time = null){
if($key && $time){
$txTime = strtoupper(base_convert(strtotime($time),10,16));
//txSecret = MD5( KEY + streamName + txTime )
$txSecret = md5($key.$streamName.$txTime);
$ext_str = "?".http_build_query(array(
"txSecret"=> $txSecret,
"txTime"=> $txTime
));
}
return "rtmp://".$domain."/live/".$streamName . (isset($ext_str) ? $ext_str : "");
}
echo getPushUrl("123.test.com","123456","69e0daf7234b01f257a7adb9f807ae9f","2016-09-11 20:08:07");
You can start pushing streams after the push URL is generated. For details, see Live Push.
Was this page helpful?