It was extracting its sound files from a .swf file, using fm.playSound() to play them, and it would hang in most browsers as soon as sound was enabled.
So I extracted the sound files into separate .mp3 files, and am using Audio() to play them:
var str = "sounds/sound_" + ("00" + vel).substr(-2,2) + ".mp3" ;
var hdlAudio = new Audio(str);
This is working, initially... however, the nature of the program is that more and more balls (and therefore, sounds) are active as the display becomes more complex.
What I'm finding is that, with certain browsers (Firefox and Pale Moon), once a certain number of sounds are active, the system appears to get confused, and the program loses control of the sounds - meaning that, among other things, sound cannot be turned off, and not all sounds that *should* be playing, *are* playing...
Interestingly, this issue does not occur with MS Edge; I've had up to 26 balls in flight, and all sounds are working, and can be turned off/on. I haven't tested with Chrome yet.
Does anyone have any idea what is wrong here??
Note: the entire project is available for cloning here:
GitHub - DerellLicht/BallDroppings: port of ancient BallDroppings app, without dependence upon swf file for sounds[^]
If you just want to see it running, use this:
draw lines to block the stream and bounce the ball around,
click 'Options' and then 'Sounds' to turn sounds on.
modified 31-Mar-21 22:12pm.