意图播放YouTube播放列表 [英] Intent to play YouTube playlist

查看:176
本文介绍了意图播放YouTube播放列表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想从我的应用程序启动的YouTube播放列表。

I would like to start YouTube playlist from my application.

有关单个视频,这是显而易见的。

For single video this is obvious

startActivity(new Intent(Intent.ACTION_VIEW, 
                         Uri.parse("http://www.youtube.com/watch?v=videoid")));

但我有问题的播放列表。当我把链接到播放列表它总是从它只能播放一个视频。

but I have problem with playlist. When I put link to playlist it always plays only one video from it.

推荐答案

要使用YouTube功能在您的应用程序的最佳方法是使用的为Android YouTube的API。你可以了解如何使用的YouTube API 从文档和示例应用程序。

The best way to use YouTube functionalities in your app is to use YouTube API for Android. You can find out how to use YouTube API from the documentation and the sample app.

如果您使用的YouTube API ,开始播放列表,你必须这样做你的活动:

If you use YouTube API, to start playlist you have to do this in your Activity:

String PLAYLIST_ID = "UCVHFbqXqoYvEWM1Ddxl0QDg";

//"this" is Context
Intent intent = YouTubeIntents.createPlayPlaylistIntent(this, PLAYLIST_ID);
startActivity(intent);

请参阅该方法的文档,<一个href="https://developers.google.com/youtube/android/player/reference/com/google/android/youtube/player/YouTubeIntents"相对=nofollow称号=YouTubeIntents>这里。

See the method's documentation here.

这篇关于意图播放YouTube播放列表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆