Web

更新时间:
复制 MD 格式

The Real-Time Communication (RTC) SDK lets you set video encoding properties. You can configure these properties based on your application scenario to improve the product experience. This topic describes how to set these properties.

Background information

In a Real-Time Communication scenario, you can set video encoding properties to adjust the video's definition and smoothness. If you know that your application will have excellent network conditions and sufficient device computing power, you can increase the resolution and frame rate to improve the user experience. If network conditions or device computing power are limited or uncertain, you can lower the resolution and frame rate. This reduces resource consumption for encoding and decoding and reduces the pressure on downstream bandwidth.

Implementation Method

Parameter configuration

Parameter

Type

Description

config

CameraVideoTrackConfig

Predefined video encoding properties.

  • dimension: The video resolution. The default value is [640,480].

  • frameRate: The video encoding frame rate. The default value is 15.

  • deviceId: The ID of the specified camera device.

Note

  • Higher video resolutions and frame rates require a higher encoding bitrate. This also increases device performance requirements and consumes more network bandwidth.

Methods

You can set video encoding properties in one of the following two ways:

  • Pass the properties when creating a camera video track.

    const cameraTrack = await DingRTC.createCameraVideoTrack({ dimension: 'VD_640x480', frameRate: 15 })
  • Adjust the camera video track after creation. Note that you cannot modify a track while it is being published.

    await cameraTrack.setEncoderConfiguration({ dimension: 'VD_640x480', frameRate: 15 })