title: YouTuve IFrame API trouble with playerVars
body: <p>I want to start my video at certain times of the day. This is 'script.js': </p>
  
  <pre><code>    var player;
  function createPlayer() {
      player=new YT.Player('main-block',{
          height:'400',
          width:'400',
          playerVars:{
              'rel':0,
              'controls':0,
              'showinfo':0,
              'disablekb':1,
              'modestbranding':1,
              'enablejsapi':1
          },
          videoId:'tgbNymZ7vqY',
          events:{
              'onReady':onPlayerReady
          }
      });
  }
  function onPlayerReady(event) {
          document.getElementById("timer").style.display='none';
          event.target.playVideo();
    }
  
  function clockPlayer(){
          var now = new Date();
          if (now.getHours()==20 &amp;&amp; now.getMinutes()==18){
              createPlayer();
          }else if(now.getHours()&lt;20){
              var time_hours = 19 - now.getHours();
              var time_min = 59 - now.getMinutes();
              var time_sec = 59 - now.getSeconds();
              var hours=((time_hours&lt;10) ? "0":"") + time_hours;
              var min=((time_min&lt;10)? "0":"") + time_min;
              var sec=((time_sec&lt;10)? "0":"") + time_sec
              var time = hours + ':' + min + ':' + sec;
              document.getElementById("timer").innerHTML=time;
          }
      }
  
          setInterval(clockPlayer, 1000);
  </code></pre>
  
  <p>When I try to call this function my browser ignores 'playerVars', I can't understand why. </p>
  
  <p>This is index.html:</p>
  
  <pre><code> &lt;body&gt;
          &lt;script language="javascript" src="https://www.youtube.com/iframe_api"&gt;&lt;/script&gt;
          &lt;div id="timer"&gt;&lt;/div&gt;
          &lt;div id="main-block"&gt;&lt;/div&gt;   
          &lt;script language="javascript" src="script.js"&gt;&lt;/script&gt;
      &lt;/body&gt;
  </code></pre>
  
  <p>The clock function has random date now, I will change it later. When I try to use <code>createPlayer()</code> without clock function, I have the same result.</p>