function setNext() {
    var songEnded = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;

    /*
      Initializes the next index variable. This will be the
      index of the song that is next.
    */
    var nextIndex = null;
    var nextSong = {};

    /*
      Ensure we don't loop in the playlist if config.repeat is not true
    */
    var endOfList = false;

    /*
      Determines if we are repeating the song or not. If we are repeating,
      the next song will be the same song index.
    */
    if (_config2.default.repeat_song) {
      /*
        If the playlist is shuffled, get the now playing index.
      */
      if (_config2.default.shuffle_on) {
        nextIndex = _config2.default.shuffle_list[_config2.default.active_index].index;
        nextSong = _config2.default.shuffle_list[nextIndex];
      } else {
        nextIndex = _config2.default.active_index;
        nextSong = _config2.default.songs[nextIndex];
      }
    } else {
      /*
        If the shuffle is on, we use the shuffled list of
        songs to determine our next song.
      */
      if (_config2.default.shuffle_on) {
        /*
          If the active shuffle index + 1 is less than the length, then
          we use the next shuffle otherwise we go to the beginning
          of the shuffle list.
        */
        if (parseInt(_config2.default.active_index) + 1 < _config2.default.shuffle_list.length) {
          /*
            Set the next index to be the index of the song in the shuffle list.
          */
          nextIndex = parseInt(_config2.default.active_index) + 1;
        } else {
          nextIndex = 0;
          endOfList = true;
        }

        nextSong = _config2.default.shuffle_list[nextIndex];
      } else {
        /*
          If the active index + 1 is less than the length of the songs, then
          we use the next song otherwise we go to the beginning of the
          song list.
        */
        if (parseInt(_config2.default.active_index) + 1 < _config2.default.songs.length) {
          nextIndex = parseInt(_config2.default.active_index) + 1;
        } else {
          nextIndex = 0;
          endOfList = true;
        }

        /*
          Sets the next index.
        */
        nextSong = _config2.default.songs[nextIndex];
      }
    }

    /*
      Change the song after the next button has been pressed.
    */
    changeSong(nextSong, nextIndex);

    /*
    	If it's the end of the list and repeat is not on, do nothing.
    */
    if (endOfList && !_config2.default.repeat) {} else {
      /*
      If the song has ended and repeat is on, play the song.
      */
      if (!(songEnded && !_config2.default.repeat && endOfList)) {
        _core2.default.play();
      }
    }

    /*
      Sync the play pause elements and run the
      after next callback.
    */
    _playPauseElements2.default.sync();
    _callbacks2.default.run("next");

    /*
      If we repeated the song, run the repeat song callback.
    */
    if (_config2.default.repeat_song) {
      _callbacks2.default.run("song_repeated");
    }
  }
Sets the next song

@access public
@param {boolean} [songEnded=false] If the song ended, this is set to true
so we take into effect the repeat setting.