Configure local audio and video attributes

Updated at:

ApsaraVideo Real-time Communication (ARTC) SDK for Web lets you configure local audio and video attributes — such as resolution, smoothness, and audio quality — to optimize user experience based on device capabilities, network conditions, and business requirements.

Configure video attributes

Call the setCameraCapturerConfiguration method to configure video attributes.

// Make sure that an AliRtcEngine instance is created.
aliRtcEngine.setCameraCapturerConfiguration({
  width: 1280, // The default width is 1280.
  height: 720, // The default height 720.
  frameRate: 30, // The default frame rate is 30.
  maxBitrate: 2000, // The default maximum bitrate is 2000.
  // You can select the camera type on a mobile device. Camera type selection is not available on computers.
  cameraDirection: 0, // 0 specifies the rear camera. 1 specifies the front camera.
  // If you need to specify camera settings, you can specify the corresponding device ID.
  // deviceId: 'xxxxx'
});

Configure audio attributes

Call the setAudioProfile method to configure audio attributes. The following table lists the supported arguments.

// Make sure that an AliRtcEngine instance is created.
// Specify the standard audio quality.
aliRtcEngine.setAudioProfile('standard');

Argument

Meaning

Sampling rate

Sound channel

Maximum bitrate (Kbit/s)

standard

Standard audio quality

48000

Mono

64

high

High audio quality

48000

Mono

128

standard-stereo

High-quality stereo

48000

Binaural

80

high-stereo

Ultra-high-quality stereo

48000

Binaural

192

Note

If you specify standard-stereo or high-stereo, microphones must support binaural channels. Otherwise, the audio has a mono sound.