播放YouTube视频在videoview [英] Playing youtube video in a videoview

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

问题描述

在我的应用程序有一个videoview,我想在that.For来播放YouTube视频,我试过很多方法,如

In my application I have a videoview and I want to play youtube videos in that.For that I tried lots of methods like

VideoView mVideoView = new VideoView(this);
setContentView(mVideoView);
mVideoView.setVideoURI(Uri.parse("rtsp://v3.cache7.c.youtube.com/CiILENy73wIaGQlOCTh0GvUeYRMYDSANFEgGUgZ2aWRlb3MM/0/0/0/video.3gp"));
mVideoView.start();

有关这个我收到

08-13 12:33:07.443: D/MediaPlayer(618): Couldn't open file on client side, trying server side
08-13 12:33:09.003: E/MediaPlayer(618): error (1, -2147483648)
08-13 12:33:09.003: E/MediaPlayer(618): Error (1,-2147483648)

然后我试图

VideoView mVideoView = new VideoView(this);
setContentView(mVideoView);
mVideoView.setVideoURI(Uri.parse("vnd.youtube:GDD0Brw-udk"));
mVideoView.start();

下面还我收到了同样的错误。

Here also I am getting the same error.

startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("http://www.youtube.com/watch?v=GDD0Brw-udk&feature=youtube_gdata_player")));

这让我的应用程序,并开始移动版YouTube,我无法控制。

This leaves my application, and starts the mobile youtube where I have no control.

我用另一种方法是

Intent lVideoIntent = new Intent(null, Uri.parse("http://www.youtube.com/get_video_info?&video_id=GDD0Brw-udk")
            , this, IntroVideoActivity.class);
startActivity(lVideoIntent); 

这也是不是为我工作。

我应该怎么do..Anyone帮我please..Thanx提前

What should I do..Anyone help me please..Thanx in advance

推荐答案

您code:

VideoView mVideoView = new VideoView(this);
setContentView(mVideoView);
mVideoView.setVideoURI(Uri.parse("rtsp://v3.cache7.c.youtube.com/CiILENy73wIaGQlOCTh0GvUeYRMYDSANFEgGUgZ2aWRlb3MM/0/0/0/video.3gp"));
mVideoView.start();

是罚款,将工作对我来说只是检查你的网址。

is fine and will work as for me just check your url.

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

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