Scenario-based Audio Configuration
Feature Introduction
To facilitate quick integration for developers and lower the integration barrier, the SDK provides preset scenarios. Developers can select the corresponding room mode based on their needs, and the SDK will automatically apply audio parameters and other configurations suitable for that scenario, thereby quickly achieving the best results for that scenario. Currently, only the Standard Chatroom scenario is supported.
Usage Method
Create and initialize an instance of ZegoExpressEngine, and the scenario field in the options parameter needs to specify a scenario. You can choose based on your actual audio business scenario.
const zg = new ZegoExpressEngine(appid, server, { scenario: 6 })- Users in the same room are recommended to use the same room scenario for best results.
- If you need multiple audio business scenarios, you can switch scenarios by calling the setRoomScenario interface after exiting a room, without creating a new engine instance, and then log in to another room.
Currently, the SDK supports the following scenarios:
| Scenario (Supported version: 2.21.0 and above) | Scenario Value | Scenario Description | Key Configuration Description |
|---|---|---|---|
| HighQualityChatroom | 7 | High-quality chatroom scenario, similar to the StandardChatroom (6) scenario, but this scenario uses higher audio configurations by default than the StandardChatroom (6) scenario, suitable for multi-person pure voice call scenarios with higher audio quality requirements. Note:
| - | StandardChatroom | 6 | Standard chatroom scenario, suitable for multi-person pure voice calls. (Saves traffic)
| - |
If after specifying a scenario, developers need fine-grained control over SDK audio configurations, they can configure them through other APIs.
Audio-related configuration: setAudioConfig
- After setRoomScenario successfully modifies the scenario, it will not affect streams already created by createZegoStream before the scenario modification; it will only affect streams created by createZegoStream after the scenario modification.
- After exiting a room, once the scenario is switched through setRoomScenario, all previously fine-grained audio 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, and then adjust audio configurations through other APIs.
- If you perform scenario-based configuration first, and then perform fine-grained audio-related configuration through createZegoStream, the new parameter configuration will override the audio-related configuration in the scenario-based settings.
- If you have requirements for setting up other scenarios, please contact ZEGO Technical Support.
