title: Youtube API - not loading if the user in not in the tab (FireFox)
body: <p>I´ve been messing around with the youtube API for a while now.
  I´m currently making a website where users can create custom playlists from different sources (youtube, soundcloud,...).</p>
  <p>After one video is finished it checks on the go to the url with the next video.</p>
  <p>The problem is that when you are in another tab than the one where the video plays and the next video loads, the API won´t load.</p>
  <p>The only way to avoid this is by opening the link in a own browser.
  (I use firefox btw)</p>
  <p>It works with Internet Explorer though!
  For the html part: I use the standard Iframe code
  API:</p>
  <blockquote>
  <pre><code>&lt;script&gt;
  var player;
  function onYouTubePlayerAPIReady() {
      player = new YT.Player('player', {
        height: '390',
        width: '640',
        videoId: '&lt;?php echo $link; ?&gt;',
        events: {           
        'onReady': onPlayerReady,           
        'onStateChange': onPlayerStateChange
     }
  }
  </code></pre>
  <p>function onPlayerReady(event) {</p>
  <pre><code>        event.target.playVideo();
      }
  </code></pre>
  <p>function onPlayerStateChange(event) {</p>
  <pre><code>   console.log('State is:', &gt;event.data);         
     if(event.data === 0) {
        
    window.location=&quot;link&quot;;             
     }          
  </code></pre>
  <p>}</p>
  
  </blockquote>