ricoramiro2 icon

Embed YouTube Video Muted

ricoramiro2 | PRO | 09/18/17 11:02:28 PM UTC | 0 ⭐ | 470 👁️ | Never ⏰ | []
HTML |

1.55 KB

|

None

|

0 👍

/

0 👎

<!DOCTYPE html>
<html>
  <head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width">
    <title>Embed YouTube Video Muted</title>
  </head>
  <body>
    <div style="margin:20px auto;width:600px">
      <p>The YouTube video on this page will automatically play but muted.</p>
      <p>See tutorial: <a href="http://www.labnol.org/?p=29149">Embed YouTube Video Muted</a>
      <div id="muteYouTubeVideoPlayer"></div>
    </div>
 
    <script async src="https://www.youtube.com/iframe_api"></script>
    <script>
      function onYouTubeIframeAPIReady() {
        var player;
        player = new YT.Player('muteYouTubeVideoPlayer', {
          videoId: '-hX_rznqnM0', // YouTube Video ID
          width: 560,             // Player width (in px)
          height: 316,            // Player height (in px)
          playerVars: {
            autoplay: 1,        // Auto-play the video on load
            controls: 1,        // Show pause/play buttons in player
            showinfo: 0,        // Hide the video title
            modestbranding: 1,  // Hide the Youtube Logo
            loop: 1,            // Run the video in a loop
            fs: 0,              // Hide the full screen button
            cc_load_policty: 0, // Hide closed captions
            iv_load_policy: 3,  // Hide the Video Annotations
            autohide: 0         // Hide video controls when playing
          },
          events: {
            onReady: function(e) {
              e.target.mute();
            }
          }
        });
      }
    </script>
  </body>
</html>

Comments