startScreenCaptureByWindowId abstract method

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

开始采集指定窗口的视频流。

共享一个窗口或该窗口的部分区域。用户需要在该方法中指定想要共享的窗口 ID。 该方法支持共享通用 Windows 平台(UWP)应用窗口。声网使用最新版 SDK 对主流的 UWP 应用进行了测试,结果如下: 系统版本 软件名称 兼容版本 是否支持 Windows 10 Chrome 76.0.3809.100 否 Office Word 18.1903.1152.0 是 Office Excel 18.1903.1152.0 否 Office PPT 18.1903.1152.0 是 WPS Word 11.1.0.9145 是 WPS Excel 11.1.0.9145 是 WPS PPT 11.1.0.9145 是 系统自带的 Media Player 所有版本 是 Windows 8 Chrome 所有版本 是 Office Word 所有版本 是 Office Excel 所有版本 是 Office PPT 所有版本 是 WPS Word 11.1.0.9098 是 WPS Excel 11.1.0.9098 是 WPS PPT 11.1.0.9098 是 系统自带的 Media Player 所有版本 是 Windows 7 Chrome 73.0.3683.103 否 Office Word 所有版本 是 Office Excel 所有版本 是 Office PPT 所有版本 是 WPS Word 11.1.0.9098 否 WPS Excel 11.1.0.9098 否 WPS PPT 11.1.0.9098 是 系统自带的 Media Player 所有版本 否 该方法仅适用于 macOS 和 Windows 平台。 SDK 的窗口共享功能依赖于 WGC(Windows Graphics Capture)或 GDI(Graphics Device Interface)采集,WGC 在早于 Windows 10 2004 的系统上无法设置关闭鼠标采集,因此,当你在搭载早于 Windows 10 2004 系统的设备上进行窗口共享时,可能出现 captureMouseCursor(false) 不生效的现象。详见 ScreenCaptureParameters 。

  • windowId 指定待共享的窗口 ID。
  • regionRect (可选)指定待共享区域相对于整个屏幕的位置。如不填,则表示共享整个屏幕。详见 Rectangle 。如果设置的共享区域超出了窗口的边界,则只共享窗口内的内容;如果宽或高为 0,则共享整个窗口。
  • captureParams 屏幕共享的参数配置。默认的分辨率为 1920 x 1080,即 2073600 像素。该像素值为计费标准。详见 ScreenCaptureParameters 。

Returns 方法成功调用时,无返回值;方法调用失败时,会抛出 AgoraRtcException 异常,你需要捕获异常并进行处理。详见错误码了解详情和解决建议。

Implementation

Future<void> startScreenCaptureByWindowId(
    {required int windowId,
    required Rectangle regionRect,
    required ScreenCaptureParameters captureParams});