Since I don’t have a flash player to play the video from Youtube itself, I need to play it in my default MediaPlayer. The code I used is as follows:
MediaController mc = new MediaController(ctx);
setContentView(R.layout.main);
vv = (VideoView) findViewById(R.id.VideoView01);
try {
ur = Uri.parse(Url /*+ "&fmt=18"*/); // "&fmt=18"to convert to mp4
System.out.println("Host = " + ur.getHost());
System.out.println("Encoded Path = " + ur.getEncodedPath());
vv.setVideoURI(ur);
// vv.setVideoPath("http://www.daily3gp.com/vids/747.3gp");
vv.setMediaController(mc);
vv.requestFocus();
vv.start();
mc.show();
} catch (Exception ex) {
System.out.println("Exception!!!!!!!!!!!!!!!! "
+ ex.getMessage());
}
The thing is….It is getting the link and when we give the link to the player, it say’s This Video cannot be Played…..
Please help !!!!!!!!!!!!
Atfirst, the URL that I gave for download was incorrect. Now, it is working…