在web视图播放YouTube视频 [英] play youtube video in WebView

查看:173
本文介绍了在web视图播放YouTube视频的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的Andr​​oid应用程序,我有一个web视图从我们的网站上显示HTML数据。有时,页面将YouTube的嵌入对象。这并不在该应用正确显示。有什么办法来显示/ web视图中播放YouTube视频?谢谢你。

In my android app I have a WebView to display html data from our website. Sometimes the page will have youtube embed objects. This doesn't show up properly in the app. Is there any way to show/play youtube videos in WebView ? Thanks.

推荐答案

您不能向他们展示嵌入式或许除了在具有闪存器件。

You cannot show them embedded except perhaps on devices that have Flash.

不过,如果你能解析出的YouTube视频的详细信息,您可以构建一个 ACTION_VIEW 意图这将显示他们在YouTube应用程序......对于那些拥有YouTube的应用程序的Andr​​oid设备。

However, if you can parse out the YouTube video details, you may be able to construct an ACTION_VIEW Intent that will show them on the YouTube application...for those Android devices that have the YouTube application.

您还可能尝试HTML5的<视频> 标签,这AFAIK支持在浏览器应用程序,因此可以在工作的WebView

You might also experiment with HTML5's <video> tag, which AFAIK is supported in the Browser application and may therefore work in WebView.

这篇关于在web视图播放YouTube视频的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆