Developer Guide Javascript API Reference Developer Tools Release Notes

Exclusive Playback

A demo setup with multiple players. When one of them starts, the others are automatically paused.

github
const apiRoute = 'https://cdn.jwplayer.com/v2/media';

const players = [
  '1b02B03R',
  'kbs0WLBI',
  'KJKBQC7h'
].map((m, i) => {
  const playlist = `${apiRoute}/${m}`;
  const player = jwplayer(`player${i}`).setup({ playlist })
  player.on('play', () => pausePlayers(i));
  return player;
});

function pausePlayers(playing) {
  players.filter((p, i) => i !== playing).forEach(p => p.pause(true));
};
This player implementation is a Proof of Concept only provided to show the possibilities of the JW Player and Platform and should not be taken as an offer to create, edit or maintain custom integration or development.