logo
On this page

Scenario-based Audio Configuration

2025-07-09

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 })
Warning
  • 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 ValueScenario DescriptionKey Configuration Description
HighQualityChatroom7

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:

  • In this scenario, the camera is not enabled by default.
  • This scenario enumeration is only supported in SDK version 2.26.0 and above.
-
StandardChatroom6

Standard chatroom scenario, suitable for multi-person pure voice calls. (Saves traffic)
Note: In this scenario, the camera is not enabled by default.

-

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

Warning
  • 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.

Previous

Implementing Voice Call

Next

Using Token Authentication

On this page

Back to top