Hi to all! I am making an android app for a ready made social medial website.
Website url is: "www.MixMasala.in"
I am using webview for this site, all the functionality working accept two. As this is a social media website it has also audio and video calling option. When I use this website on regular browser such as Chrome, audio and video calling also works perfectly, but when I open this site in android web view then audio and Video calling don't work i-e interface of video and audio calling options open but voice and video can't be heard and seen. You can check that functionality by logging in that site on a regular browser.
Guide me what I am missing. I am pasting code of Oncreate() method of my webview activity.
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
mywebView = findViewById(R.id.wbvw);
WebSettings webSettings = mywebView.getSettings();
webSettings.setJavaScriptEnabled(true);
webSettings.setBuiltInZoomControls(true);
webSettings.setPluginState(WebSettings.PluginState.ON);
webSettings.setAllowFileAccess(true);
webSettings.setAllowContentAccess(true);
webSettings.setMediaPlaybackRequiresUserGesture(false);
mywebView.getSettings().setLoadWithOverviewMode(true);
mywebView.getSettings().setUseWideViewPort(true);
mywebView.getSettings().setDomStorageEnabled(true);
if ( Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP ) {
CookieManager cookieManager = CookieManager.getInstance();
cookieManager.setAcceptThirdPartyCookies( mywebView , true );
}
mywebView.setWebViewClient(new WebViewClient(){
@Override
public void onPageFinished(WebView view, String url) {
super.onPageFinished(view, url);
if (ContextCompat.checkSelfPermission(MainActivity.this,
Manifest.permission.RECORD_AUDIO) != PackageManager.PERMISSION_GRANTED
) {
ActivityCompat.requestPermissions(MainActivity.this,
new String[]{Manifest.permission.RECORD_AUDIO},
REQUEST_RECORD_AUDIO);
}
}
});
if (savedInstanceState == null) {
mywebView.loadUrl("https://mixmasala.in/Script");
}
mywebView.setDownloadListener(new DownloadListener() {
public void onDownloadStart(String url, String userAgent,
String contentDisposition, String mimetype,
long contentLength) {
Intent i = new Intent(Intent.ACTION_VIEW);
i.setData(Uri.parse(url));
startActivity(i);
}
});
}