jrue/Vimeo-jQuery-API

Multiple videos, on finish callback

Opened this issue · 3 comments

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!

Same problem here

Same.

jrue commented

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.