title: Video.js Playlist repeatedly plays video at index -1
body: <p>I'm using video.js and <a href="https://github.com/brightcove/videojs-playlist" rel="nofollow noreferrer">videojs-playlist</a> to show a series of videos in a playlist. Each source is a url that streams from my MongoDB and Node server. </p>
  
  <p>Outside of the playlist, the videos stream correctly. With the playlist library, only the first video plays over and over. Using the playlist <a href="https://github.com/brightcove/videojs-playlist/blob/master/docs/api.md#playerplaylistcurrentitemnumber-index---number" rel="nofollow noreferrer">currentItem function</a> I can see that the index is always -1, never changes, even if I try to do it programmatically. The only way it will change is if I manually click other videos in the list.</p>
  
  <p>I believe the problem has to do with streaming and not reading from a file system, but I don't know enough about this subject to debug. Thanks!</p>
  
  <p><strong>HTML</strong></p>
  
  <pre><code>&lt;section class="main-preview-player"&gt;
    &lt;video id="preview-player" class="video-js vjs-fluid vjs-big-play-centered" controls preload="auto"&gt;
       &lt;p class="vjs-no-js"&gt;To view this video please enable JavaScript, and consider upgrading to a web browser that
         &lt;a href="http://videojs.com/html5-video-support/" target="_blank"&gt;supports HTML5 video&lt;/a&gt;
       &lt;/p&gt;
    &lt;/video&gt;
  &lt;div class="playlist-container  preview-player-dimensions vjs-fluid"&gt;
     &lt;ol class="vjs-playlist"&gt;&lt;/ol&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p><strong>JS</strong></p>
  
  <pre><code>$(document).ready(video);
  
  function video() {
    var arr = arrayOfIds.split(','); // IDs for video URLs
    var player = videojs('preview-player');
  
  
   function getPlaylist() {
     var videos = arr.map(function(id) {
       return obj = {
         name: id,
         sources: [{ 
           src: "/api/mediaID/" + id, // URL for video stream
           type: "video/mp4"          // Is this right??
         }]
       }
     })
  
     player.playlist(videos, 0);
     player.playlistUi();
   }
  
    function playNext() {
      var num = player.playlist.currentItem();
      console.log(num); // Always logs '-1'
  
      player.playlist.next();
    }
  
    player.ready(function() {
      if(arrayOfIds.length) {
        getPlaylist();
      }
  
      player.on("ended", playNext);
    })
  }
  </code></pre>