WebView wvVideo = (WebView) findViewById(R.id.wvVideo);
String ytVideo= "<html><body><iframe width='350' height='160' src='www.youtube.com/watch?v=yqNGzYsPN6M' frameborder='0' allowfullscreen></iframe></body></html>";
wvVideo.getSettings().setPluginsEnabled(true);
wvVideo.getSettings().setAllowFileAccess(true);
wvVideo.getSettings().setPluginState(PluginState.ON);
wvVideo.getSettings().setBuiltInZoomControls(true);
wvVideo.getSettings().setJavaScriptEnabled(true);
wvVideo.loadData(ytVideo, "text/html", "utf-8");
它只是顯示縮略圖,當我點擊它時,它不會播放。只是顯示黑屏。我的API目標是15,我設置了所有必需的權限,但仍然無法正常工作。WebView未在Android中加載HTML5視頻
什麼顯示在LogCat? – Raptor
不,但正如我所說,它只是顯示黑屏.. – Riser
@Segi試試我的答案! –