0

我试图在 Android 应用程序的 VideoView 中播放视频。问题是我如何从 youtube 获取正确的视频链接,而不仅仅是网页?

setContentView(R.layout.videopopup);
VideoView vv = (VideoView)findViewById(R.id.videoElem);

MediaController mc = new MediaController(this);
mc.setEnabled(true);
mc.show(0);
vv.setMediaController(mc); 
vv.setVideoURI(Uri.parse("http://www.youtube.com/v/oFL2rszPmmU?version=3&feature=player_detailpage"));
vv.requestFocus();
vv.showContextMenu();
vv.start();  

在此链接中:视频视图未播放 youtube 视频

Evgeny Nacu 解释了它应该是哪个链接,但没有解释如何从给定的 youtube 页面检索它。

4

1 回答 1

0

使用默认 youtube 应用播放视频的简单方法:

startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(your youtube url);

Youtube 应用程序将做一切。你不需要做任何事情。

如果这不能解决,请在代码中使用 webview 而不是 videoview

于 2012-06-20T09:25:32.920 回答