显示来自url android的视频

我有这个视频:http://www.youtube.com/v/oyB5QWcPSRo?version=3&f=user_uploads&app=youtube_gdata,我需要它在我的应用程序中播放,我已经使用videoView测试失败:有错误消息“无法播放视频”

MediaController mc = new MediaController(this);
mc.setAnchorView(vidYout);
mc.setMediaPlayer(vidYout);
Log.v("TAG","URL: "+YoutubeVO.url_video);
Uri video = Uri.parse("devimages.apple.com/iphone/samples/bipbop/gear1/prog_index.m3u8");
//Uri video = Uri.parse(YoutubeVO.url_video);
vidYout.setMediaController(mc);
vidYout.setVideoURI(video);
vidYout.requestFocus();
vidYout.start();

我试图更改URL,如果问题出在视频中,但不是.
我也试过使用webView失败了

wvComunicado.getSettings().setLoadWithOverviewMode(true);
wvComunicado.getSettings().setUseWideViewPort(true);
wvComunicado.loadData(YoutubeVO.url_video, "text/html" , "UTF-8");

关于如何玩它的任何想法?

谢谢!

最佳答案
添加requestFocus()方法:

MediaController mc = new MediaController(this);
mc.setAnchorView(vidYout);
mc.setMediaPlayer(vidYout);
Log.v("TAG","URL: "+YoutubeVO.url_video);
Uri video = Uri.parse("http://devimages.apple.com/iphone/samples/bipbop/gear1/prog_index.m3u8");
// Uri video = Uri.parse(YoutubeVO.url_video);
vidYout.setMediaController(mc);
vidYout.setVideoURI(video);
vidYout.requestFocus();
vidYout.start();

这对我有用:

String path = "http://devimages.apple.com/iphone/samples/bipbop/gear1/prog_index.m3u8";
video.setVideoURI(Uri.parse(path));

mediaController = new MediaController(this);
mediaController.setMediaPlayer(video);
video.setMediaController(mediaController);
video.requestFocus();
video.start();

转载注明原文:显示来自url android的视频 - 代码日志