Developer Guide Javascript API Reference Developer Tools Release Notes

Loading New Playlists

Click on a button to choose a playlist and load it into the player!

let playlists = [

const apiUrl = mediaid => `${mediaid}`;

playlists = => {
  if (typeof playlist === 'string') {
    return apiUrl(playlist);

  // To build a complete playlist, this demo fetches the full JW Delivery API
  // responses for each media id.
  const fetches = => fetch(apiUrl(item)).then(r => r.json()));
  return Promise.all(fetches).then(media => media.flatMap(m => m.playlist));

Promise.all(playlists).then(playlists => {
  const select = document.getElementById('playlist-picker');

  const playerInstance = jwplayer('player').setup({
    playlist: playlists[0]

  select.addEventListener('change', () => {

  A simpler approach would only need to be an array
  of objects containing a `file` property, like this:

      { file: },
      { file: },
      { file: }

  The main benefit to fetching the sources is that we get all of the other
  information provided by JW Platform like poster images, thumbnails, captions,
  and sources.
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.