title: jwPlayer - Switching out XML Playlists with javascript
body: <p>I wish I could show an example of this, but I will try to explain as best as I can. </p>
  
  <p>I have jwPlayer 5.7 integrated into a client's webpage. The playlist is fed from an XML file composed of around 120 videos. Some of these videos are split into 4-part series. The client would prefer that when these videos are selected that playlist would show the 4 videos in the series and those 4 videos alone. </p>
  
  <pre><code>$(function() {
  
      buildPlayer();
  
      function buildPlayer() {
  
          jwplayer('mediaplayer').setup({
          'autostart': 'false',
          'controlbar': 'bottom',
          'id': 'playerID',
          'width': '960',
          'height': '400',
          'file': 'videos.xml',
          'modes': [
                      {type: 'flash', src: '/jwplayer/player.swf'},
                      {type: 'html5'},
                      {type: 'download'}
              ],
          'skin': 'skywalker.zip',
          'playlist.position': 'right',
          'playlist.size': '300'
          });
      };
  
  
      // On playlist Item change... 
      jwplayer().onPlaylistItem(function(event) {
  
          var curItem = (event.index);
          console.log('index change..' + curItem);
  
          if (curItem == 0) {
              jwplayer('mediaplayer').play(); 
          }
          else if (curItem == 74) {
              jwplayer().load([{file:"video-series-1.xml"}]);
              return false;   
          }
          else {
              console.log('not webinar');
              jwplayer().load([{file:"media-feed.xml"}]);
              jwplayer('mediaplayer').play(); 
          }
      });
  });
  </code></pre>
  
  <p>This works, to an extent. The playlist will change to the "series" XML file. But after I click on a link with the function:</p>
  
  <pre><code>jwplayer().playlistItem(57);
  </code></pre>
  
  <p>The jwplayer().onPlaylistItem function will not trigger. I imagine because this playlist does not have a video with an index of 57 (It is only 4 videos total).</p>