The Real-Time Communication (RTC) software development kit (SDK) lets you set video encoding properties to improve the user experience in different scenarios. This topic describes how to set these properties.
Background information
In Real-Time Communication scenarios, you can set video encoding properties to adjust video definition and smoothness. For one-to-one video calls, you can increase the resolution and frame rate for a better user experience. If multiple users are in a channel, you can lower the resolution and bitrate to reduce resource consumption and downstream bandwidth usage.
Implementation
Before setting video properties, call the getAvailableResolutions method and pass the camera parameter to retrieve the supported resolutions and frame rates. Then, call the setVideoProfile method to set the video properties. The settings take effect after you call publish.
aliWebrtc.setVideoProfile({
width,
height,
frameRate,
},type);| Name | Type | Description | |
| config | width | Number | The width. Valid values:
|
| height | Number | The height. Valid values:
| |
| frameRate | Number | The frame rate. The value ranges from 5 to 30. Valid values:
| |
| maxBitrate | Number | The maximum bitrate. Valid values:
Important This parameter is removed in version 1.13.2. The SDK automatically sets the maximum bitrate based on the specified resolution and frame rate. For versions earlier than 1.13.2, you must configure this parameter when you call setVideoProfile. | |
| type | Number | The stream type. Valid values:
| |