title: Javascript - How to unmute youtube videos in iframe
body: <p>My youtube videos perfectly in iframe but there is no sound. Below is my code.</p>
  
  <pre><code>if (slideType === "youtube") {
      switch (control) {
        case "play":
          postMessageToPlayer(player, {
            "event": "command",
            "func": "mute"
          });
          postMessageToPlayer(player, {
            "event": "command",
            "func": "playVideo" 
          });
          break;
        case "pause":
          postMessageToPlayer(player, {
            "event": "command",
            "func": "pauseVideo"
          });
          break;
      }
    }
  
  // POST commands to YouTube API
  function postMessageToPlayer(player, command){
    if (player == null || command == null) return;
    player.contentWindow.postMessage(JSON.stringify(command), "*");
  }
  </code></pre>
  
  <p>From the above section if i remove the mute section the video does not play. If i send unMute instead of mute still the video does not play. How do i have sound for my video being played?</p>