Android – Play youtube video In App in android

androidyoutubeyoutube-api

In my android application I want to play youtube video in App, not in the default browser. I am trying this for the last some days. Previously I played the youtube video using the following code :
http://code.google.com/p/android-youtube-player/downloads/list

But now this code is not working. It shows "Sorry, this video cannot be played." I have tried all the possible solution mentioned in the different forum for this error. But could not be able to play the video.
That's why I am trying to find out another way to play the video in app. I have tried the RTSP link of a youtube video , it is playing the 3gp video file, but video quality is very poor. This is not acceptable.
I am really fade up to find out good solution to play youtube video in app.
Please help. Any good suggestion is always welcome.
Santanu

Best Answer

Playing YouTube videos in Android was made very simple with the release of this library: https://developers.google.com/youtube/android/player/. The Developer Guide on that page is a good resource on how to use this library. They also provide sample code on how to use the functionality provided by the library. The steps are basically:

  1. Get a developer key
  2. Download the library and include it in your project
  3. Use the library to play videos (hint. use the YouTubePlayerView as a first step)

Please post again if you have any questions or need any code examples.