Created
November 19, 2013 13:46
-
-
Save gerbenvandijk/7545592 to your computer and use it in GitHub Desktop.
Vimeo API events - howto
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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&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'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Froogaloop(player).addEvent('finish', finish);
no longer works