ScreenCaptureParameters

Parameters used to configure screen sharing.

struct ScreenCaptureParameters {
  bool captureAudio;
  ScreenAudioParameters audioParams;
  VideoDimensions dimensions;
  int frameRate;
  int bitrate;
  bool captureMouseCursor;
  bool windowFocus;
  view_t* excludeWindowList;
  int excludeWindowCount;
  int highLightWidth;
  unsigned int highLightColor;
  bool enableHighLight;
};

Properties

dimensions
Note: When setting the encoding resolution in document sharing scenarios, refer to the recommended settings.
The encoding resolution of the screen sharing video stream. The default value is 1920 × 1080, which equals 2,073,600 pixels. Agora calculates the cost based on this value. If the screen size differs from this value, the SDK uses the following encoding strategy. Assuming dimensions is set to 1920 × 1080:
  • If the screen size is smaller than dimensions, such as 1000 × 1000 pixels, the SDK encodes using the screen size (i.e., 1000 × 1000 pixels).
  • If the screen size is larger than dimensions, such as 2000 × 1500 pixels, the SDK encodes using the maximum value that does not exceed dimensions while maintaining the screen's aspect ratio (4:3), i.e., 1440 × 1080.
See also VideoDimensions.
frameRate
On Windows and macOS, specifies the encoding frame rate (fps) of the screen sharing video stream. The default value is 5. Agora does not recommend setting a value greater than 15.
bitrate
On Windows and macOS, specifies the encoding bitrate (Kbps) of the screen sharing video stream. The default value is 0, meaning the SDK automatically calculates the bitrate based on the current screen resolution.
captureMouseCursor
Note: Due to macOS system limitations, setting this to false during screen sharing has no effect (not applicable when sharing a window).
Whether to capture the mouse cursor during screen sharing:
  • true: (default) Capture the mouse.
  • false: Do not capture the mouse.
windowFocus
Note: Due to macOS system limitations, when setting this parameter to bring the window to the front, only the main window will be brought to the front if the current app has multiple windows.
When calling the startScreenCaptureByWindowId method to share a window, whether to bring the window to the front:
  • true: Bring the window to the front.
  • false: (default) Do not bring the window to the front.
excludeWindowList
List of window IDs to exclude. When calling startScreenCaptureByDisplayId to start screen sharing, you can use this parameter to exclude specific windows. When calling updateScreenCaptureParameters to update screen sharing configuration, you can also use this parameter to dynamically exclude specific windows.
excludeWindowCount
Number of windows to exclude.
Note: On Windows, the maximum value of this parameter is 24; exceeding this value will cause window exclusion to fail.
highLightWidth
(Applicable only to macOS and Windows) Border width (in pixels). The default value is 5. Value range is (0, 50].
Note: This parameter takes effect only when highLighted is set to true.
highLightColor
(Applicable only to macOS and Windows)
  • On Windows, the border color is in ARGB format. Default value is 0xFF8CBF26.
  • On macOS, COLOR_CLASS refers to NSColor.
enableHighLight
Note: When sharing a portion of a window or screen, if this parameter is set to true, the SDK displays a border around the entire window or screen.
(Applicable only to macOS and Windows) Whether to show a border around the shared window or screen:
  • true: Show the border.
  • false: (default) Do not show the border.