title: getPlaylist returns an array with only one video when using the Youtube IFrame API
body: <p>I'm trying to make a webpage that will load a given Youtube playlist and play a random video from it.</p>
  
  <p>I'm struggling getting the playlist information from the API as when I run</p>
  
  <pre><code>player.getPlaylist()
  </code></pre>
  
  <p>the API returns an array of one element (the currently cued video) every time, regardless of the cued video or playlist.
  My JavaScript is an almost 100% copy/paste from the API documentation and I can't work out why I can't get the full list of videos in the playlist.</p>
  
  <pre><code>&lt;script&gt;
  
    var tag = document.createElement('script');
  
    tag.src = "https://www.youtube.com/iframe_api";
    var firstScriptTag = document.getElementsByTagName('script')[0];
    firstScriptTag.parentNode
      .insertBefore(tag, firstScriptTag);
  
    var player;
    function onYouTubeIframeAPIReady() {
      player = new YT.Player('player', {
        height: '390',
        width: '640',
        playerVars: {
          listType: 'playlist',
          list: 'PLbIZ6k-SE9SiarIg09JXUdK2kDX5_OB25',
          autoplay: 0,
          controls: 1
        },
        events: {
          'onReady': onPlayerReady,
          'onStateChange': onPlayerStateChange
        }
      });
    }
  
    function onPlayerReady(event) {
      console.log(event.target.getPlaylist());
    }
  
    var done = false;
    function onPlayerStateChange(event) {
      if (event.data == YT.PlayerState.ENDED &amp;&amp; !done) {
        done = true;
        console.log('Video Finished');
        stopVideo();
      }
    }
    function stopVideo() {
      player.stopVideo();
    }
  &lt;/script&gt;
  </code></pre>
  
  <p>Can anybody lend a hand and point to my mistake or in the right direction?</p>