startScreenCapture method

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

Start desktop screen sharing, grab what's on the user's screen and share it with other users in the same room


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

Platform not supported´╝Ü

  • macOS


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