Monday, July 1, 2013

Load specified YouTube playlist

To load specified YouTube playlist in YouTube Android Player, simple call cuePlaylist(PlayList_ID) method of YouTubePlayer object, instead of cueVideo(VIDEO_ID) method.

Load specified YouTube playlist

Modify onInitializationSuccess(Provider provider, YouTubePlayer player, boolean wasRestored) method in from last exercise "Example to use YouTubePlayerFragment of YouTube Android Player API".

 public static final String PlayList_ID = "PLP7qPet500dfglA7FFTxBmB_snxCaMHDJ";

 public void onInitializationSuccess(Provider provider, YouTubePlayer player,
   boolean wasRestored) {
  youTubePlayer = player;
  if (!wasRestored) {


download filesDownload the files.

Download APK to try on your device.

The tutorial: YouTube Android Player API step-by-step


Thiago Pacheco said...

how can I display all the videos in a PLAYLIST_ID LISTVIEW?

Sophie Marry said...

Hi Thank you so much for sharing this useful stuff, I am working on it to get full benefit of playing Youtube Playlist, I just want to refresh Youtube player view with the one (youtube video) I have tapped in a List, but whenever I do tap on any of the list item not able to reload youtube video with tapped one.

So How can I change Youtube Video in a Youtube Player, I have written complete code, please visit: