Firstly you need to include the path to Vimeo's 'Frogaloop library, in your HTML (after your Jquery include):
<script src="https://f.vimeocdn.com/js/froogaloop2.min.js"></script>
Then you need to embed your Vimeo video (again in your HTML):
<iframe id="PLAYER1" src="https://player.vimeo.com/video/76979871?api=1&player_id=PLAYER1" width="630" height="354" frameborder="0" webkitallowfullscreen mozallowfullscreen allowfullscreen></iframe>
Here 'api=1' turns on the api - this is turned off by default for performance. And, player_id='PLAYER1' is the id of your iframe.
Then in your JavaScript file, you need the following:
$(function() {
//Gets the iframe by id
var iframe = $('#PLAYER1');
//Creates a player var using the iframe
var player = $f(iframe);
// When the player is ready/loaded, add a finish event listener
player.addEvent('ready', function() {
//Adds an event 'finish' that executes a function 'onFinish' when the video has ended.
player.addEvent('finish', onFinish);
});
//Define the onFinish function that will be called
function onFinish(id) {
console.log('THE VIDEO HAS FINISHED PLAYING');
}
});
Then simply just play the video, and check the console output.
Here is a link to the appropriate part of the documentation.
Thanks to @Raptor for pointing me towards the api docs.