TRTC_TranscodingConfigMode_Template_ScreenSharing property Null safety

int TRTC_TranscodingConfigMode_Template_ScreenSharing
final

Screen sharing mode, which is suitable for screen sharing-based use cases such as online education and supported only by the SDKs for Windows and macOS. The SDK will first build a canvas according to the target resolution you set (through the videoWidth and videoHeight parameters). Before the teacher enables screen sharing, the SDK will scale up the camera image proportionally and draw it onto the canvas. After the teacher enables screen sharing, the SDK will draw the video image shared on the screen onto the same canvas. The purpose of this procedure is to ensure consistency in the output resolution of the mixtranscoding module and avoid problems with blurred screen during course replay and webpage playback (web players don't support adjustable resolution). Meanwhile, the audios of mic-on students will be mixed into the teacher's audio/video stream by default.

Video content is primarily the shared screen in teaching mode, and it is a waste of bandwidth to transfer camera image and screen image at the same time. Therefore, the recommended practice is to directly draw the camera image onto the current screen through the setLocalVideoRenderCallback API. In this mode, you don't need to set the mixUsers parameter in TRTCTranscodingConfig, and the SDK will not mix students' images so as not to interfere with the screen sharing effect.

You can set width x height in TRTCTranscodingConfig to 0 px x 0 px, and the SDK will automatically calculate a suitable resolution based on the aspect ratio of the user's current screen.

  • If the teacher's current screen width is less than or equal to 1920 px, the SDK will use the actual resolution of the teacher's current screen.
  • If the teacher's current screen width is greater than 1920 px, the SDK will select one of the three resolutions of 1920x1080 (16:9), 1920x1200 (16:10), and 1920x1440 (4:3) according to the current screen aspect ratio.

Implementation

static final int TRTC_TranscodingConfigMode_Template_ScreenSharing = 4;