title: Make youtube video fullscreen using iframe and javascript API
body: <p>I have an embedded youtube video with hidden controls:</p>
  
  <pre><code>&lt;iframe id="ytplayer" type="text/html" width="400" height="225"
  src="http://www.youtube.com/embed/dMH0bHeiRNg?rel=0&amp;controls=0&amp;showinfo=0
  &amp;loop=1&amp;hd=1&amp;modestbranding=1&amp;enablejsapi=1&amp;playerapiid=ytplayer"
  frameborder="0" allowfullscreen&gt;&lt;/iframe&gt;
  </code></pre>
  
  <p>I can control it with the youtube Javascript API. </p>
  
  <pre><code>var tag = document.createElement('script');
  
  tag.src = "//www.youtube.com/iframe_api";
  var firstScriptTag = document.getElementsByTagName('script')[0];
  firstScriptTag.parentNode.insertBefore(tag, firstScriptTag);
  
  var player;
  function onYouTubeIframeAPIReady() {
  player = new YT.Player('ytplayer', {
    events: {
      'onReady': onPlayerReady,
      'onStateChange': onPlayerStateChange
    }
  });
  }
  </code></pre>
  
  <p>Things like <code>player.playVideo()</code> and so on work perfectly. Now I am looking for a way to make the video play in fullscreen mode with a Javascript call but I couldn't find any method in the API.  </p>
  
  <p><strong>Is it even possible (without the controls) and if so - how?</strong></p>