Can't access camera from Android webView (chrome frame) in context of webRTC Can't access camera from Android webView (chrome frame) in context of webRTC google-chrome google-chrome

Can't access camera from Android webView (chrome frame) in context of webRTC


Grant permissions in this way:

yourWebView.setWebChromeClient(new WebChromeClient() {                @Override                public void onPermissionRequest(PermissionRequest request) {                    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {                        request.grant(request.getResources());                    }                }            });


The WebView requests permission from the App, but the App is not granted these permissions from the user.

You should invoke App's permission request to the user, as mentioned in this document.

Now I found that the permissions WebRTC requires is those:

onPermissionRequest: android.webkit.resource.VIDEO_CAPTUREonPermissionRequest: android.webkit.resource.AUDIO_CAPTURE


Your app need request permission before use camera

 <uses-permission android:name="android.permission.CAMERA" /> <uses-feature android:name="android.hardware.camera" /> <uses-feature android:name="android.hardware.camera.autofocus" />