examples/player/player.js
function(playlist) {
  this.playlist = playlist;
  this.index = 0;

  // Display the title of the first track.
  track.innerHTML = '1. ' + playlist[0].title;

  // Setup the playlist display.
  playlist.forEach(function(song) {
    var div = document.createElement('div');
    div.className = 'list-song';
    div.innerHTML = song.title;
    div.onclick = function() {
      player.skipTo(playlist.indexOf(song));
    };
    list.appendChild(div);
  });
}
function(playlist) {
  this.playlist = playlist;
  this.index = 0;

  // Display the title of the first track.
  track.innerHTML = '1. ' + playlist[0].title;

  // Setup the playlist display.
  playlist.forEach(function(song) {
    var div = document.createElement('div');
    div.className = 'list-song';
    div.innerHTML = song.title;
    div.onclick = function() {
      player.skipTo(playlist.indexOf(song));
    };
    list.appendChild(div);
  });
}
function ( playlist ) { this . playlist = playlist ; this . index = 0 ; // Display the title of the first track. track . innerHTML = '1. ' + playlist [ 0 ] . title ; // Setup the playlist display. playlist . forEach ( function ( song ) { var div = document . createElement ( 'div' ) ; div . className = 'list-song' ; div . innerHTML = song . title ; div . onclick = function ( ) { player . skipTo ( playlist . indexOf ( song ) ) ; } ; list . appendChild ( div ) ; } ) ; }
Player class containing the state of our playlist and where we are in it.
Includes all methods for playing, skipping, updating the display, etc.
@param {Array} playlist Array of objects with playlist song details ({title, file, howl}).
Player class containing the state of our playlist and where we are in it . Includes all methods for playing skipping updating the display etc .