getScreenCaptureSources method

Future<TRTCScreenCaptureSourceList> getScreenCaptureSources({
  1. required int thumbnailWidth,
  2. required int thumbnailHeight,
  3. required int iconWidth,
  4. required int iconHeight,
})

Enumerate shareable screens and windows (this interface only supports Windows)

When you connect the screen sharing function of the desktop system, you generally need to display an interface for selecting the sharing target, so that users can use this interface to choose whether to share the entire screen or a certain window.

Through this interface, you can query the ID, name and thumbnail of the windows available for sharing in the current system.

Parameters:

thumbnailWidth Specify the width of the window shrinkage of the window.

thumbnailHeight Specify the height of the slight diagram of the window to be obtained.

iconWidth Specify the width of the window icon to be obtained.

iconHeight Specify the height of the window icon to be obtained.

Implementation

Future<TRTCScreenCaptureSourceList> getScreenCaptureSources({
  required int thumbnailWidth,
  required int thumbnailHeight,
  required int iconWidth,
  required int iconHeight,}) async {
  dynamic sourceInfoResult = await _cloudChannel!.invokeMethod('getScreenCaptureSources', {
    "thumbnailWidth": thumbnailWidth,
    "thumbnailHeight": thumbnailHeight,
    "iconWidth": iconWidth,
    "iconHeight": iconHeight,
  });
  Map<String, dynamic> sourceInfoMap;
  if (sourceInfoResult is Map<Object?, Object?>) {
    sourceInfoMap = sourceInfoResult.cast<String, dynamic>();
  } else {
    throw Exception('Unexpected result type: ${sourceInfoResult.runtimeType}');
  }
  return TRTCScreenCaptureSourceList.fromJson(sourceInfoMap!);
}