RTMPDispatchV2
https://rtc-api.zego.im/
Call this API to initiate RTMP stream dispatching, supporting both "pull" and "push" dispatch modes.
When you need to perform RTMP stream publishing or playing from ZEGOCLOUD's video cloud service through the RTMP protocol, you can use this API to obtain the RTMP publishing or playing nodes. After the developer passes the Stream ID (StreamId), dispatch mode (Type), client IP (ClientIP), and sequence number (Sequence) from the client, the ZEGOCLOUD media server (RTC service) returns a dispatch result set for the client to publish or play streams.
For example, when performing RTMP stream publishing through third-party publishing tools such as OBS, you need to perform publishing dispatch; when you need a third-party player to pull RTMP streams for playback, you need to perform playing dispatch.
For first-time use of this API, please contact ZEGOCLOUD Technical Support for configuration.
Legacy API Usage Instructions
The difference between RTMPDispatchV2 (recommended) and RTMPDispatch is, when accessing the ZEGOCLOUD server:
- Using
RTMPDispatchV2, the ZEGOCLOUD server returns Data in URL format. - Using
RTMPDispatch, the ZEGOCLOUD server returns Data in IP format.
Request URL: https://rtc-api.zego.im/?Action=RTMPDispatch
Response example:
{
"Code":0,
"Message":"ok",
"RequestId":"5094436160208407316",
"Data":[
"81.69.49.115:1935"
]
}In the test environment (see the IsTest common parameter description for details), the Stream ID must be prefixed with "zegotest-AppId-". For example, if the Stream ID is "test" and the AppId is "123456789" in the test environment, the Stream ID should be "zegotest-123456789-test".
Request
Query Parameters
- The Stream ID is defined by you.
- When publishing streams, it must be globally unique within the entire AppID. If different users publish streams with the same stream name within the same AppID, the later publishing user will fail to publish.
- Only supports numbers, English characters, '-', and '_'.
- pull: Get the RTMP playing node
- push: Get the RTMP publishing node
Possible values: [RTMPDispatchV2]
API prototype parameters
https://rtc-api.zego.im?Action=RTMPDispatchV2
💡Public parameter. Application ID, assigned by ZEGOCLOUD. Get it from the ZEGOCLOUD Admin Console.
💡Common parameter. A 16-character hexadecimal random string (hex-encoded 8-byte random number). For the generation algorithm, refer to the signature example.
💡Common parameter. Current Unix timestamp in seconds. For the generation algorithm, refer to the signature example. A maximum deviation of 10 minutes is allowed.
💡Common parameter. Signature used to verify the legitimacy of the request. Please refer to the signature mechanism to generate it.
Possible values: [2.0]
Default value: 2.0
💡Public parameter. Signature version number.
Stream ID, a string with a maximum length of 256 characters.
Request sequence number; only used for request reconciliation. Using a timestamp (millisecond level) is recommended.
Dispatch mode:
Optional. If provided, pass the client IP address, for example: 119.23.242.129.
Note
IPv6 format IP addresses are not currently supported.
Responses
- 200
- application/json
