chr15m / jsfxr

JavaScript sound effects generator.
http://sfxr.me
The Unlicense
271 stars 25 forks source link

sfxr.me does not play sound in Safari but original fork does #1

Closed chr15m closed 4 years ago

chr15m commented 4 years ago

@gingerbeardman reported:

I noticed your http://sfxr.me does not play sounds in Safari, but the original code does: http://github.grumdrig.com/jsfxr/

chr15m commented 4 years ago

Hey @gingerbeardman I've been investigating this and I replicated it on my device, but then I discovered I could make the sound play if I had headphones plugged in and I saw this: https://stackoverflow.com/questions/21122418/ios-webaudio-only-works-on-headphones

When I turned off the physical mute button on the side of my old iPad it started producing sounds. I can't work out if this is a bug or not.

gingerbeardman commented 4 years ago

How odd!

I'm using Safari on desktop macOS, but I can try with headphones later.

Sorry I should have made that clear originally.

chr15m commented 4 years ago

If you can get a console log for me that would be super helpful. I only have one Apple device and it's very old.

gingerbeardman commented 4 years ago

Here we go!

Screen shot 2020-07-25 at 11 03 44

gingerbeardman commented 4 years ago

Maybe use a shim so one code path can run on all browsers?

https://developer.mozilla.org/en-US/docs/Web/Guide/Audio_and_video_delivery/Web_Audio_API_cross_browser

chr15m commented 4 years ago

@gingerbeardman have pushed a possible fix. Any chance you can test it? Here: 42a643f

gingerbeardman commented 4 years ago

Works a treat! Nicely done.

tested at http://sfxr.me

Thank you

chr15m commented 4 years ago

Great, thanks for testing!