Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android Java Youtube API v3.0 get video RTSP link

I want to play youtube video on Surface, using MediaPlayer.
So, I should put there direct video link.
Problem is: How to get this link on Android device?

Link like this: http://gdata.youtube.com/feeds/api/videos/VIDEO_ID
Is no longer available. Probably because of old and deprecated API v2.0.
But this web service somehow do the trick.
And result link works perfect. So it is still possible.

like image 578
Volodymyr Kulyk Avatar asked Jul 24 '15 08:07

Volodymyr Kulyk


1 Answers

Try with this url

String ytInfoUrl="http://www.youtube.com/get_video_info?video_id=" + youtubeID + "&eurl="
                + URLEncoder.encode("https://youtube.googleapis.com/v/" + youtubeID, "UTF-8");

Open this using a HttpGet extract the RTSP urls from that info response.

edit

You can use this link for extracting the RTSP links https://github.com/flipstudio/YouTubeExtractor/blob/master/src/main/java/com/flipstudio/youtube/extractor/YouTubeExtractor.java

edit

A lot have been changed please use this project for proper extraction https://github.com/HaarigerHarald/android-youtubeExtractor/blob/master/youtubeExtractor/src/main/java/at/huber/youtubeExtractor/YouTubeExtractor.java

like image 149
sunil sunny Avatar answered Nov 16 '22 11:11

sunil sunny