视频观看不玩YouTube视频 [英] Video View not playing youtube video
问题描述
我想在视频查看播放YouTube的视频。
I am trying to play a youtube video in a Video View.
我已经奠定了这样的XML:
I have laid out the xml like this:
<VideoView
android:id="@+id/VideoView"
android:layout_height="fill_parent"
android:layout_width="fill_parent"
/>
和code是这样的:
and the code is like this:
setContentView(R.layout.webview);
VideoView vv = (VideoView) findViewById(R.id.VideoView);
MediaController mc=new MediaController(this);
mc.setEnabled(true);
mc.show(0);
vv.setMediaController(mc);
vv.setVideoURI(Uri.parse("http://www.youtube.com/watch?v=XS998HaGk9M"));
vv.requestFocus();
vv.showContextMenu();
vv.start();
我已经加入清单内的权限。当我加载该应用程序会出现一个对话框,说明该视频无法播放。
I have added the permission within the manifest. When I load the application a dialog appears stating the video cannot be played.
我会AP preciate有这方面的建议。谢谢
I would appreciate any advice on this. Thanks
推荐答案
虽然没有一个明确的答案,我相信你需要启动一个YouTube网址的意图,并让操作系统处理它。也就是说,我不认为你可以直接嵌入YouTube视频到你的活动,虽然我很乐意被证明是错误的。
While not an explicit answer I believe you need to launch an intent with a YouTube URL and let the OS handle it. That is, I don't think you can embed YouTube videos directly into your activities though I would love to be proven wrong.
这篇关于视频观看不玩YouTube视频的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!