Making a queue into a stack for my music player app – Angular JS

So I have this music player app template that I’m using, developed using Angular JS and Angular Media Player. Visit to see it live.
Basically, what I wanted to have changed is the queue made into a stack. It’s kind of not user friendly in that, if I click one song, and it begins playing, if I change the song, it adds to the queue and doesn’t start playing until the first song is done. Naturally, a user would expect that if they click another song while one is already playing, that the last song they clicked would start playing automatically and the song that was playing before they clicked the last song, would stop playing. I’m not sure how to go about implementing this and was wondering if anyone here would have experience with this. This is what I have for adding a song and automatically playing it.

this.addSong = function (audioElement, mediaPlayer) {
    setTimeout(function () {;
      }, 1000);


<div class="music-listing__number">
    {{ $index+1 }}
    <div class="play-button" data-ng-controller="NotifyCtrl">
       <button ng-click="notify('info');generalPlaylist.addSong(song, mediaPlayer)" class="btn btn-primary btn-sp"><i class="fa fa-play-circle"></i>

I already spoke to the developers of the app and they told me

“I dont think that is possible without some big changes to the player. Right now we dont really have this feature. You would need to look under and find a way to integrate on the site if it supports it.”

Source: AngularJS