Sound disappears after a prompt() call

The main issue is that here the browser seems to have an issue :frowning: I will try on my mac a bit later today.

Yup basically on a prompt or alert Safari is suspending the audio context and for some reason it needs time before we can resume it… I love browser compatibility :slight_smile:

You can add that right after your prompt to force the context to resume:

setTimeout(() => { 
  BABYLON.Engine.audioEngine.audioContext.resume(); 
}, 500); 

Thank you! I thought there would be a solution.

I guess people having this problem and needing to make it work in Safari will implement their own prompt in one way or the other instead of relying on the javascript prompt.

1 Like

I use an alternative to the dialog box (alert, prompt …) more personalized in which we can add HTML (that’s what interests me)
This can perhaps solve your problem.

Demo: jQuery Alert Dialogs