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.

This method shares a screen or part of the screen. There are two ways to start screen sharing, you can choose one according to your needs: Call this method before joining a channel, and then call joinChannel to join a channel and set publishScreenTrack or publishSecondaryScreenTrack to true to start screen sharing. Call this method after joining a channel, and then call updateChannelMediaOptions and set publishScreenTrack or publishSecondaryScreenTrack to true to start screen sharing. 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.

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});