3

I'm playing YouTube from URL, but when I play the video it shows the following error:

unable to open video

I'm using this code:

video =new VideoView(this);
video.setVideoURI(path);

System.out.println("my path"+path);

ctlr = new MediaController(this);
ctlr.setMediaPlayer(video);
video.setMediaController(ctlr);
video.requestFocus();`

The path is correct. I checked on the Web also. Why am I getting an error like that?

The links are like: http://www.youtube.com/v/8B-Vu94Sd4M?f=videos&app=youtube_gdata

Bill the Lizard
  • 398,270
  • 210
  • 566
  • 880
Uday
  • 5,933
  • 9
  • 44
  • 76

1 Answers1

2

You can't simply give the VideoView a Youtube URL and expect it to play the video. This seams to be impossible at all (see here).

However, you might want to use a YouTube Intent and let the System handle it: Link

Community
  • 1
  • 1
Lukas Knuth
  • 25,449
  • 15
  • 83
  • 111
  • I wanna customize my screen so that it plays youtube video file and some widgets around. Is this possible? – Uday Jun 28 '11 at 14:47
  • As I see it from the linked threads above, it doesn't seam so. If it is, the [YouTube API Documentation](http://code.google.com/apis/youtube/overview.html) might be the right place to look for it. – Lukas Knuth Jun 28 '11 at 14:56