2011-07-01 47 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