Saturday, November 7, 2026
HomeiOS Developmentios - How one can set InAppWebView Digicam/Micro permissions in Flutter

ios – How one can set InAppWebView Digicam/Micro permissions in Flutter

[ad_1]

I’ve created an ios software with Flutter 2.5.0.
One of many software widgets makes use of InAppWebView with a web page that’s utilizing digicam/micro.

return Scaffold(
    appBar: AppBar(
    title: const Textual content('XPTO'),),
    physique: SafeArea(
      youngster: Column(youngsters: <Widget>[
        Expanded(
          child: Stack(
            children: [
              InAppWebView(
                key: webViewKey,
                initialUrlRequest: URLRequest(url: Uri.parse(app.url.toString())),
                initialOptions: options,
                androidOnPermissionRequest: (InAppWebViewController controller, String origin, List<String> resources) async {
                  return PermissionRequestResponse(resources: resources, action: PermissionRequestResponseAction.GRANT);
                },
                onWebViewCreated: (controller) async  {
                  webViewController = controller;
                },
          )])
        )
      ]
  )
));

the choices object for the InAppWebView is:

InAppWebViewGroupOptions choices = InAppWebViewGroupOptions(
  crossPlatform: InAppWebViewOptions(
    mediaPlaybackRequiresUserGesture: false,
    javaScriptEnabled: true
  ),
  ios: IOSInAppWebViewOptions(
    allowsInlineMediaPlayback: true,
    allowsAirPlayForMediaPlayback: true
  ));

On principal.dart I’ve put the permission request

  WidgetsFlutterBinding.ensureInitialized();

  await Permission.digicam.request();
  await Permission.microphone.request();

On Inflo.plist

<key>NSCameraUsageDescription</key>
<string>This factor use digicam</string>
<key>NSMicrophoneUsageDescription</key>
<string>This factor use the microfone</string>
<key>UILaunchStoryboardName</key>

On pod:

        ## dart: PermissionGroup.digicam
        'PERMISSION_CAMERA=1',

        ## dart: PermissionGroup.microphone
        'PERMISSION_MICROPHONE=1',

All the pieces is working fantastic.

The issue is that each time i open the InAppWebView, the message “Enable … to make use of your digicam and microphone?” seems.

How can I stop that message to indicate up? I’ve permission within the app, how can I give to the InAppWebView?

https://i.stack.imgur.com/d8efW.png

[ad_2]

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Most Popular

Recent Comments