0

I want to get YouTube Videos in Android VideoView for my application. I am going through the Google's YouTube API. I have generated the Client ID,Client Secret,redirect-URL and code by the help of this API Documentation. https://developers.google.com/youtube/2.0/developers_guide_protocol#OAuth2_Installed_Applications_Flow

Next step is to get Access Token for Installed Applications, I am doing the same as the above Doc is explaining but getting this error.

java.io.FileNotFoundException: https://accounts.google.com/o/oauth2/token?code=4/sfsekiMy-EWE_7der69fy3wsdfdsseclient_id=412600012302.apps.googleusercontent.com&client_secret=0P7H4yqRZY2jmpluiyswqnbz&redirect_uri=http://localhost/oauth2callback&grant_type=authorization_code

Any help is highly appreciated OR you can suggest some way to access YouTube video in my Android App using only MediaPlayer and VideoView.

Thanks in advance.

Trikaldarshiii
  • 11,174
  • 16
  • 67
  • 95
aalionline
  • 448
  • 2
  • 6
  • 21

1 Answers1

1

Try this thread How to play YouTube video in my Android application?

Steps:

a. Create a new Activity, for your player(fullscreen) screen with menu options. Run the mediaplayer and UI in different threads.

b. For playing media - In general to play audio/video there is mediaplayer api in android. FILE_PATH is the path of file - may be url(youtube) stream or local file path

MediaPlayer mp = new MediaPlayer();
mp.setDataSource(FILE_PATH);
mp.prepare();
mp.start();
Community
  • 1
  • 1
Soham
  • 4,940
  • 3
  • 31
  • 48
  • Soham: This work for rtsp (Real Time Streaming protocol) only as i already tested this ..... But the Youtube videos we view in Web doesn't contain rtsp urls, than how to get rtsp url for each and every video on runtime. – aalionline Mar 07 '12 at 08:45
  • Maybe this will help: http://stackoverflow.com/questions/7937903/get-rtsp-url-from-youtube – Soham Mar 07 '12 at 08:53