I am trying to play youtube video within video view but getting error(can't play this video) all the time(on device as well as on emulator too). Please help me with this problem. Thanks in advance.
import android.app.Activity;
import android.net.Uri;
import android.os.Bundle;
import android.widget.VideoView;
public class AndroidVideoView extends Activity {
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
VideoView myVideoView = (VideoView) findViewById(R.id.videoview);
String viewSource = "rtsp://v2.cache8.c.youtube.com/CjYLENy73wIaLQndUnGVjs340xMYDSANFEIJbXYtZ29vZ2xlSARSBXdhdGNoYJP8mrqSz625UAw=/0/0/0/video.3gp";
myVideoView.setVideoURI(Uri.parse(viewSource));
myVideoView.requestFocus();
myVideoView.start();
}
}
1) Videos will not buffer on emulator because it is virtual device. In-order stream video you should use real device
2) you must provide this permission because with out internet connection we will not able to connect with YouTube server
3)Please validate your RTSP link. Given below is my rtsp link for my YouTube video
To generate rtsp link Use this
In my case
Video Id
issMM0R19IisI
My Code
LAYOUT XML