0

I've tried every possible solution I can find, but I can't seem to mute my iframe vimeo video. I've referenced "//f.vimeocdn.com/js/froogaloop2.min.js" in the head. And I'm using the following javascript at the bottom of the page...

<script type="text/javascript">
var iframe = document.getElementById('vimeo_player');
var player = $f( iframe );

 player.addEvent('ready', function() {
     player.api('setVolume', 0); 
 });
</script>

You can see my attempt here: http://walkinthedog.com/video-test/

Any help is most appreciated.

mwisema1
  • 1
  • 1
  • 1
  • If I open that url and in the console run `$f(document.getElementById('vimeo_player')).api('setVolume', 0)` it works fine, add an alert() in the event to make sure the its firing as you expect – Alex K. Feb 13 '15 at 14:13
  • The best answer here gives working examples: http://stackoverflow.com/questions/26654655/a-way-to-mute-an-iframe-using-jquery-or-css – m van sark Feb 13 '15 at 14:25

2 Answers2

1

Use setVolume from the api in your vimeo embed.. player.api('setVolume', 0); it will be like this...

<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>

<script src="//f.vimeocdn.com/js/froogaloop2.min.js"></script>
<iframe id="vimeo_player" src="http://player.vimeo.com/video/4415083?  title=0&amp;byline=0&amp;portrait=0&amp;color=d01e2f&amp;autoplay=1" width="500" height="281"  frameborder="0" webkitAllowFullScreen mozallowfullscreen allowFullScreen></iframe>
    <script>
      var iframe = $('#vimeo_player')[0],
        player = $f(iframe),
        status = $('.status');

        player.addEvent('ready', function() {
            player.api('setVolume', 0);
        });
    </script>
Andrew Hendrie
  • 6,205
  • 4
  • 40
  • 71
0

With the latest version, there's an even easier solution:

<iframe id="vimeo_player" src="http://player.vimeo.com/video/4415083?autoplay=1" width="500" height="281"  frameborder="0" webkitAllowFullScreen mozallowfullscreen allowFullScreen></iframe>
<script src="https://player.vimeo.com/api/player.js"></script> 
<script>
    var player = new Vimeo.Player(document.getElementById("vimeo_player"));
    player.on('play', function() {
        player.setVolume(0)
    });
</script>
Community
  • 1
  • 1