Skip to content

iOS WebView Does Not Persist Camera and Mic Permission Status in In-App Webview #1751

Description

@7ANV1R

Expected Behavior:

The WebView should remember the previously granted camera and microphone permissions, and not prompt the user again for permission.

Actual Behavior:

On iOS, the WebView asks for camera and microphone permissions every time the app is launched, and the video meeting page is accessed within the WebView. The permission status is not persisted across app sessions.

Additional Information:
This issue is specific to iOS and is not observed on Android devices. The behavior is consistent across different versions of iOS.

Code:

 Positioned.fill(
            child: InAppWebView(
              initialUrlRequest: URLRequest(
                url: Uri.parse(widget.url),
              ),
              onWebViewCreated: (controller) {
                webViewController = controller;
              },
              initialOptions: InAppWebViewGroupOptions(
                ios: IOSInAppWebViewOptions(
                  allowsInlineMediaPlayback: true,
                  allowsAirPlayForMediaPlayback: true,
                ),
                crossPlatform: InAppWebViewOptions(
                  // Assign the permissionRequestHandler function
                  mediaPlaybackRequiresUserGesture: false,
                ),
              ),
              androidOnPermissionRequest:
                  (InAppWebViewController controller, String origin, List<String> resources) async {
                return PermissionRequestResponse(
                  resources: resources,
                  action: PermissionRequestResponseAction.GRANT,
                );
              },
              onLoadStart: (controller, url) {
                isLoading.value = true;
              },
              onLoadStop: (controller, url) {
                isLoading.value = false;
              },
            ),
          ),

Environment:

Flutter Version: 3.10
iOS Version: 15.7
Device: iPhone 7
flutter_inappwebview: 5.7.2+3

Notes:
This issue affects user experience, as users are prompted for camera and microphone permissions every time they access the video meeting page within the WebView on iOS devices. It is essential to ensure a smoother and more streamlined user experience by persisting the permission status across app sessions on iOS.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions