startScreenCaptureByDisplayId abstract method

Future<void> startScreenCaptureByDisplayId({
  1. required int displayId,
  2. required Rectangle regionRect,
  3. required ScreenCaptureParameters captureParams,
})

Captures the screen by specifying the display ID.

Captures the video stream of a screen or a part of the screen area. This method is for Windows and macOS only.

  • displayId The display ID of the screen to be shared. For the Windows platform, if you need to simultaneously share two screens (main screen and secondary screen), you can set displayId to -1 when calling this method.
  • regionRect (Optional) Sets the relative location of the region to the screen. Pass in nil to share the entire screen. See Rectangle.
  • captureParams Screen sharing configurations. The default video dimension is 1920 x 1080, that is, 2,073,600 pixels. Agora uses the value of this parameter to calculate the charges. See ScreenCaptureParameters. The video properties of the screen sharing stream only need to be set through this parameter, and are unrelated to setVideoEncoderConfiguration.

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> startScreenCaptureByDisplayId(
    {required int displayId,
    required Rectangle regionRect,
    required ScreenCaptureParameters captureParams});