startScreenCapture abstract method

void startScreenCapture(
  1. int viewId,
  2. TRTCVideoStreamType streamType,
  3. TRTCVideoEncParam encParam
)

Start screen sharing

This API can capture the content of the entire screen or a specified application and share it with other users in the same room.

Parameters:

  • encParam(TRTCVideoEncParam):
    • Image encoding parameters used for screen sharing, which can be set to empty, indicating to let the SDK choose the optimal encoding parameters (such as resolution and bitrate).
  • streamType(TRTCVideoStreamType):
  • viewId(int):
    • Parent control of the rendering control, which can be set to a null value, indicating not to display the preview of the shared screen.

Note:

  1. A user can publish at most one primary stream (TRTCVideoStreamType.big) and one substream (TRTCVideoStreamType.sub) at the same time.
  2. By default, screen sharing uses the substream image. If you want to use the primary stream for screen sharing, you need to stop camera capturing (through stopLocalPreview) in advance to avoid conflicts.
  3. Only one user can use the substream for screen sharing in the same room at any time; that is, only one user is allowed to enable the substream in the same room at any time.
  4. When there is already a user in the room using the substream for screen sharing, calling this API will return the TRTCCloudListener.onError (ERR_SERVER_CENTER_ANOTHER_USER_PUSH_SUB_VIDEO) callback.

Implementation

void startScreenCapture(int viewId, TRTCVideoStreamType streamType, TRTCVideoEncParam encParam);