This script work perfectly, but what it does is stops an instance of a playing video if a new video is started. How would I rewrite this to stop ALL instances of playing videos when the function stopAllButMe(); is called?
function stopAllButMe(playerState, player) {
if (playerState=='PLAYING') {
var myId = player.getId();
projekktor('*').each(function() {
if (this.getId()!==myId) {
this.setStop();
}
});
}
}
projekktor('*').each(function() {
this.addListener('state', stopAllButMe);
});
The ‘if’ statement was checking against the input.