I am creating a craps game using javascript. I have pretty much everything working the way its supposed to be, just have to make a few minor adjustments, but the part I am stuck on is creating some type of type function, or possibly using the setTimeout(). I have a .wav file playing the sound of dice being rolled, but what I would like to do is have the text if the user won or lost appear after the sound of the dice being rolled(after the .wav file stops playing the dice rolling sound).
I am creating a craps game using javascript. I have pretty much everything working
Share
I don’t think you can detect any event about the sound file ending.
You should play the sound, then start a setTimeout function with a hard-coded duration.
Eg: