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);
            }
        });

}

This can be related to what Android and such is running on the phone. Google the following to find the discussion.

This is definitely a bug in the Android System WebView. I'm experiencing this issue on a Galaxy S8 with Android Pie using Android WebView version 73.0.3683.90. I rolled back to version 71.0.3578.99 and this problem goes away. – Pete Apr 11 '19 at 23:43

Not all phones have this issue. I posit that you can't fix this for every phone that fails unless you create your own system.

rProfitt thanks for reply. I have tested my webview app on Huwaei honor 8 (Android Nougat) and Oppo Phones, but audio and video calling feature doesn't working . Can you tell me how to downgrade or change the version of webview? I can try this thing ,May it can solve my problem.

@Saboor880. Sorry but no. I don't hack Android that much but do know forums that dig into that. My best finds about such was at XDA Forum which also found another ROM (where the OS is) that saved a few phones from early retirement.

In closing, my find on this points to issues with the phone OS and not necessarily with your code as it stands.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.