在android中播放来自youtube的视频文件 [英] play video file from youtube in android

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

问题描述

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

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

解决方案

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

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

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

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

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

To get Data in JSON format use this http://gdata.youtube.com/feeds/mobile/videos/"+videoid+"?alt=json

Refer these two links:

Link1

Link2

Once you get the rtsp link you can play it in VideoView

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

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