title: YouTube embed player not working in Javascript
body: <p>Since a couple of days, code which worked fine to embed a YouTube video via Javascript stopped working. Now the video loads but it is not playable (the play button is not clickable), with this error in the console:</p>
  
  <pre><code>Uncaught TypeError: a.g.mX is not a function
  at O_ (https://www.youtube.com/yts/jsbin/player-en_US-vfl8LqiZp/base.js:3796:24)
  at new P_ (https://www.youtube.com/yts/jsbin/player-en_US-vfl8LqiZp/base.js:3791:111)
  at new c2 (https://www.youtube.com/yts/jsbin/player-en_US-vfl8LqiZp/base.js:3985:268)
  at new i2 (https://www.youtube.com/yts/jsbin/player-en_US-vfl8LqiZp/base.js:4005:210)
  at i2.create (https://www.youtube.com/yts/jsbin/player-en_US-vfl8LqiZp/base.js:6950:321)
  at zh.&lt;anonymous&gt; (https://www.youtube.com/yts/jsbin/www-embed-player-vflxTxlSH/www-embed-player.js:428:269)
  at zh.k.lb (https://www.youtube.com/yts/jsbin/www-embed-player-vflxTxlSH/www-embed-player.js:428:308)
  at Dh (https://www.youtube.com/yts/jsbin/www-embed-player-vflxTxlSH/www-embed-player.js:426:143)
  at zh.k.pa (https://www.youtube.com/yts/jsbin/www-embed-player-vflxTxlSH/www-embed-player.js:419:176)
  at https://www.youtube.com/yts/jsbin/www-embed-player-vflxTxlSH/www-embed-player.js:461:420
  </code></pre>
  
  <p>The JS code is as follows:</p>
  
  <pre><code>document.getElementById('player').setAttribute("style","height:"+(window.innerHeight * 0.87)+"px;");
  document.getElementById('youtube_frame').src="http://www.youtube.com/player_api";
      var player;
      function onYouTubePlayerAPIReady() {
              player = new YT.Player('player', {
                height: "100%",
                width: "100%",
                videoId: start_video,
                events: {
                  'onReady': onPlayerReady,
                  'onStateChange': onPlayerStateChange
                }
              });
      }
      function onPlayerReady(event) {
  
              player_ref = event.target;
              event.target.playVideo();
          }
  
          // when video ends
          function onPlayerStateChange(event) {        
              if(event.data === 0) {          
  
                  event.target.loadVideoById(start_video);
              }
          }
  </code></pre>
  
  <p>Playback also broke on another prototype that I run. Everything used to work fine until a couple of days ago. I cannot find anything online, perhaps someone can shed some light?</p>
  
  <p>----- <strong>UPDATE</strong> ----</p>
  
  <p>Embedding playback is broken again: </p>
  
  <pre><code>Uncaught TypeError: a.g.setActionHandler is not a function
  at M_ (https://www.youtube.com/yts/jsbin/player-en_US-vflqOi6vK/base.js:3788:24)
  at new N_ (https://www.youtube.com/yts/jsbin/player-en_US-vflqOi6vK/base.js:3783:111)
  at new a2 (https://www.youtube.com/yts/jsbin/player-en_US-vflqOi6vK/base.js:3978:367)
  at new g2 (https://www.youtube.com/yts/jsbin/player-en_US-vflqOi6vK/base.js:3999:210)
  at g2.create (https://www.youtube.com/yts/jsbin/player-en_US-vflqOi6vK/base.js:6995:333)
  at Gi.&lt;anonymous&gt; (https://www.youtube.com/yts/jsbin/www-embed-player-vfl-i_LLs/www-embed-player.js:507:269)
  at Gi.l.jb (https://www.youtube.com/yts/jsbin/www-embed-player-vfl-i_LLs/www-embed-player.js:507:308)
  at Ki (https://www.youtube.com/yts/jsbin/www-embed-player-vfl-i_LLs/www-embed-player.js:505:143)
  at Gi.l.oa (https://www.youtube.com/yts/jsbin/www-embed-player-vfl-i_LLs/www-embed-player.js:498:176)
  at https://www.youtube.com/yts/jsbin/www-embed-player-vfl-i_LLs/www-embed-player.js:557:378
  </code></pre>