0
我正在构建一篇阅读TechCrunch的android应用程序的文章。Youtube视频播放按钮在Android视频iframe中无效webview
在应用程序中,数据是由json排球库对应的像id,文章,图像和内容分析。
我在包含文本,图像和视频的网页视图中加载(html字符串)中的内容。 图像,文本和视频iframe在网络视图中正常显示。
视频iframe加载具有默认播放图标的YouTube视频,该图标无法正常工作。
问题是,当我点击youtube的默认播放图标时,视频无法播放,但当我点击iframe区域的其余部分时,视频开始正常播放!
帮助表示赞赏。
这里是我的代码 -
String htmldata = "<html><head><style = text/css>
img{width:100%!important;height:auto!important;}iframe {width:320px;height:120px;}a {
color:#3366CC; text-decoration: none; }</style></head><body style = line-height:25px;
>"+c+"</body></html>";
web1 = (WebView) findViewById(R.id.webView2);
web1.setWebViewClient(new myWebClient());
web1.getSettings().setJavaScriptCanOpenWindowsAutomatically(true);
web1.getSettings().setJavaScriptEnabled(true);
//web1.getSettings().setJavaScriptEnabled(true);
//web1.setInitialScale(65);
web1.getSettings().setDefaultFontSize(18);
//web1.loadUrl(htmldata);
web1.setWebChromeClient(new WebChromeClient());
web1.getSettings().setPluginState(PluginState.ON_DEMAND);
web1.loadData(htmldata,"text/html; charset=utf-8",null);
@rhayen感谢这项工作,因为我需要它。但现在的问题是,我得到的是存储在我的字符串中的内容的URL,我在其他的HTML字符串中加载该字符串。所以我怎么能添加控件= 0与我的url链接的iframe存储在一个字符串变量。 – Daljeet 2014-10-08 15:19:05