Home>Support>Can I mute the audio of a youtube video when configured to autoplay?
  1. 6 years, 24 days ago Andrew Misplon Hi, I Work Here

    Hi Rishi

    Could you confirm the above URL is correct? I’m getting a ERR_NAME_NOT_RESOLVED.

    Thanks

  2. 6 years, 24 days ago Andrew Misplon Hi, I Work Here

    Looks like it can be done from the embed code. Example:

    <iframe width="260" height="195" src="//www.youtube.com/embed/h3P1OR9gg2Y?rel=0&autoplay=1" frameborder="0" allowfullscreen volume="0"></iframe>

    Ref: https://productforums.google.com/forum/#!topic/youtube/XS5_P_9OXCo

  3. 6 years, 24 days ago WebDudes Support

    Sorry, the URL is http://invisiblesellingtrainer.com/

  4. 6 years, 24 days ago Andrew Misplon Hi, I Work Here

    Thanks :) Please, check out the above URL. I’ve fixed the code above too. It’s now an example.

  5. 6 years, 24 days ago Andrew Misplon Hi, I Work Here
    &autoplay=1
    volume="0"
    

    Those are the important parts.

  6. 6 years, 24 days ago WebDudes Support

    Hi Andrew, apparently volume=”0″ is not working anymore, but the other code works.

  7. 6 years, 24 days ago WebDudes Support

    Another observation is that if I try to unmute the video manually while playing it goes back to mute. :)

    Weird

  8. 6 years, 24 days ago Andrew Misplon Hi, I Work Here

    Thanks.

    Unfortunately, I don’t see volume on the list of parameters here:
    https://developers.google.com/youtube/player_parameters?hl=en

  9. 5 years, 3 months ago Akshyaa.com Know The World

    I found a url where much of youtube url properties are explained there , i think its useful for you link : Embed youtube video sound mute

  10. 4 years, 11 months ago Andrew Misplon Hi, I Work Here

    Hi everyone :)

    Unfortunately, this task isn’t currently possible using standard YouTube query parameters. However, we can achieve by inserting the following into the Text tab of the WordPress editor OR into a Text widget or SiteOrigin Editor widget (Text tab):

    <!-- 1. The <iframe> (and video player) will replace this <div> tag. -->
    <div id="player"></div>
    <script>
          // 2. This code loads the IFrame Player API code asynchronously.
          var tag = document.createElement('script');
          tag.src = "https://www.youtube.com/iframe_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 onYouTubeIframeAPIReady() {
            player = new YT.Player('player', {
              height: '315',
              width: '560',
              videoId: 'ilrvQyRF3_g',
              events: {
                'onReady': onPlayerReady,
                'onStateChange': onPlayerStateChange
              }
            });
          }
          // 4. The API will call this function when the video player is ready.
          function onPlayerReady(event) {
               event.target.setVolume(0);
           event.target.playVideo();
          }
          // 5. The API calls this function when the player's state changes.
          //    The function indicates that when playing a video (state=1),
          //    the player should play for six seconds and then stop.
          var done = false;
          function onPlayerStateChange(event) {
            if (event.data == YT.PlayerState.PLAYING && !done) {
        //      setTimeout(stopVideo, 6000);
                      done = true;
            }
               event.target.setVolume(0);
          }
    </script>

    The following values in the above example should be located and replaced with your own unique values:

    height: '315',
    width: '560',
    

    Replace the height value and the width value. To get standard sizes, go to your YouTube video and click on ShareEmbedShow MoreVideo Size. Only replace 315 and 560 in the code snippet.

    The next line is the video ID:

    videoId: 'ilrvQyRF3_g',
    

    The video ID can be easily located in the video URL on YouTube. For example: https://www.youtube.com/watch?v=ilrvQyRF3_g. The ID is:

    v=ilrvQyRF3_g
    

    Only replace the ID, leaving the inverted commas in place.

    Credit: https://productforums.google.com/forum/#!topic/youtube/XS5_P_9OXCo

Replies on this thread are closed. Please create a new thread if you have a question, or purchase a SiteOrigin Premium license if you need one-on-one email support.

Get The Most Out of SiteOrigin with SiteOrigin Premium

Find Out More