I am writing an application to play YouTube videos using streaming.
First method:
I get the RTSP URL for the video using the GData APIs. Here is the code for playing the RTSP URL.
VideoView mVideoView = new VideoView(this); setContentView(mVideoView); mVideoView.setVideoURI(Uri.parse("rtsp://rtsp2.youtube.com/CiILENy73wIaGQkDwpjrUxOWQBMYESARFEgGUgZ2aWRlb3MM/0/0/0/video.3gp")); mVideoView.start();
But this causes an error both on the G1 device and on the emulator (the emulator has some firewall problem according to the mailing list) Here is the error message
ERROR / PlayerDriver (35): PLAYER_INIT command completed with error or PVMFFailure information
Second method:
Hack the way to get a 3gp file from http://www.youtube.com/get_video?v= & t = <> & <>. After getting the file path, I can call setVideoURI and it plays well. But this is a way to crack this requirement. I also tested the Youtube app, it also does a way of hacking the game youtube url (verified with logcat)
I tried switching from VideoView to MediaPlayer, but no change in error.
Is there a "clean" way to do this?
Please let me know your thoughts.
android youtube videoview streaming android-mediaplayer
Vinay Jun 17 '09 at 15:16 2009-06-17 15:16
source share