I am trying to play Youtube video's directly with in my applications in Android. If we give the direct links of the youtube like https://www.youtube.com/watch?v=HnbMYzdjuBs then the device displaying different applications that can open that link after clciking the video icon. If i use https://gdata.youtube.com/feeds/api/videos?q=flowers to fetch the links from Youtube XML services, the RTSP links are working perfectly with in the application but the quality is too bad.
How to fix this issue?
One more question is, i want to play a live video from Youtube. We have a youtube webservice to fetch the links(1,5,6 video types) of a specific vedio ID. We can use the below link to fetch the RTSP link for normal videos http://gdata.youtube.com/feeds/mobile/videos/ll4SoSJgLfI. Which is not working for Live Videos in Youtube. i am not getting the tag media-content. How to show the live streaming video from youtube on android devices ?
Related
What is the best way to play a Youtube Video in my Android app ? I want to play the video in my app, and not in youtube's app.
I make some search with the VideoView, but it seems that it's obsolete now...
Have you some examples ?
Thanks
Download the Youtube Api Demo App, it shows how to use the Youtube Player API and the different ways to reproduce videos (using a YouTubePlayerView, using YoutubePlayerFragment, etc). However, it only shows how to display a video when you already know the id of the video.
If you want to search for a video and then display it. Then you need to learn how to use the Youtube Data Api. Here is an example of a request which returns a JSON response (just click "execute").
To use the Data Api from Android, you can use an HttpURLConnection object, or use the Youtube Data Api Client Library, that's up to you.
Once you have retrieved the video's data from the Youtube Data Api. Use the Youtube Player Api to display the videos.
I'm building an application in which i want to search for videos related to a keyword like "World Cup 2014". and then a GridView showing the videos appears (Like in Search Result Screen) and when user clicks on any video(gridview item), particular video plays in next screen(Video Playing Screen).
Please suggest can I search using Youtube Android Player API? Or I will have to use Youtube Data API before playing the video using Youtube Android Player API?
Thanks in advance.
You may check this open source code, maybe it will help you understand how to search/play video. It's using JSON.
https://github.com/youtube/api-samples/blob/master/java/src/main/java/com/google/api/services/samples/youtube/cmdline/data/Search.java
I have a website which contains some videos (all videos are uploaded on youtube). Now i want to make an android app for retrieving/watching videos from this site (like youtube). So, which kind of layout I should use for video objects? Can these videos be displayed same like on youtube?
Please give me some suggestions.
Thank you!
yes you can, you have to work with youtube api for android so you can play the videos via youtube player here youtube and you can download all of your videos using a web service so you can access to your videos, you can you list view to show your videos, and you also can use custom list layout to make it more interested
I want to know how to display a youtube video in a VideoView :
and the source is any youtube URL ??
You can use YouTube Android Player API to embed a YouTube video into your own app, they have sample app so it shouldn't be too difficult if you follow their steps.
You can easily display any YouTube Video directly in your app using YouTube API from Google. Check this link:
https://developers.google.com/youtube/v3/?hl=it
Here you can find sample applications too:
https://developers.google.com/youtube/android/player/sample-applications
I did google about this question and I found 4 possible ways to do it:
play the video with the following manner:
startActivity(newIntent(Intent.ACTION_VIEW,Uri.parse(uri)));
Get the RTSP link and play the video with VideoView
play the video using Flash
Using HTML5 iframe
I have an android 4.0 device and I am able to play YouTube videos using the first three methods. My question is: which method is the most adaptable to different version. If the answer is using HTML5, how can I do it. Thank you very much for your time.
The most allround way of doing it to open it with a URI parse. There is also a way of forcing the YouTube app to be called(sorry I think I read it someplace but I do not remember how) and show the video there. This means you do not get the option to chose to open the video in the browser.
The rest of the alternatives are only supported by some devices. (Flash is outdated, HTML5 is not supported on most devices). I you are going to do something else then using the buildt-in YouTube app I would recomend RTSP as the best option.