How to stop or clear pervious song in HTML Media Element?

Hi, I am doing streaming music player in ionic 3 by using HTML Media Element. I want to pause or stop or clear the pervious song when i click the next song in my playlist. I attached my code below.


      this.url = songURL; = new Audio(this.url);;

      this.showSpinner = true;;"playing", (e) => {

  pause(){; = '';; = null; = new Audio(); =this.url; = 'none';


That’s easy to configure.
Just add = null;

to the next button.
This would work better if you have IDs per each track to dynamically unload each track as you load new ones.

@jamesharvey thanks for your information i will try it now

If you don’t have any other idea, try setTimeOut.

loadNextTrack() { = null;
setTimeout(() => {
        }, 500);


This will initially unload all stream then load the next song.