Can't get sound to stop before end using Sound and SoundChannel classes

Using the Sound and SoundChannel classes I can load and play a sound asset in my HTML5 project. If allowed to play till the end, the sound stops automatically since 0 loops are specified. But this.channel.stop() has no effect, neither does this.sound.close(). Setting both of those to null also has no effect. Removing the screen that initiated the sound doesn’t remove the sound.

I based my code on the PlayingSound example. But the PlayingSound example actually doesn’t work. Clicking on the background doesn’t pause the sound as it supposed to. It only fades the sound out. Clicking the background not only fades the sound back in but also adds another copy of the same sound and the two sounds are out of sync.

Help!!!

Is this browser specific? I can’t remember it behaving this way before, I wonder if this is a regression in how Howler.js handles sounds?

Very browser dependent. The behavior I described is in Firefox for macOS. It works fine in Google Chrome for macOS.

In Safari for macOS, there’s no sound at all. I check channel.position every frame and in Safari the position does not change.

Update: I had used an ogg audio file. When using a MP3 files, Safari has the exact same behavior as Firefox.

Can you try replacing the howler.js file we have in Lime with a newer one from https://github.com/goldfire/howler.js ?

I could only find howler.min.js. Is that the same? If not, where do I find howler.js?

Yep, you can replace that with non-minified (or minified, either way) source from the Howler project, and experiment with newer/different versions

Looks like this is the same old problem: HTML5 SoundChannel.stop not working
Latest howler.js didn’t help.
I have this problem in Firefox with .ogg sounds.

I’m using lime 7.0.0, OpenFl 8.4.1 and Have 3.4.7.

I tried using the latest howler.min.js. I replaced the one that was in the /usr/local/lib/haxe/lib/lime/7,0,0 folder. Still didn’t work. I had two earlier versions of howler.min.js and tried putting each in the 7.0.0 folder and still no luck.

I also have folders for 6.2.0, 6.3.0, 6.3.1 and 6.4.0. I also have folders for OpenFl 7.1.0, 8.0.0, 8.0.2, and 8.2.2 in addition to 8…4.1. Are those older folders used at all?