JSFiddle - React, Tailwind, and code Playground

by Prashant Tapase

HTML

<div id="player" style="width:0px;height:0px;">
<iframe width="1000" height="1000" class="youtube-player" id="player" type="text/html" src="https://www.youtube.com/embed/GFQF4sj_Tmw?wmode=opaque&autohide=1&autoplay=1&enablejsapi=1" frameborder="0">&lt;br /&gt;</iframe>
</div></iframe>

JavaScript

var player =  iframe.getElementById('player');
player.mute();

 
   // 2. This code loads the IFrame Player API code asynchronously.
      var tag = document.createElement('script');
      tag.src = "http://www.youtube.com/player_api";
      var firstScriptTag = document.getElementsByTagName('script')[0];
      firstScriptTag.parentNode.insertBefore(tag, firstScriptTag);

      // 3. This function creates an <iframe> (and YouTube player)
      //    after the API code downloads.
      var player;
      function onYouTubePlayerAPIReady() {
        player = new YT.Player('player', {
          playerVars: { 'autoplay': 1, 'controls': 1,'autohide':0, 'width' : 1, 'height' :1, 'wmode':'opaque' },
          videoId: 'GFQF4sj_Tmw',
          events: {
            'onReady': onPlayerReady}
        });
      }

      // 4. The API will call this function when the video player is ready.
      function onPlayerReady(event) {
        event.target.mute();
      }