Documentation
Server_APIs_v2 Server APIs v2
Documentation
Demo APP
SDK Center
API Center
FAQ
Code Market
Console
Sign Up
Log In
中文站 English
  • Documentation
  • Server APIs v2
  • Streaming control
  • Start forwarding a stream to CDN

Start forwarding a stream to CDN

Last updated:2025-01-24 17:55

1 Description

Starts forwarding the specified stream from ZEGO's RTC server to the specified CDN URL. Perform this step before starting to publish the stream.

If you are publishing streams from RTC to CDN, or mixing and publishing streams to CDN, the ZEGO server will automatically handle CDN authentication for you. You do not need to perform additional CDN authentication.

2 Request method and endpoint

  • Request method: GET
  • Request endpoint: https://rtc-api.zego.im/?Action=CreatCDNTransferRule
  • Transmission protocol: HTTPS
  • Rate limit: 10 requests/second (Testing environment: 5 requests/second)

3 Request parameters

Listed below are the parameters specific to this request and part of the public request parameters. For the complete list of public request parameters, see Server APIs public request parameters.

Parameter Type Required Description
StreamId
String
Yes
Stream ID.
CDNUrl
String
Yes
The CDN URL (in RTMP format) to which the stream is to be forwarded.
Sequence
String
Yes
Request sequence number.
For the same stream StreamId, within continuous 10 seconds, it must be ensured that the request sequence number of this StreamId is strictly increasing; this avoids the situation where the server receives requests out of order which may lead to operation confusion.
If there is no concurrent scenario, it is recommended to use timestamps (at millisecond level).

4 Sample request

https://rtc-api.zego.im/?Action=CreatCDNTransferRule
&StreamId=rtc01
&CDNUrl=rtmp%3A%2F%2Fwsdemo.zego.im%2Flivestream%2Frtc01
&Sequence=1617249600001
&<Public Request Parameters>

5 Response parameters

Parameter Type Description
Code
Number
Return code.
Message
String
Description of the request execution result.
RequestId
String
Request ID.
Data
Object
Returned data.

6 Sample response

{
    "Code":0,
    "Message":"ok",
    "RequestId":"918334131114317411",
    "Data":null
}

7 Return codes

Listed below are the return codes related to this API. For the complete list of return codes, see Return codes.

Return Code Description Handling Suggestions
5000, 5001, 5002, 5006, 30003 Internal error. Please contact ZEGOCLOUD technical support for handling.
5003 Authentication failed. Please check if the signature Signature is correct.
5004 Invalid CDN address. Please check if the request parameter CDNUrl is correct.
5005 Invalid request. Please contact ZEGOCLOUD technical support for handling.
5007, 30002 API call frequency is too high. Please reduce the API request frequency.
30001 Invalid CDN address. Please check if the request parameter CDNUrl is correct.
30004 Incorrect parameter isTest. Please check if the common request parameter isTest is correct.
30005 Invalid AppId. Please check if the AppId is correct.
30009 Invalid StreamId, stream name is not standard. Please check if the StreamId conforms to the stream name coding standards.
Page Directory
  • Free trial
  • 提交工单
    咨询集成、功能及报价等问题
    电话咨询
    400 1006 604
    Get Consulting
    Scan Wechat QR code