Calling this interface can initiate RTMP streaming scheduling, supporting both "pull" and "publish" scheduling modes.
When you need to manually publish or pull RTMP streaming from ZEGOCLOUD's audio and video cloud, you can use this interface to obtain the RTMP streaming publish or pull nodes. After developers pass the stream ID (StreamId), scheduling mode (Type), client IP (ClientIP), and sequence number (Sequence) to the server, ZEGOCLOUD media server (RTC service) returns the scheduling result set for clients to publish or pull streams.
For example, when using third-party streaming tools like OBS to publish RTMP streams, scheduling for streaming is required. Similarly, when using a third-party player to pull and play RTMP streams, scheduling for pulling streams is necessary.
When using this interface for the first time, you need to contact ZEGOCLOUD technical support for configuration.
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.
In the testing environment (For details, see
the description of the isTest
parameter in Accessing server APIs - Public request parameters), the stream IDs need to be prefixed with zegotest-AppId-
. For example, if the unique part of the stream ID is test
and the AppID is 123456789
, then the full stream ID should be zegotest-123456789-test
.
Parameter | Type | Is it required | Description |
---|---|---|---|
StreamId |
String |
Yes |
Stream ID,a string of up to 256 characters in length.
|
Sequence |
Int64 |
Yes |
Request sequence number; only used for account reconciliation requests. It is recommended to use a timestamp (in milliseconds) for this purpose. |
Type |
String |
Yes |
Scheduling mode.
|
ClientIP |
String |
No |
Optional: If available, please provide the client IP address, for example, 119.23.242.129.
Currently, IPv6 format IP addresses are not supported. |
https://rtc-api.zego.im/?Action=RTMPDispatchV2
&StreamId=rtc01
&Sequence=1617249600001
&Type=pull
&ClientIP=47.102.152.118
&<Public request parameters>
Parameters | Type | Description |
---|---|---|
Code |
Number |
Return code. |
Message |
String |
Operation result description. |
RequestId |
String |
Request ID. |
Data |
Object |
Response data. |
{
"Code":0,
"Message":"ok",
"RequestId":"5094436160208407316",
"Data":[
"rtmp://81.69.49.115:1935/1540531164/caodantest"
]
}
Listed below are the return codes related to this API. For the complete list of return codes, see Return codes.
Return code | Explanation | Handling Suggestions |
---|---|---|
1010、30002 | The frequency of interface calls is too high. | Please reduce the frequency of API requests. |
1001 | Dispatch failed. | Please contact ZEGOCLOUD technical support for assistance. |
1002 | Publishing node is empty. | Please contact ZEGOCLOUD technical support for assistance. |
1003 | Pulling node is empty. | Please contact ZEGOCLOUD technical support for assistance. |
1005 | App is not online. | Please contact ZEGOCLOUD technical support for assistance. |
1006 | Invalid parameter. | Please contact ZEGOCLOUD technical support for assistance. |
30003 | Internal error. | Please contact ZEGOCLOUD technical support for assistance. |
30004 | Error in 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,the stream name is not standardized. | Please check if the StreamId meets the naming encoding specifications. |
30010 | Invalid dispatch action. | Please check if the Type is correct. |
30011 | Invalid client IP address. | Please check if the ClientIP is correct. |
The difference between RTMPDispatchV2 (recommended) and RTMPDispatch is that when accessing the ZEGOCLOUD server:
RTMPDispatchV2
is being used, and the data returned by the ZEGOCLOUD server is in the form of a URL.RTMPDispatch
is being used, and the data returned by the ZEGOCLOUD server is in the form of IP Port.Request address:https://rtc-api.zego.im/?Action=RTMPDispatch
Response example:
{
"Code":0,
"Message":"ok",
"RequestId":"5094436160208407316",
"Data":[
"81.69.49.115:1935"
]
}