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.
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With