Youtube Streaming Video

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.

+28
android youtube videoview streaming android-mediaplayer
Jun 17 '09 at 15:16
source share
8 answers

If you are ready to do the work in a new action, the following will not work on the device:

startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("http://www.youtube.com/watch?v=cxLG2wtE7TM")));

+2
Aug 21 '09 at 2:29
source share
β€” -

Sometimes Uri.parse returns "null" because can not parse the rtsp protocol instead of the http protocol.

Check it out with Log logat Uri.parse(rtspURL).toString() and you won't see anything. or just do Log.d("tag", Uri.parse); , and the same will be returned.

Try to find another way to parse (create) Uri.

I would try with this and run:

 String urlVideo = <your rtspURL> VideoView video = (VideoView)findViewById(R.id.VideoView01); Log.d(tag , urlVideo); video.setVideoURI(Uri.parse(urlVideo)); MediaController mc = new MediaController(this); video.setMediaController(mc); video.requestFocus(); video.start(); mc.show(); 
+2
May 28 '10 at 10:45
source share

I am impressed that the dirty way works at all! If you have a working solution, go with it. I don’t think there is a clean way to get the RTSP stream working in the SDK.

+1
Jun 17 '09 at 19:45
source share

we faced a very similar problem.

At the moment I am at the first stage of my project, and I am trying to make the video review just working. I take the data from here: http://gdata.youtube.com/demo/ and I am testing all the links to the video.

RTSP 3GP video is really really really low quality video .... and there is no way to access mp4 video (good quality). I really don't know how to make it work, because I think MP4 streams are only available to premium developers ....

+1
Apr 28 '12 at 10:25
source share

Take a look at the Youtube API

I think this also uses the youtube app (which you don't want)

But just contact, maybe you will find a key to solve it.

+1
Jan 07 '13 at 9:12
source share

I was showing a YouTube video with the following code. I hope this is helpful, but let me know how this can be improved.

 @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("http://www.youtube.com/watch?v=..."))); } public void onPrepared(MediaPlayer mp) { // TODO Auto-generated method stub } 
0
Jun 18 2018-11-18T00:
source share

The title on the video indicates that it works for Android. So, try good video calling for experimentation. Here is one of them that I use:

RTSP: //184.72.239.149/vod/mp4: BigBuckBunny_115k.mov

I work great on Nexus and Samsung tablets.

0
Jul 02 '14 at 20:53 on
source share

Do you have internet access? if not, add internet permission to manifest file

  <uses-permission android:name="android.permission.INTERNET" /> 

and also try these URIs:

 rtsp://184.72.239.149/vod/mp4:BigBuckBunny_175k.mov http://www.wowza.com/_h264/BigBuckBunny_175k.mov 
0
Dec 31 '15 at 18:49
source share



All Articles