logoalt Hacker News

hn-aarvin • today at 5:10 AM • 0 replies • view on HN

> Frustratingly, browsers can decide to block a website from playing any sound. iOS Safari seems particularly strict about this. So, if you’re not hearing a click sound when tapping the big red button, please check out this website on a desktop computer.

FYI, setting `navigator.audioSession.type` to `"playback"` will allow the sounds to play on iOS even when silent mode is on. (It defaults to `"ambient"`.)

On iOS versions below 16.4, this won't work as reliably; there are hacks you can do with `AudioContext`^[1] instead.

[1]: https://github.com/feross/unmute-ios-audio