2013-08-21 72 views
3

在我的应用程序中,我想单击某个特定按钮并跳转到YouTube应用程序并显示YouTube用户。例如http://www.youtube.com/user/punjabiradiousa。这怎么可能请建议一些技巧?如何通过Intent播放YouTube视频?

+0

[使用ACTION \ _VIEW调用YouTube应用程序意图大部分时间失败]的可能重复(http://stackoverflow.com/questions/2978963/calling-youtube-app-using-action-view-intent-failing-most时间) 如果YouTube应用提供该功能,则只能查看用户的个人资料。至于观看视频。您可以传递视频网址意图。请参阅链接 – 2013-08-21 08:07:56

+1

您可以参考http://stackoverflow.com/a/16514288/1131470 –

+0

我想在YouTube应用程序中打开它 – Navdroid

回答

1

此代码,我用来播放YouTube视频

Matcher matcher = Pattern.compile("http://www.youtube.com/embed/").matcher(mVideoId); 
matcher.find() 
Intent lVideoIntent = new Intent(
           null, 
           Uri.parse("ytv://" + mVideoId), 
           MainScreen.mContext, 
           com.kids.youtube.OpenYouTubePlayerActivity.class); 
           startActivity(lVideoIntent); 
0

其工作

startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("")));