startScreenCaptureBySourceType

Starts screen capture from the specified video source.

abstract startScreenCaptureBySourceType(
    sourceType: VideoSourceType,
    config: ScreenCaptureConfiguration
  ): number;
Attention: This method applies to the macOS and Windows only.

Applicable scenarios

In the screen sharing scenario, you need to call this method to start capturing the screen video stream.

The SDK supports a series of methods for screen capturing, with the following distinctions between them. Please choose according to the actual scenario:

Restrictions

  • If you start screen capture by calling this method, you need to call stopScreenCaptureBySourceType to stop screen capture.
  • On the Windows platform, it supports up to four screen capture video streams.
  • On the macOS platform, it supports only one screen capture video stream.

Parameters

sourceType
The type of the video source. See VideoSourceType.
Attention: On the macOS platform, this parameter can only be set to VideoSourceScreen (2).
config
The configuration of the captured screen. See ScreenCaptureConfiguration.

Returns

  • 0: Success.
  • < 0: Failure.