I am developing an android application which requires a youtube video player embedded within it. I successfully got the RTSP video URL from the API, but while trying to load
It depends on which Video codec format you are recieving your rtsp. There are certain devices which do not support running .mp4 file. Go through Android Media support for more information. Check if you can play any other .3gp files or not.
Using Video View:
1.Code in the layout xml:
<VideoView
android:layout_width=”wrap_content”
android:layout_height=”wrap_content”
android:id=”@+id/YoutubeVideoView” />
2.Code in java class:
VideoView v = (VideoView) findViewById(R.id.YoutubeVideoView);
v.setVideoURI(Uri.parse(“rtsp://v4.cache3.c.youtube.com/CjYLENy73wIaLQlW_ji2apr6AxMYDSANFEIJbXYtZ29vZ2xlSARSBXdhdGNoYOr_86Xm06e5UAw=/0/0/0/video.3gp”));
v.setMediaController(new MediaController(this)); //sets MediaController in the video view
// MediaController containing controls for a MediaPlayer
v.requestFocus();//give focus to a specific view
v.start();//starts the video
We set the VideoUri by specifying the 3gp link of Youtube video for mobile platforms. To add media controls such as Play, Pause, Rewind, Fast Forward and a progress slider ,we add MediaController to the VideoView.
uri.parse( 3gp link of the video )...you can get this from youtube