Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Issue on Android Video View its not working

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

like image 290
Udaykiran Avatar asked Mar 22 '26 19:03

Udaykiran


1 Answers

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

like image 125
Lukas Knuth Avatar answered Mar 25 '26 09:03

Lukas Knuth



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!