We connect to https://meet.jit.si for video conference. If we use a chrome browser on Android device (tested on both Android 7 and 10), we are able to join with both Camera and Mic enabled. Able to turn them on and off as well. But if we try the same using a webview, we are not even getting a prompt from the website to allow access and get a "Failed to access camera/mic" error when trying to turn them on.
This is our code.
Manifest
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.CAMERA" />
<uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS" />
<uses-permission android:name="android.permission.RECORD_AUDIO" />
Getting runtime permission on load
String[] permissions =
{Manifest.permission.READ_EXTERNAL_STORAGE,
Manifest.permission.WRITE_EXTERNAL_STORAGE,
Manifest.permission.INTERNET,
Manifest.permission.RECORD_AUDIO,
Manifest.permission.CAMERA};
ActivityCompat.requestPermissions(
this,
permissions,
1010);
Loading the webpage into WebView
String url = "https://meet.jit.si/testingconf49854";
WebView webView = findViewById(R.id.webView);
WebSettings mWebSettings = webView.getSettings();
mWebSettings.setLoadsImagesAutomatically(true);
mWebSettings.setBlockNetworkLoads(false);
mWebSettings.setJavaScriptEnabled(true);
mWebSettings.setLoadWithOverviewMode(true);
mWebSettings.setUseWideViewPort(false);
mWebSettings.setTextZoom(70);
mWebSettings.setCacheMode( WebSettings.LOAD_NO_CACHE );
mWebSettings.setUserAgentString("Mozilla/5.0 (Linux; Android 5.1.1; Nexus 5 Build/LMY48B; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/43.0.2357.65 Mobile Safari/537.36");
webView.setScrollBarStyle(WebView.SCROLLBARS_OUTSIDE_OVERLAY);
webView.setScrollbarFadingEnabled(true);
Map<String, String> noCacheHeaders = new HashMap<String, String>(2);
noCacheHeaders.put("Pragma", "no-cache");
noCacheHeaders.put("Cache-Control", "no-cache");
webView.loadUrl(url, noCacheHeaders);
Please let us know what we are missing here. Appreciate your help.