I would like to have it so that when I play one Vimeo video the others on the page will be paused.
I tried using the froogaloop API but had little help.
Using the current code I got it working so that when I switch tabs I can pause all videos. Now I want to make it so that when I play one video, the others pause.
Right now the event listeners for detecting ‘play’ are not working correctly. I believe that is because they need to be in the $(document).ready() but they are stuck in the first <script> area, encapsulated in $(function(){ }) which I believe is preventing it from interacting.
The code can be found here: http://www.proclinica.com/preview
This is the code I modified to control the vimeo and you can see the event listeners work here: http://jsfiddle.net/GxwEX/5/
Can someone at least help me get the event listeners to work on the proclinica website?
First of all, I’m not exactly sure what you’re trying to do that isn’t working. In your code (on your site), you have this:
When I click one of the logo’s, any running videos seem to pause just fine.
If you’re trying to pause all playing videos when another is started by the user; I don’t think I’ve seen anywhere in your code (either in the JSFiddle or on the site) where you’re trying to do that. If you have; can you show us what you’ve tried to far?
And finally, just to answer at least one part of your question…
$(...)is actually just a nice shortcut for$(document).ready(...).Edit:
From the documentation:
If you’ve set it, this
player_idis passed along to any event listeners, like so:You can use this to identify which video was started, and restart it after you’ve paused the others.