Android Webview Camera And Microphone Permission Granted But Cannot Access
Solution 1:
You can not use a microphone and camera directly with webView for that you need to add extra permissions MODIFY_AUDIO_SETTINGS and also RECORD_AUDIO as well then only you will be able to access the features.
Add these permissions in the manifest file using
<uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS" />
<uses-permission android:name="android.permission.RECORD_AUDIO" />
then ask for permission using onPermissionRequest
method in your webView client class in your case which is MyCustomWebChromeClient
Solution 2:
seems you have took runtime permission from user, but not granted for WebChromeClient please add following code, will solve problem
webView.setWebChromeClient(new WebChromeClient(){
@Override
public void onPermissionRequest(final PermissionRequest request) {
runOnUiThread(new Runnable() {
@Override
public void run() {
request.grant(request.getResources());
}
});
}
Solution 3:
I too faced the same problem with Twilio Video Call sdk in a mobile web application opened inside WebView. While I spent good 4-5 hours trying various things from WebChromeClient in WebView and its events. Nothing worked for now. Had to resort to use some other alternate i.e. Chrome Custom Tabs. It is not exact substitude for WebView but was fit to our requirement for the time being.
refer https://guides.codepath.com/android/Chrome-Custom-Tabs
Post a Comment for "Android Webview Camera And Microphone Permission Granted But Cannot Access"