Reputation: 170
I'm trying to get more than one Vimeo video to play and pause using the Bootstrap modal. I can get it working for one video on the page, but not multiple videos in separate modals.
I used the code from an earlier post on here and it works well for one video. Play and stop Vimeo video placed in Bootstrap modal
Does anyone know how to get multiple videos working? I have tried to use 2 seperate video ids as variables but I don't think this is the right thing to do and it didn't work.
This is what I have working so far - http://jsbin.com/foveqi/1/edit?html,css,js,output
Upvotes: 0
Views: 1022
Reputation: 362820
You do need to use separate id's for the videos. Then you can use a little jQuery along with the Bootstrap toggle button to control the videos. The important part is setting up event listeners...
player.addEvent('ready', function() {
player.addEvent('pause', onPause);
player.addEvent('finish', onFinish);
player.addEvent('playProgress', onPlayProgress);
});
Demo: http://codeply.com/go/JnIJLgXjyt
Upvotes: 0