RTC SDK provides you with the feature to set video stream specifications and types. You can set video attributes based on the video stream specifications and types to achieve better product experience. By reading this article, you can learn how to set video properties.

Overview

In the Real-Time Communication, set video properties according to your preferences and actual situation, and adjust the definition and smoothness of the video picture. If it is one-to-one video communication, you can increase the resolution and frame rate. If there are multiple users in the channel for video communication, you can appropriately reduce the resolution and bit rate to reduce the resource consumption of encoding and decoding and relieve downstream bandwidth pressure. Video attributes include video stream specifications and video stream types.

Implementation method

Before setting video properties, you need to call the getAvailableResolutions to pass in the camera parameters to return the supported resolution and frame rate, and then use the setVideoProfile method to set the video properties. The publish can take effect.

aliWebrtc.setVideoProfile({ 
      width,
      height,
      frameRate,
    },type);
Parameter Type Description
config width Number The width of the remote videos. Valid values:
  • Camera: 640 (default).
  • Screen sharing: 960 (default).
height Number The height of the remote videos. Valid values:
  • Camera: 480 (default).
  • Screen sharing: 540 (default).
frameRate Number The frame rate of the transcoded stream. Valid values: 5 to 30. Valid values:
  • Camera: 15 (default).
  • Screen sharing: 10 (default).
maxBitrate Number The maximum bitrate. Valid values:
  • Camera: 500000 (default).
  • Screen sharing: 1500000 (default).
Notice Version 1.13.2 has deleted this parameter. The SDK automatically sets the maximum bitrate based on the specified resolution and frame rate. If you call setVideoProfile in a version earlier than 1.13.2, you must configure this parameter.
type Number Specifies the type. Valid values:
  • 1: Camera.
  • 2: Screen sharing.