【问题标题】:Cannot play video inside WebView using iframe tag?无法使用 iframe 标签在 WebView 内播放视频?
【发布时间】:2011-07-01 10:46:47
【问题描述】:

我正在使用以下数据在WebView 中显示。这些是 HTML 标签以及 引用视频的 iframe。

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

我可以在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

【问题讨论】:

  • 您使用哪种方法在 webview 中加载此字符串?

标签: android iframe webview


【解决方案1】:

关键是启用浏览器插件。

// 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);
    

    使用此代码加载您的视频并更新您设备的 flashplayer...

    【讨论】:

    • 是的,有点工作,只是从我看的地方看起来很糟糕:)
    猜你喜欢
    • 2013-10-02
    • 1970-01-01
    • 1970-01-01
    • 2012-08-18
    • 2013-03-31
    • 2014-11-26
    • 2012-08-05
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多