lars

howler and stooping multiple howl objects

Recommended Posts

Hey

I´m having some problems to stop multiple howl objects:

I¨m doing as the following when i starting multiple sounds:

 

this.soundEventOtherObj = new Howl({
                        src: [this.asset.get("sound/" + pathObj[ii].sound)],
                        autoplay: true,
                        loop: false

                    });

                    this.collectSounds[ii]=this.soundEventOtherObj;

                    console.log(this.collectSounds);

                    this.collectSounds[ii].play();

Its a part of a loop. I collect the howl objects in a array to be able to stop them later.

 

Så to "restart the sounds" (part of drag and drop) i have to stop the howl objects, and do as the following;

 for (let iii = 0; iii < this.collectSounds.length; iii++) {
               
              
                this.collectSounds[iii].stop();
                this.collectSounds = [];
            }

If i use audioSprite, where im only use one howl object, everything works fine. But unfortunately I cannot in this project.

Is there a way to call multiple sounds on one howl object?

 

 

Share this post


Link to post
Share on other sites

You might need to store the 'sound ID' in addition to the howler object when you play a specific sound so you can stop it later eg.

var soundID = sound.play()

sound.stop(soundID)

 

Edited by mentuat

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...

  • Recently Browsing   0 members

    No registered users viewing this page.