startScreenCaptureBySourceType

Starts screen capture.

abstract startScreenCaptureBySourceType(
    sourceType: VideoSourceType,
    config: ScreenCaptureConfiguration
  ): number;

Details

This method, as well as startScreenCaptureByDisplayId and startScreenCaptureByWindowId, can all be used to enable screen capture, with the following differences:
  • startScreenCaptureByDisplayId and startScreenCaptureByWindowId only support capturing video from a single screen or window. By calling this method and specifying the sourceType parameter, you can capture multiple video streams used for local video mixing or multi-channel publishing.
Attention:

Parameters

sourceType

The type of the video source. See VideoSourceType.

Note:
  • Windows supports up to four screen capture video streams.
  • macOS supports only one screen capture video stream. You can only set this parameter to VideoSourceScreen(2).
config
The configuration of the captured screen. See ScreenCaptureConfiguration.

Returns

  • 0: Success.
  • < 0: Failure.