I have a Vimeo video (via universal embed iframe) hidden on my page. Clicking a link fades it in, and clicking outside of the video (lightbox-style) fades it out and hides it - but the video keeps playing. I read on Vimeo's API that you can use JSON objects to pause the video, but I don't understand what they're saying.
HTML:
<img id="show_tide" class="vid" src"#">
<i<iframe id="tide" class="vim" src="http://player.vimeo.com/video/1747304?portrait=0&color=ffffffapi=1" width="726" height="409" frameborder="0"></iframe>
JavaScript:
$('#underlay').click(function() {
//pause VISIBLE (there are multiple) Vimeo video via API
$('.vim, #underlay').fadeOut(400);
});
I wanted to add a play/pause button like this without using jquery or froogaloop. I don't know why but, I hate including a library when I don't have to. Especially for simple things like this.
Here's what I came up with (I'm just posting this for other people who are searching) :
You need to add from one of the froogaloop libraries.
JS
Annoyingly simple. Here's an example on jsfiddle.net.
I'm a little late to the party, but I had to load froogaloop, jquery, and the Vimeo API also.
be sure to append
?api=1&player_id='frame'
to the end of your embedded video linkMy code looked something like this after
Here's a simple way to pause a Vimeo video from an external HTML element that worked for me, using the froogaloop libray: