使用 Eclipse 将 YouTube 视频嵌入到 Android 应用程序中?

2024-05-05

我正在尝试找出如何使用 eclipse 将 youtube 视频嵌入到 android 中。我更喜欢使用 chromeless 播放器,但目前没有必要。

任何有关如何执行此操作的帮助将不胜感激。


嵌入 Youtube 视频的最简单方法是使用意图来触发 Youtube 应用程序,如下所示:

String video_path = "http://www.youtube.com/watch?v=opZ69P-0Jbc";
Uri uri = Uri.parse(video_path);

// With this line the Youtube application, if installed, will launch immediately.
// Without it you will be prompted with a list of the application to choose.
uri = Uri.parse("vnd.youtube:"  + uri.getQueryParameter("v"));

Intent intent = new Intent(Intent.ACTION_VIEW, uri);
startActivity(intent);
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

使用 Eclipse 将 YouTube 视频嵌入到 Android 应用程序中? 的相关文章

随机推荐