startScreenCaptureByScreenRect abstract method

Future<void> startScreenCaptureByScreenRect({
  1. required Rectangle screenRect,
  2. required Rectangle regionRect,
  3. required ScreenCaptureParameters captureParams,
})

Captures the whole or part of a screen by specifying the screen rect.

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. Deprecated: This method is deprecated. Use startScreenCaptureByDisplayId instead. Agora strongly recommends using startScreenCaptureByDisplayId if you need to start screen sharing on a device connected to another display. This method shares a screen or part of the screen. You need to specify the area of the screen to be shared. This method applies to Windows only.

  • screenRect Sets the relative location of the screen to the virtual screen.
  • regionRect Sets the relative location of the region to the screen. If you do not set this parameter, the SDK shares the whole screen. See Rectangle. If the specified region overruns the screen, the SDK shares only the region within it; if you set width or height as 0, the SDK shares the whole screen.
  • captureParams The screen sharing encoding parameters. The default video resolution is 1920 × 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> startScreenCaptureByScreenRect(
    {required Rectangle screenRect,
    required Rectangle regionRect,
    required ScreenCaptureParameters captureParams});