2011-12-13 146 views
2

我想從我的應用程序啓動YouTube播放列表。意圖播放YouTube播放列表

對於單個視頻,這是顯而易見的

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

,但我有問題,播放列表。當我把鏈接放到播放列表時,它總是隻播放一個視頻。

回答

0

檢查您是否在整個播放列表中傳遞相同的網址(http://www.youtube.com/watch?v=videoid)。檢查videoid的值是否相同。

+0

我通過播放列表「http://www.youtube.com/watch?v = first-video-id&list = playlist-id&feature = plpp_play_all」的以下鏈接,它可以在瀏覽器中使用。 – bimbol

0

在您的應用中使用YouTube功能的最佳方式是使用YouTube API for Android。您可以從文檔和示例應用程序中瞭解如何使用YouTube API

如果使用的YouTube API,開始播放,你必須這樣做在你的活動:

String PLAYLIST_ID = "UCVHFbqXqoYvEWM1Ddxl0QDg"; 

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

查看方法的文檔here

相關問題