getScreenCaptureSources method

  1. @override
TRTCScreenCaptureSourceList? getScreenCaptureSources(
  1. TRTCSize thumbnail,
  2. TRTCSize icon
)
override

Enumerate shareable screens and windows (for desktop systems only)

When you integrate the screen sharing feature of a desktop system, you generally need to display a UI for selecting the sharing target, so that users can use the UI to choose whether to share the entire screen or a certain window.

Through this API, you can query the IDs, names, and thumbnails of sharable windows on the current system. We provide a default UI implementation in the demo for your reference.

Parameters:

  • iconSize(TRTCSize):
    • Specify the icon size of the window to be obtained.
  • thumbnailSize(TRTCSize):
    • Specify the thumbnail size of the window to be obtained. The thumbnail can be drawn on the window selection UI.

Return Description:

  • List of windows (including the screen).

Implementation

@override
TRTCScreenCaptureSourceList? getScreenCaptureSources(TRTCSize thumbnail, TRTCSize icon) {
  TRTCLog(_tag, "getScreenCaptureSources: thumbnail: $thumbnail icon: $icon");
  if (Platform.isAndroid || Platform.isIOS) {
    debugPrint("trtc-api not support");
    return null;
  }
  return TRTCCloudNative.instance.getScreenCaptureSources(thumbnail, icon);
}