I set up this little javascript to initialize a couple of players on my webpage and add an event to make only one player active while everything else is paused. This is supposed to emulate the "autpoause" function which, for some reason, is only available on Vimeo videos, but not Youtube videos:
const players = Plyr.setup(".myplayer", { fullscreen: { enabled: false }, autopause: true });
$('players').each(function(index, players) {
players[index].on('play', function(index, players, event) {
players.not(this).each(function(index, players) {
players[index].pause();
});
});
});
Somehow, nothing really happens. The .not(this) is supposed to select all other instances except the one I am declaring the event listener on. But when I try it out, nothing is paused. All the other players keep playing.
What am I doing wrong? Any hint is appreciated.