title: How to play the videos of a youtube playlist in loop?
body: <p>I am playing a Youtube playlist using the youtube api. But while playing the last video of the playlist the player doesn't play first video.</p>
  
  <p>I have googled a lot around and also check for all the youtube api but couldn't find any solution.</p>
  
  <p>I'm using <strong>YouTubePlayerSupportFragment</strong> to play the video playlist. How can i set the loop variable to enable the loop feature.</p>
  
  <pre><code>@Override
  public void onInitializationSuccess(Provider provider, YouTubePlayer player, boolean wasRestored) {
  
      mplayer = player;
      final class MyPlaylistEventListener implements PlaylistEventListener{
  
          @Override
          public void onNext() {
              // TODO Auto-generated method stub
          }
  
          @Override
          public void onPlaylistEnded() {
  
          }
  
          @Override
          public void onPrevious() {
              // TODO Auto-generated method stub
  
          }  
      }
  
      MyPlayerStateChangeListener myPlayerStateChangeListener = new MyPlayerStateChangeListener();
      MyPlaylistEventListener myPlaylistEventListener = new MyPlaylistEventListener();
      player.setPlayerStyle(YouTubePlayer.PlayerStyle.DEFAULT);
      player.setPlayerStateChangeListener(myPlayerStateChangeListener);
      player.setPlaylistEventListener(myPlaylistEventListener);
      player.addFullscreenControlFlag(YouTubePlayer.FULLSCREEN_FLAG_ALWAYS_FULLSCREEN_IN_LANDSCAPE);
      if (!wasRestored) {
          player.loadPlaylist("playlistID", videoIndex, 0);
      }
  }`
  </code></pre>
  
  <p>Thanks in advance.</p>