Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

IOS Selfie camera not opening #2117

Open
2 tasks done
vijayunified opened this issue Apr 29, 2024 · 1 comment
Open
2 tasks done

IOS Selfie camera not opening #2117

vijayunified opened this issue Apr 29, 2024 · 1 comment
Labels
bug Something isn't working

Comments

@vijayunified
Copy link

  • I have read the Getting Started section
  • I have already searched for the same problem

Environment

Technology Version
Flutter version 3.19.5
Plugin version 6.0.0
Android version 14
iOS version 17.4.1
macOS version Sonoma 14.4
Xcode version 15.2
Google Chrome version

Device information:

Description

Expected behavior:
Integrate a third-party KYC library to perform user verification through a webview that can access both the front and back cameras of a device.

  • When the KYC process prompts the user to take a selfie, the web view should activate the front-facing camera.

Current behavior:
On iOS devices, the webview integrated with the KYC library only allows access to the back camera and fails to switch to or activate the front camera.

  • The user starts the KYC verification process in the review on an iOS device.

  • The KYC process works correctly when accessing the back camera for document photos.

  • When the process requires a selfie, the review fails to switch to or activate the front-facing camera.

Steps to reproduce

  1. This
  2. Than that
  3. Then

Code

`Expanded(

        child: InAppWebView(
            initialUrlRequest:
            URLRequest(url: WebUri(widget.webUrl.toString())),
            initialSettings: InAppWebViewSettings(
                allowFileAccess: true,
                allowContentAccess: true,
                iframeAllow: "camera; microphone",
                iframeAllowFullscreen: true,
                mediaPlaybackRequiresUserGesture: false,
                useShouldOverrideUrlLoading: true,
                useHybridComposition:true,
                allowsInlineMediaPlayback: true,
                javaScriptEnabled: true,
                hardwareAcceleration: true),
            shouldOverrideUrlLoading: (controller, navAction) async {
              return NavigationActionPolicy.ALLOW;
            },
            onReceivedError: (controller, request, error){
              AppLog.logPrint("RECEIVED ERROR: ${error}");
            },
            onPermissionRequest: (controller, request) async {
              print(request);
              return PermissionResponse(
                  resources: request.resources,
                  action: PermissionResponseAction.GRANT);
            },
            onWebViewCreated:
                (InAppWebViewController inAppWebViewController) {
              _controller.complete(inAppWebViewController);
            },
            onLoadStart: (InAppWebViewController, url) {
              setState(() {
                this.url = url?.toString() ?? '';
              });
            },
            onReceivedServerTrustAuthRequest: (_, challenge) async {
              return ServerTrustAuthResponse(action: ServerTrustAuthResponseAction.PROCEED);
            },
            onCameraCaptureStateChanged:
                (inAppWebViewController, oldState, newState) async {
              var state= await inAppWebViewController.getCameraCaptureState();
              return inAppWebViewController.setCameraCaptureState(
                  state:state!);
            },
            onConsoleMessage: (InAppWebViewController, consoleMessage) {
              AppLog.logPrint(consoleMessage);
              /*if (controller.status.isSuccess == 1) {
    Get.offAll(const BottomNav(setIndex: 0));
  }*/
              // it will print: {message: {"bar":"bar_value","baz":"baz_value"}, messageLevel: 1}
            },
            onPageCommitVisible: (InAppWebViewController, url) async {
              InAppWebViewController.canGoBack();
            },
            onProgressChanged: (InAppWebViewController, progress) {
              setState(() {
                this.progress = progress / 100;
              });
            },
            shouldInterceptAjaxRequest: (InAppWebViewController controller,
                AjaxRequest ajaxRequest) async {
              print(ajaxRequest.url);
              return ajaxRequest;
            },
            onAjaxReadyStateChange: (InAppWebViewController _controller,
                AjaxRequest ajaxRequest) async {
              AppLog.logPrint(ajaxRequest.status);
              return AjaxRequestAction.PROCEED;
            },
            onAjaxProgress: (InAppWebViewController _controller,
                AjaxRequest ajaxRequest) async {
              AppLog.logPrint(ajaxRequest.status);
              return AjaxRequestAction.PROCEED;
            },
            onLoadStop: (InAppWebViewController, url) async {
              if (url.toString() == ApiConst.kycSuccessUrlDev) {
                await PreferenceUtils.setString(
                    AppConstants.KYC_STATUS, KycStatus.kycSuccessful);
                //Get.offAll(const BottomNav(setIndex: 0));
                Get.to(const KYCSuccessScreen());
                //ApiRepo.showToast("KYC Completed Successfully", isForError: false);
              }
              //InAppWebViewController.canGoBack();
            },
            androidOnPermissionRequest: (InAppWebViewController controller,
                String origin, List<String> resources) async {
              return PermissionRequestResponse(
                  resources: resources,
                  action: PermissionRequestResponseAction.GRANT);
            }),
      )` 

Images

Stacktrace/Logcat

Here Is My Code

@vijayunified vijayunified added the bug Something isn't working label Apr 29, 2024
Copy link

👋 @vijayunified

NOTE: This comment is auto-generated.

Are you sure you have already searched for the same problem?

Some people open new issues but they didn't search for something similar or for the same issue. Please, search for it using the GitHub issue search box or on the official inappwebview.dev website, or, also, using Google, StackOverflow, etc. before posting a new one. You may already find an answer to your problem!

If this is really a new issue, then thank you for raising it. I will investigate it and get back to you as soon as possible. Please, make sure you have given me as much context as possible! Also, if you didn't already, post a code example that can replicate this issue.

In the meantime, you can already search for some possible solutions online! Because this plugin uses native WebView, you can search online for the same issue adding android WebView [MY ERROR HERE] or ios WKWebView [MY ERROR HERE] keywords.

Following these steps can save you, me, and other people a lot of time, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant