如何加载Android中的WebView YouTube网站? [英] How to load youtube website in Android WebView?

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

问题描述

我有一个非常简单的WebView的实现,它运作良好,在几乎所有的网站,但是当涉及到​​YouTube,我可以加载主页,视频页面,但是当我点击播放按钮(在页面上m.youtube.com /指数desktop_uri =%2F&放大器;?GL = US#/手表v = XXXXXX),视频闪光灯,但不玩了。我的Andr​​oid版本为2.3。

I have a very simple WebView implementation, it works well in almost all websites, but when it comes to youtube, I can load the home page, video page, but when I click play button (on page m.youtube.com/index?desktop_uri=%2F&gl=US#/watch?v=xxxxxx), the video flash but does not play. My android version is 2.3.

推荐答案

先更新您的Flash播放器....

first update your flash player ....

有关许可,第二次检查就像你给互联网或者未androidMenifest文件

second check for permission like you have given for internet or not in androidMenifest file

第三

我不知道为什么,但webviewclient类导致的问题,我们可以在默认浏览器中运行它删除webviewclient类simly加载YouTube上的网址,你将能够在2.2,2.3运行

i dont know why but webviewclient class causes the problem , we can run it in default browser remove the webviewclient class and simly load the url of youtube you will be able to run it on 2.2,2.3

    w=(WebView)findViewById(R.id.webview);
    w.getSettings().setJavaScriptEnabled(true);
    w.getSettings().setPluginsEnabled(true);
    w.loadUrl("http://www.youtube.com");

2.1只需添加这一点,使用意图,通过解析方法打开它通过默认安装的YouTube应用

for 2.1 just add this, use intent and through parse method open it through default installed youtube application

startActivity(新意图(Intent.ACTION_VIEW,Uri.parse(http://www.youtube.com/v/%s)))); }

startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("http://www.youtube.com/v/%s")))); }

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

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