从YouTube在Android的播放视频文件 [英] play video file from youtube in android

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

问题描述

我按照有关如何使用YouTube GDATA的教程。填充来自YouTube的视频列表视图和的onclick从<一个href="http://stackoverflow.com/questions/10503187/youtube-intent-starts-in-browser-android">stackoverflow

I have followed a tutorial on how to use the youtube gdata. Populating a listview with videos from youtube and a onclick from stackoverflow

但还是在YouTube上的视频播放里面没有我的申请。请帮我找到这个。

But still video play on youtube not inside my application. Please help me to find this.

推荐答案

一旦你得到了你管网址...,从Url.See子串VIDEO_ID下面的例子中我已经给了。

Once you get the You tube url..., Substring the Video_ID from the Url.See the example below i have given.

您可以使用<一个href="http://gdata.youtube.com/feeds/mobile/videos/VIDEO_ID">http://gdata.youtube.com/feeds/mobile/videos/VIDEO_ID API从实际你管url.data为在 XML格式的rtsp链接

You can use http://gdata.youtube.com/feeds/mobile/videos/VIDEO_ID api to get the rtsp link from the actual you tube url.Data is in XML format

一旦你的rtsp链接,你可以在VideoView的这里是的例子

once you get the rtsp link you can play video in VideoView here is the example

例如:   如果这个环节是视频 http://www.youtube.com/watch?v=sMM0R19IisI

For example: If this link is the video http://www.youtube.com/watch?v=sMM0R19IisI

然后 sMM0R19IisI 是Video_ID.So你可以通过这个视频ID上面API来获取rtsp链接

Then sMM0R19IisI is the Video_ID.So you can pass this video id to above api to get the rtsp link

要取得 JSON格式的数据使用<一个href="http://gdata.youtube.com/feeds/mobile/videos/%22+videoid%5Bi%5D+%22?alt=json">http://gdata.youtube.com/feeds/mobile/videos/"+videoid+"?alt=json

请参考以下两个链接:

链接1

链路2

在你在 VideoView

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

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