startScreenCapture method Null safety

Future<void> startScreenCapture(
  1. TRTCVideoEncParam encParams,
  2. [String appGroup = '']
)

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(TRTCVideoEncParam encParams,
    [String appGroup = '']) {
  if (Platform.isAndroid) {
    return _channel.invokeMethod(
        'startScreenCapture', {"encParams": jsonEncode(encParams)});
  }
  if (Platform.isIOS && appGroup != '') {
    return _channel.invokeMethod('startScreenCaptureByReplaykit', {
      "encParams": jsonEncode(encParams),
      "appGroup": appGroup,
    });
  } else if (Platform.isIOS && appGroup == '') {
    return _channel.invokeMethod('startScreenCaptureInApp', {
      "encParams": jsonEncode(encParams),
    });
  }
  return _channel.invokeMethod(
      'startScreenCapture', {"encParams": jsonEncode(encParams)});
}