I'm trying to call a function once the play button on a Vimeo video has been clicked.
For some reason the function is called while the iframe is loading, rather than when play is clicked. Could somebody explain why?
This is my code:
// Enable the API on each Vimeo video
jQuery('iframe.vimeo').each(function(){
Froogaloop(this).addEvent('ready', ready);
});
function ready(playerID){
// Add event listerns
// http://vimeo.com/api/docs/player-js#events
Froogaloop(playerID).addEvent('play', play(playerID));
}
function play(playerID){
alert(playerID + " is playing!!!");
}
Thanks!