startScreenCapture abstract method
- int viewId,
- TRTCVideoStreamType streamType,
- 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):
- Channel used for screen sharing, which can be the primary stream (TRTCVideoStreamType.big) or substream (TRTCVideoStreamType.sub).
- 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:
- A user can publish at most one primary stream (TRTCVideoStreamType.big) and one substream (TRTCVideoStreamType.sub) at the same time.
- 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.
- 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.
- 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);