2011-07-01 112 views
5

我正在使用以下数据在WebView中显示。这些是HTML标签以及涉及视频的iframe。无法使用iframe标签在WebView内播放视频?

现在的问题是,当我点击它,它显示播放按钮,但无法播放视频。

我可以在WebView以内播放此视频吗?

<p></p><P> because of Jon’s pro-growth, business-friendly policies, Utah's economy expanded at more than triple the national rate and was named the best state for business by <EM>Forbes.</em><BR /><BR /><IFRAME height=241 src="http://player.vimeo.com/video/25349114" frameBorder=0 width=425></iframe></p><br /> 

<P>America needs a dose of the same medicine. Today, our nation has the second highest corporate tax rate in the developed world. We have convoluted and confusing regulations. 
<!--break--><!--break--><p></p> 

当我尝试在android浏览器中运行此url时,它会打开videoview并完美播放该文件,但为何不在iframe中? http://player.vimeo.com/video/25349114

+0

哪种方法您使用的是加载此字符串中的WebView? – dhuma1981

回答

3

最关键的事情是让浏览器插件。

// how to enable the webview plugin changed in API 8 
if (Build.VERSION.SDK_INT < 8) { 
    mWebView.getSettings().setPluginsEnabled(true); 
} else { 
    mWebView.getSettings().setPluginState(PluginState.ON); 
} 

另外值得一检查flash player is installed

2
WebView wv; 
wv = (WebView) findViewById(R.id.mywebview); 

wv.getSettings().setJavaScriptEnabled(true); 
wv.getSettings().setBuiltInZoomControls(true); 
wv.getSettings().setPluginsEnabled(true); 

使用此代码加载视频,并更新设备的flash播放器...

+0

你有点不舒服,从我看的地方看起来很糟糕:) – Warpzit