Domain name for API request: trtc.intl.tencentcloudapi.com.
API description:.
Start a mixed stream forwarding task to mix multiple audio and video streams in a TRTC room into one media stream, transcode it, and push it to live stream CDN or back to the TRTC room. It also supports directly forwarding a single stream from the TRTC room without transcoding. After startup successful, it will return a task ID (TaskId) unique to the SdkAppid dimension. You need to save this TaskId, as it will be relied on to update and end the task subsequently. See document: Feature Description and Common Issues.
Note:.
You can enable bypass relay callback through console activation for monitoring events of CDN state. Refer to the documentation for callback: Bypass Relay Callback Description.
Initiating a mixed stream push task may incur the following fees:.
For MCU mix transcoding fees, refer to the documentation: On-Cloud MixTranscoding billing (https://www.tencentcloud.comom/document/product/647/49446?from_cn_redirect=1).
For forwarding expenses of non-Tencent Cloud CDN, refer to the documentation: Cloud-based forwarding billing explanation.
A maximum of 20 requests can be initiated per second for this API.
The following request parameter list only provides API request parameters and some common parameters. For the complete common parameter list, see Common Request Parameters.
| Parameter Name | Required | Type | Description |
|---|---|---|---|
| Action | Yes | String | Common Params. The value used for this API: StartPublishCdnStream. |
| Version | Yes | String | Common Params. The value used for this API: 2019-07-22. |
| Region | Yes | String | Common Params. For more information, please see the list of regions supported by the product. This API only supports: ap-guangzhou, ap-hongkong, ap-singapore. |
| SdkAppId | Yes | Integer | SdkAppId of TRTC, which is the same as the SdkAppId corresponding to the relayed room. |
| RoomId | Yes | String | Main room information RoomId, the RoomId corresponding to the TRTC room for relay. |
| RoomIdType | Yes | Integer | Main room information RoomType must be the same as the RoomId type of the relayed room. 0 indicates integer type room id, and 1 indicates string room number. |
| AgentParams | Yes | AgentParams | Relay service bot parameters for joining TRTC room. |
| WithTranscoding | Yes | Integer | Whether to transcode. 0 indicates no need to transcode, 1 indicates requirement to transcode. whether to charge transcoding fee is determined by the WithTranscoding parameter. WithTranscoding set to 0 means bypass forwarding and no transcoding costs will be incurred. WithTranscoding set to 1 means mixed-stream relay and transcoding costs will be charged. Note: transcoding is required for stream mixing, and this parameter must be set to 1. |
| AudioParams | No | McuAudioParams | Audio encoding parameters for stream retransmission. since audio must be transcoded (no transcoding costs will be incurred), this field is required when starting a task. |
| VideoParams | No | McuVideoParams | Video encoding parameters for the relay stream. leave blank for audio-only relay. |
| SingleSubscribeParams | No | SingleSubscribeParams | The user uplink parameters require single stream bypass forwarding. WithTranscoding needs to be set to 0 for single stream bypass forwarding. |
| PublishCdnParams.N | No | Array of McuPublishCdnParam | The CDN parameters for relay push support up to 10 push urls for a task. there must be one pushback room parameter. |
| SeiParams | No | McuSeiParams | Stream mixing SEI parameter. |
| FeedBackRoomParams.N | No | Array of McuFeedBackRoomParams | Push back room information. a task supports up to 10 push rooms, and there must be one forward CDN parameter. note: use SDK version 10.4 or higher to push room. if you need assistance, contact tencent cloud technical support. |
| RecordParams | No | McuRecordParams | Relay recording parameters. refer to the reference document (https://www.tencentcloud.comom/document/product/647/111748?from_cn_redirect=1). |
| Parameter Name | Type | Description |
|---|---|---|
| TaskId | String | Used to uniquely identify the forwarding task, generated by the tencent cloud server. you need to carry the TaskID parameter for follow-up updates and to stop the request. |
| RequestId | String | The unique request ID, generated by the server, will be returned for every request (if the request fails to reach the server for other reasons, the request will not obtain a RequestId). RequestId is required for locating a problem. |
None
POST / HTTP/1.1
Host: trtc.intl.tencentcloudapi.com
Content-Type: application/json
X-TC-Action: StartPublishCdnStream
<Common request parameters>
{
"AgentParams": {
"MaxIdleTime": 30,
"UserSig": "eJw1zV8LgjAUBfCvInsO2dStGfQSQUb2pFJvsnLJJZW1LekPffdc6X08v8O5b5Snmd9LjRYeCnyMZt4vgUp2Fi7wB6vtuVRC207q0kpjSzIVTXUVSkE11EiEMeE8ZGw0*VCg5SCcDeRuBAutiwkLeRRwOo*nMajduy5O*gIaus9qel9vX*lJbHJmyDMxuKFFI27tsT*I1S6pl*jzBb*IOTE_",
"UserId": "trtc_partner_test_1"
},
"AudioParams": {
"AudioEncode": {
"SampleRate": 48000,
"Codec": 0,
"BitRate": 64,
"Channel": 2
}
},
"VideoParams": {
"VideoEncode": {
"Height": 720,
"Width": 1280,
"Fps": 15,
"BitRate": 1536,
"Gop": 2
},
"LayoutParams": {
"PureAudioHoldPlaceMode": 0,
"MixLayoutMode": 4,
"MixLayoutList": [
{
"LocationX": 0,
"LocationY": 0,
"UserMediaStream": {
"StreamType": 0,
"UserInfo": {
"RoomIdType": 0,
"RoomId": "295066",
"UserId": "Trtc_User_0"
}
},
"ZOrder": 0,
"ImageHeight": 720,
"ImageWidth": 640,
"RenderMode": 0
},
{
"LocationX": 640,
"LocationY": 0,
"UserMediaStream": {
"StreamType": 0,
"UserInfo": {
"RoomIdType": 0,
"RoomId": "295066",
"UserId": "Trtc_User_1"
}
},
"ZOrder": 0,
"ImageHeight": 720,
"ImageWidth": 640,
"RenderMode": 0
}
]
},
"BackGroundColor": "0xFF0000",
"WaterMarkList": [
{
"WaterMarkType": 0,
"WaterMarkImage": {
"LocationX": 64,
"LocationY": 64,
"WaterMarkHeight": 64,
"WaterMarkWidth": 64,
"WaterMarkUrl": "https://xkt-course-1304449343.cos.ap-beijing.myqcloud.com/test/mark/37f9eb62-ca72-430e-bfca-e700b59b20e0.png",
"ZOrder": 3
}
}
]
},
"PublishCdnParams": [
{
"PublishCdnUrl": "rtmp://3891.livepush.myqcloud.com/live/trtc_publishcdn_test1",
"IsTencentCdn": 1
}
],
"RoomIdType": 0,
"SdkAppId": 1400188366,
"WithTranscoding": 1,
"RoomId": "295066"
}
{
"Response": {
"TaskId": "-m97l2ZU7vxyBSmXYsRx1Xy9Kf4bVVfbbhSKC4K-4pycoZWKv542xbi139uTvGt1zAHoAQ..",
"RequestId": "b934c535-8d82-4f52-bd52-a1cbb043c4be"
}
}
None
POST / HTTP/1.1
Host: trtc.intl.tencentcloudapi.com
Content-Type: application/json
X-TC-Action: StartPublishCdnStream
<Common request parameters>
{
"AgentParams": {
"MaxIdleTime": 30,
"UserSig": "eJw1zV8LgjAUBfCvInsO2dStGfQSQUb2pFJvsnLJJZW1LekPffdc6X08v8O5b5Snmd9LjRYeCnyMZt4vgUp2Fi7wB6vtuVRC207q0kpjSzIVTXUVSkE11EiEMeE8ZGw0*VCg5SCcDeRuBAutiwkLeRRwOo*nMajduy5O*gIaus9qel9vX*lJbHJmyDMxuKFFI27tsT*I1S6pl*jzBb*IOTE_",
"UserId": "trtc_partner_test_1"
},
"AudioParams": {
"AudioEncode": {
"SampleRate": 48000,
"Codec": 0,
"BitRate": 64,
"Channel": 2
},
"SubscribeAudioList": [
{
"UserInfo": {
"RoomIdType": 0,
"RoomId": "295066",
"UserId": "Trtc_User_0"
}
},
{
"UserInfo": {
"RoomIdType": 0,
"RoomId": "295066",
"UserId": "Trtc_User_1"
}
}
]
},
"PublishCdnParams": [
{
"PublishCdnUrl": "rtmp://3891.livepush.myqcloud.com/live/trtc_publishcdn_test1",
"IsTencentCdn": 1
}
],
"RoomIdType": 0,
"SdkAppId": 1400188366,
"WithTranscoding": 1,
"RoomId": "295066"
}
{
"Response": {
"RequestId": "388014ec-a0b8-4b8f-86bc-1f467448f5f0",
"TaskId": "-m9lnV5U7nj4rkLBWMXF9n8-EohONCXbalWuLYK-4pycoZWQndibcqSVnrlqKF5om7EIDVk4awE."
}
}
None
POST / HTTP/1.1
Host: trtc.intl.tencentcloudapi.com
Content-Type: application/json
X-TC-Action: StartPublishCdnStream
<Common request parameters>
{
"AgentParams": {
"MaxIdleTime": 30,
"UserSig": "eJw1zV8LgjAUBfCvInsO2dStGfQSQUb2pFJvsnLJJZW1LekPffdc6X08v8O5b5Snmd9LjRYeCnyMZt4vgUp2Fi7wB6vtuVRC207q0kpjSzIVTXUVSkE11EiEMeE8ZGw0*VCg5SCcDeRuBAutiwkLeRRwOo*nMajduy5O*gIaus9qel9vX*lJbHJmyDMxuKFFI27tsT*I1S6pl*jzBb*IOTE_",
"UserId": "trtc_partner_test_1"
},
"AudioParams": {
"AudioEncode": {
"SampleRate": 48000,
"Codec": 0,
"BitRate": 64,
"Channel": 2
}
},
"VideoParams": {
"VideoEncode": {
"Height": 720,
"Width": 1280,
"Fps": 15,
"BitRate": 1536,
"Gop": 2
}
},
"SingleSubscribeParams": {
"UserMediaStream": {
"StreamType": 0,
"UserInfo": {
"RoomIdType": 0,
"RoomId": "295066",
"UserId": "Trtc_User_0"
}
}
},
"PublishCdnParams": [
{
"PublishCdnUrl": "rtmp://3891.livepush.myqcloud.com/live/trtc_publishcdn_test1",
"IsTencentCdn": 1
}
],
"RoomIdType": 0,
"SdkAppId": 1400188366,
"WithTranscoding": 0,
"RoomId": "295066"
}
{
"Response": {
"TaskId": "-m97l2ZU7tq6nEsHR89259B8aCDblqnbGhWKC4K-4pycoZWpyHnld1jC9aCD+EU7V8WRAQ..",
"RequestId": "f23d95bf-ddaf-4d0c-86c0-6bf50c74c0a0"
}
}
None
POST / HTTP/1.1
Host: trtc.intl.tencentcloudapi.com
Content-Type: application/json
X-TC-Action: StartPublishCdnStream
<Common request parameters>
{
"AgentParams": {
"MaxIdleTime": 30,
"UserSig": "eJw1zV8LgjAUBfCvInsO2dStGfQSQUb2pFJvsnLJJZW1LekPffdc6X08v8O5b5Snmd9LjRYeCnyMZt4vgUp2Fi7wB6vtuVRC207q0kpjSzIVTXUVSkE11EiEMeE8ZGw0*VCg5SCcDeRuBAutiwkLeRRwOo*nMajduy5O*gIaus9qel9vX*lJbHJmyDMxuKFFI27tsT*I1S6pl*jzBb*IOTE_",
"UserId": "trtc_partner_test_1"
},
"AudioParams": {
"AudioEncode": {
"SampleRate": 48000,
"Codec": 0,
"BitRate": 64,
"Channel": 2
}
},
"SingleSubscribeParams": {
"UserMediaStream": {
"StreamType": 0,
"UserInfo": {
"RoomIdType": 0,
"RoomId": "295066",
"UserId": "Trtc_User_0"
}
}
},
"PublishCdnParams": [
{
"PublishCdnUrl": "rtmp://3891.livepush.myqcloud.com/live/trtc_publishcdn_test1",
"IsTencentCdn": 1
}
],
"RoomIdType": 0,
"SdkAppId": 1400188366,
"WithTranscoding": 0,
"RoomId": "295066"
}
{
"Response": {
"TaskId": "-m97l2ZU7r57nZBesMa84KgzxhH0OBbbCRaKC4K-4pycoZW7yFPtusNuZOen1Ca0qtQQAQ..",
"RequestId": "ef089f8b-d0d1-4131-894d-4edd68d61605"
}
}
POST / HTTP/1.1
Host: trtc.intl.tencentcloudapi.com
Content-Type: application/json
X-TC-Action: StartPublishCdnStream
<Common request parameters>
{
"AgentParams": {
"MaxIdleTime": 30,
"UserSig": "eJw1zV8LgjAUBfCvInsO2dStGfQSQUb2pFJvsnLJJZW1LekPffdc6X08v8O5b5Snmd9LjRYeCnyMZt4vgUp2Fi7wB6vtuVRC207q0kpjSzIVTXUVSkE11EiEMeE8ZGw0*VCg5SCcDeRuBAutiwkLeRRwOo*nMajduy5O*gIaus9qel9vX*lJbHJmyDMxuKFFI27tsT*I1S6pl*jzBb*IOTE_",
"UserId": "trtc_partner_test_1"
},
"AudioParams": {
"AudioEncode": {
"SampleRate": 48000,
"Codec": 0,
"BitRate": 64,
"Channel": 2
}
},
"VideoParams": {
"VideoEncode": {
"Height": 720,
"Width": 1280,
"Fps": 15,
"BitRate": 1536,
"Gop": 2
},
"LayoutParams": {
"PureAudioHoldPlaceMode": 0,
"MixLayoutMode": 4,
"MixLayoutList": [
{
"LocationX": 0,
"LocationY": 0,
"UserMediaStream": {
"StreamType": 0,
"UserInfo": {
"RoomIdType": 0,
"RoomId": "295066",
"UserId": "Trtc_User_0"
}
},
"ZOrder": 0,
"ImageHeight": 720,
"ImageWidth": 640,
"RenderMode": 0
},
{
"LocationX": 640,
"LocationY": 0,
"UserMediaStream": {
"StreamType": 0,
"UserInfo": {
"RoomIdType": 0,
"RoomId": "295066",
"UserId": "Trtc_User_1"
}
},
"ZOrder": 0,
"ImageHeight": 720,
"ImageWidth": 640,
"RenderMode": 0
}
]
},
"BackGroundColor": "0xFF0000",
"WaterMarkList": [
{
"WaterMarkType": 0,
"WaterMarkImage": {
"LocationX": 64,
"LocationY": 64,
"WaterMarkHeight": 64,
"WaterMarkWidth": 64,
"WaterMarkUrl": "https://xkt-course-1304449343.cos.ap-beijing.myqcloud.com/test/mark/37f9eb62-ca72-430e-bfca-e700b59b20e0.png",
"ZOrder": 3
}
}
]
},
"FeedBackRoomParams": [
{
"RoomId": "630777",
"RoomIdType": 0,
"UserId": "trtc_partner_test_2",
"UserSig": "eJwtjEELgjAYhv-Ldy10m7mtQYcQOtklU6mLSFs1LVnzq4Tovwfa8Xmel-cD*zQLXsaDAhYQmI9stenQnu2o0eOpcrXHzvgKTY8V*8963dbOWQ2KLgihUkacTwXt3YCigpIlo0KyyZrBWW9ARZyQ-4O9gIJrYfK365M85PEw02HZPneNaJJbg4-1Nj6KQqZZacVhI1fw-QEkCzYe"
}
],
"RoomIdType": 0,
"SdkAppId": 1400188366,
"WithTranscoding": 1,
"RoomId": "295066"
}
{
"Response": {
"RequestId": "921e9cf6-b77c-4a7a-ab0e-c66a3e66fc59",
"TaskId": "-m9lnV5U7n7TwoLKSsii1JivUn7DLDDbP16uLYK-4pycoZWQndib8GQJZEMMXFyOHe9Ds6WfxAE."
}
}
None
POST / HTTP/1.1
Host: trtc.intl.tencentcloudapi.com
Content-Type: application/json
X-TC-Action: StartPublishCdnStream
<Common request parameters>
{
"AgentParams": {
"MaxIdleTime": 30,
"UserSig": "eJw1zV8LgjAUBfCvInsO2dStGfQSQUb2pFJvsnLJJZW1LekPffdc6X08v8O5b5Snmd9LjRYeCnyMZt4vgUp2Fi7wB6vtuVRC207q0kpjSzIVTXUVSkE11EiEMeE8ZGw0*VCg5SCcDeRuBAutiwkLeRRwOo*nMajduy5O*gIaus9qel9vX*lJbHJmyDMxuKFFI27tsT*I1S6pl*jzBb*IOTE_",
"UserId": "trtc_partner_test_1"
},
"AudioParams": {
"AudioEncode": {
"SampleRate": 48000,
"Codec": 0,
"BitRate": 64,
"Channel": 2
}
},
"VideoParams": {
"VideoEncode": {
"Height": 720,
"Width": 1280,
"Fps": 15,
"BitRate": 1536,
"Gop": 2
},
"LayoutParams": {
"PureAudioHoldPlaceMode": 0,
"MixLayoutMode": 4,
"MixLayoutList": [
{
"LocationX": 0,
"LocationY": 0,
"UserMediaStream": {
"StreamType": 0,
"UserInfo": {
"RoomIdType": 0,
"RoomId": "295066",
"UserId": "Trtc_User_0"
}
},
"ZOrder": 0,
"ImageHeight": 720,
"ImageWidth": 640,
"RenderMode": 0
},
{
"LocationX": 640,
"LocationY": 0,
"UserMediaStream": {
"StreamType": 0,
"UserInfo": {
"RoomIdType": 0,
"RoomId": "295066",
"UserId": "Trtc_User_1"
}
},
"ZOrder": 0,
"ImageHeight": 720,
"ImageWidth": 640,
"RenderMode": 0
}
]
},
"BackGroundColor": "0xFF0000",
"WaterMarkList": [
{
"WaterMarkType": 0,
"WaterMarkImage": {
"LocationX": 64,
"LocationY": 64,
"WaterMarkHeight": 64,
"WaterMarkWidth": 64,
"WaterMarkUrl": "https://xkt-course-1304449343.cos.ap-beijing.myqcloud.com/test/mark/37f9eb62-ca72-430e-bfca-e700b59b20e0.png",
"ZOrder": 3
}
}
]
},
"SeiParams": {
"LayoutVolume": {
"AppData": "layout_sei_test",
"PayloadType": 100,
"Interval": 1000,
"FollowIdr": 1
}
},
"PublishCdnParams": [
{
"PublishCdnUrl": "rtmp://3891.livepush.myqcloud.com/live/trtc_publishcdn_test1",
"IsTencentCdn": 1
}
],
"RoomIdType": 0,
"SdkAppId": 1400188366,
"WithTranscoding": 1,
"RoomId": "295066"
}
{
"Response": {
"RequestId": "6dfc18cc-2123-4a11-9591-f1e873fbbd65",
"TaskId": "-m9lnV5U7nzo2Xwh48Dc-YCDrR5Bk8DbJ1WrLYK-4pycoZWQndibrNig9cq-7ljX4SenbKWlZAE."
}
}
POST / HTTP/1.1
Host: trtc.intl.tencentcloudapi.com
Content-Type: application/json
X-TC-Action: StartPublishCdnStream
<Common request parameters>
{
"AgentParams": {
"MaxIdleTime": 30,
"UserSig": "eJw1zV8LgjAUBfCvInsO2dStGfQSQUb2pFJvsnLJJZW1LekPffdc6X08v8O5b5Snmd9LjRYeCnyMZt4vgUp2Fi7wB6vtuVRC207q0kpjSzIVTXUVSkE11EiEMeE8ZGw0*VCg5SCcDeRuBAutiwkLeRRwOo*nMajduy5O*gIaus9qel9vX*lJbHJmyDMxuKFFI27tsT*I1S6pl*jzBb*IOTE_",
"UserId": "trtc_partner_test_1"
},
"AudioParams": {
"AudioEncode": {
"SampleRate": 48000,
"Codec": 0,
"BitRate": 64,
"Channel": 2
},
"SubscribeAudioList": [
{
"UserInfo": {
"RoomIdType": 0,
"RoomId": "295066",
"UserId": "Trtc_User_0"
}
},
{
"UserInfo": {
"RoomIdType": 0,
"RoomId": "295067",
"UserId": "Trtc_User_1"
}
}
]
},
"VideoParams": {
"VideoEncode": {
"Height": 720,
"Width": 1280,
"Fps": 15,
"BitRate": 1536,
"Gop": 2
},
"LayoutParams": {
"PureAudioHoldPlaceMode": 0,
"MixLayoutMode": 4,
"MixLayoutList": [
{
"LocationX": 0,
"LocationY": 0,
"UserMediaStream": {
"StreamType": 0,
"UserInfo": {
"RoomIdType": 0,
"RoomId": "295066",
"UserId": "Trtc_User_0"
}
},
"ZOrder": 0,
"ImageHeight": 720,
"ImageWidth": 640,
"RenderMode": 0
},
{
"LocationX": 640,
"LocationY": 0,
"UserMediaStream": {
"StreamType": 0,
"UserInfo": {
"RoomIdType": 0,
"RoomId": "295067",
"UserId": "Trtc_User_1"
}
},
"ZOrder": 0,
"ImageHeight": 720,
"ImageWidth": 640,
"RenderMode": 0
}
]
},
"BackGroundColor": "0xFF0000",
"WaterMarkList": [
{
"WaterMarkType": 0,
"WaterMarkImage": {
"LocationX": 64,
"LocationY": 64,
"WaterMarkHeight": 64,
"WaterMarkWidth": 64,
"WaterMarkUrl": "https://xkt-course-1304449343.cos.ap-beijing.myqcloud.com/test/mark/37f9eb62-ca72-430e-bfca-e700b59b20e0.png",
"ZOrder": 3
}
}
]
},
"PublishCdnParams": [
{
"PublishCdnUrl": "rtmp://3891.livepush.myqcloud.com/live/trtc_publishcdn_test1",
"IsTencentCdn": 1
}
],
"RoomIdType": 0,
"SdkAppId": 1400188366,
"WithTranscoding": 1,
"RoomId": "295066"
}
{
"Response": {
"TaskId": "-m97l2ZU7vxyBSmXYsRx1Xy9Kf4bVVfbbhSKC4K-4pycoZWKv542xbi139uTvGt1zAHoAQ..",
"RequestId": "b934c535-8d82-4f52-bd52-a1cbb043c4be"
}
}
TencentCloud API 3.0 integrates SDKs that support various programming languages to make it easier for you to call APIs.
The following only lists the error codes related to the API business logic. For other error codes, see Common Error Codes.
| Error Code | Description |
|---|---|
| AuthFailure | CAM signature/authentication error. |
| AuthFailure.UnRealNameAuthenticated | Identity verification has not been completed, so this operation is not allowed. |
| AuthFailure.UnauthorizedOperation | CAM authentication failed. |
| AuthFailure.UnsupportedOperation | Unsupported operation. |
| FailedOperation | Operation failed. |
| FailedOperation.RestrictedConcurrency | Maximum number of concurrent on-cloud recording tasks reached. Contact us to raise the limit. |
| InternalError | Internal error. |
| InvalidParameter | Parameter error. |
| InvalidParameter.SdkAppId | SdkAppId is incorrect. |
| MissingParameter | Missing parameter. |
| ResourceNotFound | The resource does not exist. |
| UnsupportedOperation | Unsupported operation. |
フィードバック