Howler.js: I can't stop all sounds in one web page

Created on 28 Mar 2020  路  8Comments  路  Source: goldfire/howler.js

I init some sounds in one web page, I want other sounds will stop when I playing the one, BUT I can't find a global method to do it

feature

Most helpful comment

Sorry, I misunderstood what you were asking. These would be easy to add, though the only thing to keep in mind is that I'm not sure there would be a way to add a global play/resume method if you stop/pause globally.

All 8 comments

Same problem here. Can someone work on Howler.stop() and Howler.pause() please?

The global Howler methods are still working in my testing. Can you provide a sample of where they aren't working?

Howler.stop(), seems like there is no such method. And thanks for the quick response.

Sorry, I misunderstood what you were asking. These would be easy to add, though the only thing to keep in mind is that I'm not sure there would be a way to add a global play/resume method if you stop/pause globally.

So, is Howler.stop() available or not?
the docs say it is but I cant find it, is it in development at the moment?

@bootleg-icarus I have seen v2.2.0 include this feature released 4 days ago 馃ぃ

Howler.stop() is not found in "@types/howler": "^2.2.0"

I have updated to version 2.2.0 but still the same behavior "player.stop();" It does not stop the loading process so I'm still having 2 songs playing.
I'm using howler for My streaming Web App

playSong(){
player = data.howl = new Howl({
          src:[data.url],
          html5:true,
          autoUnlock:true,
          onplay:()=>{
          this.isPlaying = true;
            this.isBufferingSong =false;
            this.setMediaSessionData();
            this.setSongDuration( parseInt(this.currentSong.howl.duration))
          },
          onload:()=>{
            window.audio = player;
            window.commit('setAudioLoaded', { loaded: true })
          },);
     } 
 player.play();
}

nextSong:function(){
      let playListSize = this.playableList.length-1;
      if( this.currentSongIndex < playListSize){
        let player = this.currentSong.howl;
        if (player) player.stop(); // This is where the Audio should be stoped 
        this.isPlaying =false;
        this.currentSongIndex++;
        this.playSong();
}
Was this page helpful?
0 / 5 - 0 ratings