从URL中的Android播放YouTube视频 [英] Play youtube video from URL in android
问题描述
我想在我的应用程序中播放YouTube视频。我从SAX解析获得视频网址。我的问题是如何从URL中VideoView,而不是在网页视图或浏览器播放视频。
I want to play youtube video in my application. I am getting video URL from SAX Parsing. My question is how to play video from URL in VideoView, not in Webview or Browser.
我想这code:
Intent lVideoIntent = new Intent(null, Uri.parse("VIDEO URL"));
startActivity(lVideoIntent);
据显示与'互联网'和'的YouTube选项中的一个弹出式屏幕。我想直接在YouTube上播放视频。
It is displaying one popup screen with 'Internet' and 'YouTube' options. I want to play the video directly in youtube.
请让我知道你的想法。任何code或任何例子是高度AP preciated。
Please let me know your thoughts. Any code or any example is highly appreciated.
推荐答案
它显示一个弹出式屏幕,互联网和YouTube的
由于ACTION_VIEW意图无论是在默认浏览器和YouTube应用程序写入。这就是为什么每当抓到的URL打开浏览器,每当YouTube网址打开浏览器和YouTube应用。
because the ACTION_VIEW intent is written both in default browser and Youtube application. that's why whenever it catches the URL the Browser opens and whenever the Youtube URL is opened Both the browser and Youtube app.
我想直接在YouTube上播放视频
取的YouTube视频嵌入链接并设置意图将播放视频。
Take the embed link of Youtube video and set intent it will play the video.
例如: - http://www.youtube.com/embed/srMFb6zpx2Y
这篇关于从URL中的Android播放YouTube视频的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!