Skip to content

Instantly share code, notes, and snippets.

@gerbenvandijk
Created November 19, 2013 13:46
Show Gist options
  • Save gerbenvandijk/7545592 to your computer and use it in GitHub Desktop.
Save gerbenvandijk/7545592 to your computer and use it in GitHub Desktop.
Vimeo API events - howto
// First load in the Froogaloop library
// It is important to build up your embed like this: <iframe src="https://player.vimeo.com/video/44633289?api=1&amp;player_id=vimeo" width="990" height="558" id="vimeo" frameborder="0" webkitallowfullscreen mozallowfullscreen allowfullscreen></iframe>
// The ID of the iframe should be included!
var player = document.getElementById('vimeo');
// We bind an event that fires when the player is ready
Froogaloop(player).addEvent('ready', ready);
// The function that is initiated when the player is ready
function ready(player){
// Adding events (finish, play, etc)
Froogaloop(player).addEvent('finish', finish);
// The function that is run when the video has finished playing
function finish() {
// action
}
}
// If wanted, play the
Froogaloop(player).api('play');
Froogaloop(player).api('stop');
@arLevi
Copy link

arLevi commented Jul 22, 2019

Froogaloop(player).addEvent('finish', finish); no longer works

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment