startScreenCapture method Null safety

Future<void> startScreenCapture(
  1. int streamType,
  2. TRTCVideoEncParam encParams,
  3. {String shareUserId = '',
  4. String shareUserSig = '',
  5. String appGroup = ''}
)

Start desktop screen sharing

Parameters:

encParams Screen sharing encoding parameters. We recommend you use the above configuration. If you set encParams to nil, the encoding parameter settings before startScreenCapture is called will be used.

appGroup This parameter takes effect only for iOS and can be ignored for Android. It is the Application Group Identifier shared by the primary app and broadcast process

If appGroup is empty on iOS, it will only become in-app screen sharing, and it takes effect only on iOS 13.0 and above

Screen sharing

Implementation

Future<void> startScreenCapture(int streamType, TRTCVideoEncParam encParams,
    {String shareUserId = '',
    String shareUserSig = '',
    String appGroup = ''}) {
  if (kIsWeb) {
    return _channel.invokeMethod('startScreenCapture', {
      "shareUserId": shareUserId,
      "shareUserSig": shareUserSig,
      "streamType": streamType
    });
  }
  if (!kIsWeb && Platform.isAndroid) {
    return _channel.invokeMethod('startScreenCapture',
        {"encParams": jsonEncode(encParams), "streamType": streamType});
  }
  if (!kIsWeb && Platform.isIOS && appGroup != '') {
    return _channel.invokeMethod('startScreenCaptureByReplaykit', {
      "encParams": jsonEncode(encParams),
      "appGroup": appGroup,
      "streamType": streamType,
    });
  } else if (!kIsWeb && Platform.isIOS && appGroup == '') {
    return _channel.invokeMethod('startScreenCaptureInApp', {
      "encParams": jsonEncode(encParams),
      "streamType": streamType,
    });
  }
  return _channel.invokeMethod('startScreenCapture',
      {"streamType": streamType, "encParams": jsonEncode(encParams)});
}