0

I have webview displayed on custom dialog, I am loading an URL to WebView which is video URL, by default the video is loaded and starts playing, I want to disable auto play function. Here is my code for WebView

 wvActiveVideo.setWebViewClient(new WebViewClient());
                wvActiveVideo.getSettings().setJavaScriptEnabled(true);
                wvActiveVideo.getSettings().setJavaScriptCanOpenWindowsAutomatically(true);
                wvActiveVideo.getSettings().setPluginState(WebSettings.PluginState.ON);
                wvActiveVideo.getSettings().setMediaPlaybackRequiresUserGesture(false);
                wvActiveVideo.setWebChromeClient(new WebChromeClient());
                wvActiveVideo.setWebViewClient(new WebViewClient());
                wvActiveVideo.getSettings().setSupportZoom(true);
                wvActiveVideo.getSettings().setBuiltInZoomControls(true);
                wvActiveVideo.getSettings().setDisplayZoomControls(false);
                String url = model.getVideo();
                wvActiveVideo.loadUrl(model.getVideo());
yogesh lokhande
  • 1,245
  • 1
  • 11
  • 20

1 Answers1

0

It depends of your algorithm.

First advice , before load url show your user play button background.

Second advice is data manupulation ;

  @Override
        public void onPageFinished(WebView view, String url) {

                view.loadUrl("javascript:document.getElementById(\"video-test\").innerHTML = \"\";void(0);");
                webView.setVisibility(View.VISIBLE);

        }
mbakgun
  • 75
  • 5