我有webview顯示在自定義對話框中,我加載了一個URL到WebView這是視頻URL,默認情況下視頻加載並開始播放,我想禁用自動播放功能。這裏是我的代碼WebView無法禁用自動播放視頻從WebView的URL
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());
希望此鏈接將幫助您 https://stackoverflow.com/questions/5946698/how-to-stop-youtube-video-playing-in-android-webview –
thanx的評論,但我使用自定義對話框,我有webview – YoLo