startScreenCaptureBySourceType abstract method

Future<void> startScreenCaptureBySourceType({
  1. required VideoSourceType sourceType,
  2. required ScreenCaptureConfiguration config,
})

Starts screen capture.

This method, as well as startScreenCapture, startScreenCaptureByDisplayId, and startScreenCaptureByWindowId, can all be used to start screen capture, with the following differences: startScreenCapture only applies to Android and iOS, whereas this method only applies to Windows and iOS. 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. This method applies to the macOS and Windows only. If you call this method to start screen capture, Agora recommends that you call stopScreenCaptureBySourceType to stop the capture and avoid using stopScreenCapture.

  • sourceType The type of the video source. See VideoSourceType. 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 When the method call succeeds, there is no return value; when fails, the AgoraRtcException exception is thrown. You need to catch the exception and handle it accordingly.

Implementation

Future<void> startScreenCaptureBySourceType(
    {required VideoSourceType sourceType,
    required ScreenCaptureConfiguration config});