AddStream
https://rtc-api.zego.im/
Use this interface to add a stream to a specified Room. This is commonly used in "watch together" scenarios, such as adding a CDN live stream to a specified Room, allowing users in the Room to obtain the stream ID and enabling server-side control over the live content in the specified Room.
- When adding a stream to a specified Room, ensure that the Room exists. This interface cannot create a Room. If you want to automatically create the corresponding Room when adding a stream, please contact ZEGOCLOUD technical support to enable the related feature.
- This interface is generally used together with Delete Room Stream, for example, when the business needs to stop broadcasting a stream to a Room.
This interface is only used to trigger notifications related to stream addition in the Room and does not perform actual stream publishing operations. Developers need to call the startPublishingStream interface from their client (or other stream publishing methods) to publish the stream, so that the added stream can be played by the startPlayingStream interface.
Clients receive notifications of stream addition in the Room using ZEGO Express SDK callback interfaces:
| ZegoExpress SDK | LiveRoom SDK | |
|---|---|---|
| iOS/macOS | onRoomStreamUpdate | onStreamUpdated |
| Android | onRoomStreamUpdate | onStreamUpdated |
| Windows | onRoomStreamUpdate | OnStreamUpdated |
| Web | roomStreamUpdate | onStreamUpdated |
- It is not recommended to use the same UserId as actual users in the Room to avoid conflicts with the client SDK's stream addition behavior. You can use a specific name to identify server-side behavior, for example: userId = "Server-Administrator".
- If you use the same UserId as actual users in the Room (not recommended), please note the following:
- The client with the corresponding operator's UserId will not receive the stream addition callback triggered by this server-side interface.
- If the actual user's UserId in the Room has not published the stream, the stream deletion logic for the corresponding StreamId will be triggered.
- If the actual user's UserId in the Room leaves the Room, the stream deletion logic for the corresponding StreamId will be triggered.
Request
Query Parameters
-
When set to not allowed for moderation, the moderation service provider will not pull this stream for moderation.
-
When using stream injection to implement cross-room PK business scenarios, it is recommended to set this field to "not allowed" to avoid the same stream being repeatedly moderated in multiple Rooms.
Possible values: [AddStream]
Interface prototype parameters
https://rtc-api.zego.im?Action=AddStream
💡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.
Room ID.
User ID.
Username.
Possible values: <= 256 characters
Stream ID, not exceeding 256 bytes.
Possible values: <= 127 characters
Stream title, not exceeding 127 bytes. When used, URL encoding (UrlEncode) must be performed on its content.
Possible values: <= 1024 characters
Stream additional information, not exceeding 1024 bytes.
Possible values: [0, 1]
Default value: 0
Moderation flag. Whether the current stream is allowed for moderation when moderating the Room stream list: 0 means allowed, 1 means not allowed.
📌 Important Note
Responses
- 200
- application/json
