StreamLink API Reference โ
The StreamLink API service code is mdc, and the API version is 2020-08-28. The following example describes a basic configuration that delivers an RTMP input in the Seoul region to StreamLive.
Call Specifications โ
| Item | Value |
|---|---|
| Endpoint | POST https://mdc.tencentcloudapi.com |
| Action | See the API list below |
| Request signature | Use the official SDK / the Tencent Cloud API 3.0 signature of TCCLI |
Basic Information โ
| Item | Value |
|---|---|
| API service code | mdc |
| API version | 2020-08-28 |
| Authentication | Tencent Cloud API 3.0 / TC3-HMAC-SHA256 |
| Call tool | Tencent Cloud SDK / TCCLI |
Checks Before Execution โ
- Configure TCCLI authentication securely and confirm that you have permissions to create / query / start / stop the resource.
- Replace values starting with
REPLACE_with actual resource values. 203.0.113.10/32is an IP for documentation purposes. Replace it with the public IP of the actual source device.- Create commands generate a new resource. Query the existing creation result before running the same command again.
API List and Request Parameters โ
| Action | Operation |
|---|---|
CreateStreamLinkFlow | Create |
CreateStreamLinkInput | Create |
DescribeStreamLinkFlow | Query |
CreateStreamLinkOutputInfo | Create |
StartStreamLinkFlow | Start |
StopStreamLinkFlow | Stop |
Responses and Execution Flow โ
Keep the resource ID returned in the create response and check its status with the query API. Distinguish between the success of a create request and the success of actual input reception and output delivery. Run the next step after checking the status of the resource.
Errors and Call Limits โ
Connection Check โ
| Symptom | What to check |
|---|---|
InvalidParameter.MaxBandwidth | bps unit and allowed values |
| Flow ID parsing result check | Difference between the raw HTTP and the CLI response wrapper, Info.FlowId location |
| Unknown result after a create request | List and detail queries before repeating the same create request |
| Input connection result check | Allowed IP, input address, AppName / Stream Key |
| Input is normal but output โ | Output type / destination, receiving side status, output connection logs |
When submitting a request inquiry, provide the Action, region, response code, RequestId, and time of occurrence. Store authentication values separately.
Request Examples โ
1. Flow Creation โ
tccli mdc CreateStreamLinkFlow --region ap-seoul \
--FlowName demo_flow \
--MaxBandwidth 20000000MaxBandwidth is a required value in bps. The allowed values in the official API are 10,000,000 / 20,000,000 / 50,000,000. To connect to an Event, specify the corresponding Event ID with EventId.
The identifier path in the official raw HTTP response is Response.Info.FlowId. The following is a response provided to explain the structure.
{
"Response": {
"Info": {
"FlowId": "REPLACE_FLOW_ID",
"FlowName": "demo_flow",
"MaxBandwidth": 20000000,
"State": "IDLE",
"InputGroup": ,
"OutputGroup":
},
"RequestId": "REPLACE_REQUEST_ID"
}
}TCCLI output may exclude the Response wrapper, so check the actual output structure.
2. Adding an Input โ
tccli mdc CreateStreamLinkInput --region ap-seoul \
--FlowId REPLACE_FLOW_ID \
--InputGroup '[{"InputName":"demo_input","Protocol":"RTMP","AllowIpList":["203.0.113.10/32"]}]'RTMP of API is the input type. Check the connection direction against RTMP_PUSH in the console and register the source IP in the allowlist.
After creation, check the input address and RTMP settings in the detail query.
tccli mdc DescribeStreamLinkFlow --region ap-seoul --FlowId REPLACE_FLOW_IDThe RTMP push URL uses the IP / port / AppName / StreamKey from the input response. If the program accepts the server URL and the Stream Key separately, enter them separately.
3. Adding an Output Sent to StreamLive โ
Save the following JSON as link-output.json. Replace the Flow ID, destination URL, and Stream Key with the actual StreamLive input information.
{
"FlowId": "REPLACE_FLOW_ID",
"Output": {
"OutputName": "demo_to_live",
"Protocol": "RTMP",
"OutputRegion": "ap-seoul",
"RTMPSettings": {
"Destinations": [
{
"Url": "rtmp://REPLACE_INPUT_HOST/REPLACE_APP_NAME",
"StreamKey": "REPLACE_STREAM_KEY"
}
]
}
}
}tccli mdc CreateStreamLinkOutputInfo --region ap-seoul --cli-input-json file://link-output.jsonThis API creates an output for the Flow specified by FlowId. After creation, check in the detail query whether the destination is present in OutputGroup.
4. Start and Verification โ
tccli mdc StartStreamLinkFlow --region ap-seoul --FlowId REPLACE_FLOW_IDCheck the Flow running status, input bitrate, output bitrate, and StreamLive input reception in order. A successful response from the control API is different from successful media delivery.
5. Termination โ
When the test is finished, check the target Flow and stop it.
tccli mdc StopStreamLinkFlow --region ap-seoul --FlowId REPLACE_FLOW_IDCharges may apply for running input / output nodes and for delivery.