jrue / Vimeo-jQuery-API

A simple Vimeo API using standard jQuery event structures
MIT License
148 stars 27 forks source link

Multiple videos, on finish callback #13

Open shivamd opened 9 years ago

shivamd commented 9 years ago

Hi,

Thanks a lot for this plugin. It has been extremely helpful. Having an issue with multiple videos and callbacks.

My videos get inserted dynamically in to the page, the play/pause/seekTo etc calls work perfectly. However the on finish callback only works for the first video(iframe) inserted.

Any idea why is this happening? I have double checked, and the the src and iframe id, have the specific required unique_id.

Thanks!

hjblokland commented 9 years ago

Same problem here

operapreneur commented 8 years ago

Same.

jrue commented 8 years ago

I just made an update to this plugin. It was tricky, because the Vimeo plugin normally just checks the static HTML and processes every Vimeo video on the page. In order to process dynamically added videos, you'll need to call a new vimeoLoad() method after appending it to the DOM. Example:

$("<iframe />")
    .attr("src", "https://player.vimeo.com/video/128947850")
    .appendTo("body")
    .vimeoLoad()  //This new method call after appending iframe to the DOM
    .vimeo("play"); //now you can use plugin's methods

Let me know how this works. I've tested it, and seems to work fine. But I'll consider it experimental until I hear that it's working for people.

Sorry it took so long.