我尝试在android java中使用webview播放iframe视频,视频加载正确,但除非声音静音,否则拒绝播放。请帮忙。这是我的网络视图代码:
private void playVideoOnWebView(String videoUrl) {
videoWebViewPlayer = findViewById(R.id.videoPlayerWebView);
videoWebViewPlayer.setVisibility(VISIBLE);
videoWebViewPlayer.getSettings().setJavaScriptEnabled(true);
videoWebViewPlayer.getSettings().getAllowContentAccess();
videoWebViewPlayer.getSettings().setDomStorageEnabled(true);
videoWebViewPlayer.getSettings().setAppCacheEnabled(true);videoWebViewPlayer.getSettings().setAppCachePath(getApplicationContext().getFilesDir().getAbsolutePath() + "/cache");
videoWebViewPlayer.getSettings().setDatabaseEnabled(true);
videoWebViewPlayer.getSettings().setDatabasePath(getApplicationContext().getFilesDir().getAbsolutePath() + "/databases");
videoWebViewPlayer.getSettings().setPluginState(WebSettings.PluginState.ON);
videoWebViewPlayer.getSettings().setDomStorageEnabled(true);
videoWebViewPlayer.setWebChromeClient(new WebChromeClient());
videoWebViewPlayer.loadUrl(videoUrl);
}
这是网页上的iframe
<iframe id="iframe" style="width: 100%; border-width: 0px; height: 100%;" src="https://player.vimeo.com/video/259666821?loop=false&byline=false&portrait=false&title=false&speed=true&transparent=1&gesture=media" allowfullscreen="" allowtransparency="" allow="autoplay"></iframe>
暂无答案!
目前还没有任何答案,快来回答吧!