Mosaic New York

Mosaic New York Plus

Hey guys,

I want to use the JavaScript API to add an event handler to the 'finish' event of the video I am embedding. The problem is that I am using SWFobject to embed my vimeo video (i'm using this in order to autoplay the video and have it fill the entire browser window). Not sure how to do this because the documentation says in order to have access to the JS API, I need to embed the video via an Iframe and then pass a url param (api=1) to enable the JS API. After that, I have to add an event listener to the player object.

My question is can I pass the api=1 param to the swf object and add the 'finish' handler? Let me know if my question is at all unclear. I appreciate the help. Thank you.

Mosaic New York

Mosaic New York Plus

Ok, so a little update. Noticed that using the SWFObject library, and then calling the embedSwf function on the swfobject I create, it will insert a element into to the DOM. By passing the SWFObject an id, I am also able to give that element an ID. Ideally, I want to add the 'finish' listener to that object, and according to the JS API documentation, it is as easy as saying:

document.getElementById('vimeo_player').api_addEventListener('finish', function(event) {
// do stuff here
});

'vimeo_player' would be the id I pass it. This is not working tho. I see the object in my DOM when I inspect it in Firebug, and I see that it has the correct id, and I do not get any errors saying that api_addListener is not a function or anything, but it doesn't work. I basically add an alert as my finish handler, but the alert is never triggered when the video finishes. Any help on this would be greatly appreciated. Thank you in advanced.

This conversation is missing your voice. Please join Vimeo or log in.