问题
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.
回答1:
Check whether you are passing same url throughout the play list (http://www.youtube.com/watch?v=videoid). check for the value of videoid whether it is same.
回答2:
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.
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);
See the method's documentation here.
来源:https://stackoverflow.com/questions/8489306/intent-to-play-youtube-playlist