Content is empty
If you don't find the content you expect, please try another search term
Last updated:2020-11-26 20:11:58
Note: By default, callbacks of the old version are enabled after you activate Kingsoft Cloud Live Service (KLS). We recommend that you enable callbacks of the new version in the KLS console.
Callbacks of the new version use the JSON format. You can enable callbacks of the new version in the KLS console.
When stream pushing over RTMP begins, the corresponding callback API is called. The following table describes the callback parameters.
Parameter | Type | Description | Example |
---|---|---|---|
Version | String | The version number. | 1.0 |
App | String | The app name. | live |
Pubdomain | String | The ingest domain. | xxx.xxx.com |
Stream | String | The stream name. | 123 |
PubStartUnixTime | String | The time when stream pushing begins. The value is a 13-digit Unix timestamp measured in milliseconds. Due to historical reasons, the timestamps for the start and end of stream pushing are of different types. You can contact technical support to convert this parameter to the Int type. | 1456800010000 |
NotifyType | String | The callback type. Valid values: PubStart and PubEnd. The value PubStart indicates that the callback is fired at the start of stream pushing. The value PubEnd indicates that the callback is fired at the end of stream pushing. | PubStart |
PubParam | Object | The parameters that are carried in the push stream. | |
ClientIp | String | The IP address of the stream pushing client. | |
ClientPort | Int | The port used by the client to push the stream. | |
Node | String | The CDN node that receives the stream. |
Sample callback at the start of stream pushing
{
"Version":"1.0",
"App":"live",
"Pubdomain":"xxx.xxx.com",
"Stream":"test",
"PubStartUnixTime":"1456800010000",
"NotifyType":"PubStart",
"ClientIp":" ",
"ClientPort":" ",
"Node":" ",
"PubParam":{
"param1": "123456",
"param2":11
}
}
When stream pushing over RTMP ends, the corresponding callback API is called. The following table describes the callback parameters.
Parameter | Type | Description | Example |
---|---|---|---|
Version | String | The version number. | 1.0 |
App | String | The app name. | live |
Pubdomain | String | The ingest domain. | xxx.xxx.com |
Stream | String | The stream name. | 123 |
PubStartUnixTime | String | The time when stream pushing ends. The value is a 13-digit Unix timestamp measured in milliseconds. | 1456800010000 |
NotifyType | String | The callback type. Valid values: PubStart and PubEnd. The value PubStart indicates that the callback is fired at the start of stream pushing. The value PubEnd indicates that the callback is fired at the end of stream pushing. | PubEnd |
PubParam | Object | The parameters that are carried in the push stream. | |
ClientIp | String | The IP address of the stream pushing client. | |
ClientPort | Int | The port used by the client to push the stream. | |
Node | String | The CDN node that receives the stream. |
Sample callback at the end of stream pushing
{
"Version":"1.0",
"App":"live",
"Pubdomain":"xxx.xxx.com",
"Stream":"test",
"PubEndUnixTime":1456800010000,
"NotifyType":"PubEnd",
"ClientIp":" ",
"ClientPort":" ",
"Node":" ",
"PubEndMessage":" ",
"PubParam":{
"param1":"123456",
"param2":11
}
}
In the old version, the callback URLs for notifying the start and end of RTMP stream pushing use the HTTP POST method. The parameters of the callback API include the app name, stream name, request type (the call parameter), and the flashver, swfurl, and tcurl parameters that are associated with the stream pushing. The value of the call parameter is user_publish at the start of stream pushing, and user_publish_done at the end of stream pushing.
When stream pushing over RTMP begins, the corresponding callback API is called.
Example
HTTP body
app=live&name=asdf&swfurl=nil&flashver=nil&tcurl=rtmp://test.uplive.ks-cdn.com/live&call=user_publish&vdoid=123456
The parameters of the callback API include the app name, stream name, request type (the call parameter), and the flashver, swfurl, and tcurl parameters that are associated with the stream pushing. The value of the call parameter is user_publish at the start of stream pushing, and user_publish_done at the end of stream pushing.
Parameter description
Parameter | Example | Description |
---|---|---|
app | live | The app name. |
name | asd | The stream name. |
flashver | MAC 10,2,153,2 | The version of the Flash player used to play SWF files. |
swfurl | The playback URL of the SWF file. This parameter does not have a default value. | |
tcurl | rtmp://test.uplive.ks-cdn.com/live/stream | The push stream URL. |
call | user_publish | The request type. Valid values: user_publish and user_publish_done. The value user_publish indicates that the request is sent at the start of stream pushing. The value user_publish_done indicates that the request is sent at the end of stream pushing. |
vdoid | 123 | Specifies whether the file is obtained by splicing several slices. |
When stream publishing over RTMP ends, the corresponding callback API is called.
Example
HTTP header
POST /callback HTTP/1.0
Host: Notification host provided by the user
Connection: close
Content-Length: 128
HTTP body
app=live&name=asdf&swfurl=nil&flashver=nil&tcurl=rtmp://test.uplive.ks-cdn.com/live&call=user_publish_done&close_mode=nil&vdoid=123456
Parameter description
Parameter | Example | Description |
---|---|---|
app | live | The app name. |
name | asd | The stream name. |
flashver | MAC 10,2,153,2 | The version of the Flash player used to play SWF files. |
swfurl | The playback URL of the SWF file. This parameter does not have a default value. | |
tcurl | rtmp://test.uplive.ks-cdn.com/live/stream | The push stream URL. |
call | user_publish | The request type. Valid values: user_publish and user_publish_done. The value user_publish indicates that the request is sent at the start of stream pushing. The value user_publish_done indicates that the request is sent at the end of stream pushing. |
close_mode | 1 | The mode in which stream pushing ends. Valid values: 1: normal completion; 2: abnormal interruption. |
vdoid | 123 | Used to identify streams with the same stream name that are pushed at different times. |
Error description
Error | Description |
---|---|
AuthencationFailed | Authentication failed. |
NonExistApplication | The app does not exist. |
ExistStreamName | A push stream with the same name already exists. |
Pure Mode