examples/player/player.js
function(direction) {
    var self = this;

    // Get the next track based on the direction of the track.
    var index = 0;
    if (direction === 'prev') {
      index = self.index - 1;
      if (index < 0) {
        index = self.playlist.length - 1;
      }
    } else {
      index = self.index + 1;
      if (index >= self.playlist.length) {
        index = 0;
      }
    }

    self.skipTo(index);
  }
function(direction) {
    var self = this;

    // Get the next track based on the direction of the track.
    var index = 0;
    if (direction === 'prev') {
      index = self.index - 1;
      if (index < 0) {
        index = self.playlist.length - 1;
      }
    } else {
      index = self.index + 1;
      if (index >= self.playlist.length) {
        index = 0;
      }
    }

    self.skipTo(index);
  }
function ( direction ) { var self = this ; // Get the next track based on the direction of the track. var index = 0 ; if ( direction === 'prev' ) { index = self . index - 1 ; if ( index < 0 ) { index = self . playlist . length - 1 ; } } else { index = self . index + 1 ; if ( index >= self . playlist . length ) { index = 0 ; } } self . skipTo ( index ) ; }
Skip to the next or previous track.
@param  {String} direction 'next' or 'prev'.
Skip to the next or previous track .