Android的 - 如何的WebView播放YouTube视频? [英] Android - How to play Youtube video in WebView?

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

问题描述

我需要在web视图播放YouTube视频,但是当我加载的URL整个移动版YouTube页面加载。我想只有一名球员还是有办法嵌入在we​​b视图的视频,就像在IOS。可能吗?用iframe标签录像不加载,它说,发生了错误。 谢谢你。

I need to play youtube video in the webview,but when I load the URL the entire youtube mobile page is loaded. I want only a player or a way to embed the video in the webview, like in IOS. Is it possible? With the iframe tag the video doesn't load, it say that an error occurred. Thanks.

推荐答案

使用code在您的来源为web视图显示的嵌入式视频:

Use the Code to display an embedded Video in your Source for the WebView:

<iframe width="560" height="315" src="http://www.youtube.com/embed/...." frameborder="0" allowfullscreen></iframe>

您可以找到的URL SRC-标签,如果你到了YouTube网站,点击共享 - >嵌入。

但是,为什么你使用的WebView?在那里,你要玩视频在Flash。而Android VideoView也可以流YouTube视频。

You can find the URL for the src-Tag if you got to the Youtube Website and click on share -> embed.

But why do you use WebView? There you have to play the Videos in Flash. The Android VideoView can also stream Youtube Videos.

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

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