Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
JW Player - Stop other videos when playing
(function($) {
* We have to get a collection of id's because the HTML5 player moves the DOM
* around and returns different elements when caching the selectors.
var elements = $('.video-player > div, .video-player object'),
playerIds = [];
elements.each(function(i, player) {
$.each(playerIds, function(i, id) {
jwplayer(id).onPlay(function() {
$.each(playerIds, function(x, pid) {
if (id === pid)
return true;

This comment has been minimized.

Copy link

crazyrohila commented Nov 8, 2013

Thanks man. Its saved my day.


This comment has been minimized.

Copy link

tsegaa commented Aug 30, 2017

Sorry I am pretty new to JS. Where should I put this code?

Thank you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.