Search code examples
javascriptwebviewwebrtcandroid-webviewgetusermedia

getUserMedia is failing with "Permission Denied" in Android WebView


I've been working on a web application which uses WebRTC to perform video calls. So, before a user start a video call, we invoke getUserMedia method to ask the user for permission to use the media devices.

This works just fine in all the major desktop and mobile browsers. So, we did an experiment by loading our securely deployed web application in the Android WebView. But, surprisingly it never worked.

After debugging we found out that getUserMedia is failing with a exception "Permission Denied". The prompt to ask for microphone and camera permissions never triggered. It just fails!

So, as described in the Browser compatibility getUserMedia has the full support in Android WebView. But I am not sure what's going wrong.

Anyone who has a good idea on what could go wrong here?

Thanks!


Solution

  • The webview is compatible but the device acces has to be requested from native side in a native app. The Camera and Microphone Permissions must be added to the manifest of the app. Also the webview has to be configured to request that access depending of the webview/app.