requestCapturePermission static method

Future<bool> requestCapturePermission({
  1. bool fullScreenOnly = false,
})

Request capture permission for Android.

When fullScreenOnly is true and running on Android 14+ (API 34), the MediaProjection consent dialog only offers entire-screen capture and the single-app option is removed (via MediaProjectionConfig.createConfigForDefaultDisplay()). Has no effect on older Android versions. Defaults to false, which keeps the platform's default user-choice dialog.

Implementation

static Future<bool> requestCapturePermission(
    {bool fullScreenOnly = false}) async {
  if (WebRTC.platformIsAndroid) {
    return await WebRTC.invokeMethod(
      'requestCapturePermission',
      <String, dynamic>{'fullScreenOnly': fullScreenOnly},
    );
  } else {
    throw Exception('requestCapturePermission only support for Android');
  }
}