Scenario-based Audio and Video Configuration
Overview
To facilitate quick integration and lower the barrier to entry for developers, the SDK has validated through extensive online data and developed various scenario-based configuration solutions. Developers can choose the corresponding Room scenario based on their needs, and the SDK will automatically apply audio/video codecs, parameters, flow control strategies, and other configurations suitable for that scenario, thereby quickly achieving optimal results for that scenario. Currently supported scenarios include show live streaming, KTV, standard 1v1 Video Call, high-quality 1v1 Video Call, standard voice chat room, and high-quality voice chat room.
How to Use
Create and initialize an instance of ZegoExpressEngine. In the ZegoOptions parameter, the scenario field needs to specify a scenario (ZegoScenario), which you can choose based on your actual Video Call business scenario.
const zg = new ZegoExpressEngine(appid, server, { scenario: 4 })- It is recommended that users in the same Room use the same Room scenario to achieve the best results.
- If you need to have multiple Video Call business scenarios, for example, both 1v1 Video Call and show live streaming scenarios. You can switch scenarios by calling the setRoomScenario interface after leaving the Room, without creating a new engine instance, and then log in to other Rooms.
Currently the SDK supports the following scenarios:
| Scenario (supported version: 2.21.0 and above) | Scenario value | Scenario description | Key configuration description |
|---|---|---|---|
| Default | 3 | Default (general) scenario. If none of the above scenario enumerations match the developer's actual application scenario, you can use this default scenario. |
|
| StandardVideoCall | 4 | Standard Video Call scenario, suitable for 1v1 video or voice call scenarios. |
|
| HighQualityVideoCall | 5 | High-quality Video Call scenario, similar to StandardVideoCall (4), but this scenario uses higher video configurations by default than StandardVideoCall (4), suitable for video call scenarios with higher quality requirements. |
|
| StandardChatroom | 6 | Standard voice chat room scenario, suitable for multi-person pure voice calls, saving traffic. Warning In this scenario, the camera is not enabled by default. It is recommended to select the high-quality voice chat room scenario configuration for voice chat rooms with music. | - |
| HighQualityChatroom | 7 | High-quality voice chat room scenario, similar to StandardChatroom (6), but this scenario uses higher audio configurations by default than StandardChatroom (6), suitable for multi-person pure voice call scenarios with higher audio quality requirements. Warning
| - |
| Broadcast | 8 | Live streaming scenario, suitable for one-to-many live streaming scenarios such as show, gaming, e-commerce, education large classes, etc., with optimizations for audio/video quality, smoothness, and compatibility. Warning In the live streaming scenario, there is no business "role" distinction in the SDK (such as host, audience). All users in the Room can publish and play streams. |
|
| Karaoke | 9 | Karaoke (KTV) scenario, suitable for real-time chorus and online K-song scenarios, ensuring precise alignment and ultra-low latency for multi-person chorus. Warning This scenario enumeration is only supported in SDK version 3.10.0 and above | Audio encoder compatibility: Only available for RTC Stream Publishing, requires server-side transcoding for CDN forwarding. |
If after specifying a scenario, developers have needs for fine-grained control over SDK audio/video configurations, they can configure through other APIs with priority higher than scenario-based configurations.
-
Video-related configurations
-
Audio-related configurations
- After setRoomScenario successfully modifies the scenario, it will not affect streams already created by createZegoStream before the scenario modification, only affecting streams created through createZegoStream after the scenario modification.
- After leaving the Room, once the scenario is switched through setRoomScenario, all previous fine-grained audio/video configurations made through the above APIs will be reset to the default values of the new scenario. Therefore, it is recommended to set the scenario first, then adjust audio/video configurations through other APIs.
- If scenario-based configuration is done first, followed by fine-grained audio/video configuration through createZegoStream, the new parameter configuration will override the audio/video related configurations in the scenario settings.
- If you have other scenario setting requirements or configuration questions, please contact ZEGO technical support.
