Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
323 views
in Technique[技术] by (71.8m points)

play video file from youtube in android

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.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

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


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...