Vimeo Universal Player JS API example with Froogaloop
A quick example of how to use Froogaloop to interact with a Vimeo player.
by blowsie
HTML
<script src="http://a.vimeocdn.com/js/froogaloop2.min.js"></script>
<iframe id="player1" src="http://player.vimeo.com/video/27855315?api=1&player_id=player1" width="400" height="225" frameborder="0" webkitAllowFullScreen mozallowfullscreen allowFullScreen></iframe>
<iframe id="player2" src="http://player.vimeo.com/video/27855315?api=1&player_id=player2" width="400" height="225" frameborder="0" webkitAllowFullScreen mozallowfullscreen allowFullScreen></iframe>
<iframe id="player3" src="http://player.vimeo.com/video/27855315?api=1&player_id=player3" width="400" height="225" frameborder="0" webkitAllowFullScreen mozallowfullscreen allowFullScreen></iframe>
JavaScript
var players = [];
$("iframe").each(function(){
var $this = $(this)[0];
var thisPlayer = $f($this);
// console.log(thisPlayer)pla
players.push(thisPlayer);
});
$.each(players, function(k,v){
v.addEvent('ready', function() {
v.addEvent('play', play);
});
});
function play(id) {
$.each(players, function(k,v){
if (v.element.id != id) {
v.api('pause');
}
});
}