I am developing a youtube player in android. I am getting the rtsp video correct url. But still the video is not playing. Please help to me to find a solution.
Thank
Here is another working code
MainActivity.java
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_video_view);
VideoView videoView =(VideoView)findViewById(R.id.videoView);
MediaController mediaController= new MediaController(this);
mediaController.setAnchorView(videoView);
Uri uri=Uri.parse("rtsp://r2---sn-a5m7zu76.c.youtube.com/Ck0LENy73wIaRAnTmlo5oUgpQhMYESARFEgGUg5yZWNvbW1lbmRhdGlvbnIhAWL2kyn64K6aQtkZVJdTxRoO88HsQjpE1a8d1GxQnGDmDA==/0/0/0/video.3gp");
videoView.setMediaController(mediaController);
videoView.setVideoURI(uri);
videoView.requestFocus();
videoView.start();
}
activity_video_view.xml
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<VideoView android:id="@+id/videoView"
android:layout_height="fill_parent"
android:layout_width="fill_parent"/>
</LinearLayout>
You can't do that. Use YouTubeAndroidApi for playing YouTube videos.
There might be many reasons to not play the video,You can test it on other devices also set android:hardwareAccelerated="true" in manifest
try following listeners to get correct issue
playerview.setOnPreparedListener(preparelistener);
playerview.setOnErrorListener(errorlistenr);
playerview.setOnCompletionListener(completelistener);