logoalt Hacker News

masenf • today at 4:21 AM • 3 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.

While I understand this behavior from Apple in a user-first perspective and do find audio on mobile web to be annoying in most cases, an easy way to allow audio to play on an iPhone that isn't "use a desktop" seems to be flipping the hardware switch to turn off silent mode.

I'm not proud to admit it took 5 minutes of poking and a Google/Gemini search to figure that out...


Replies

josephg • today at 5:07 AM

The general rule is that audio in a tab on ios is banned until a user initiated event (eg a play button) plays audio. After that, audio works.

After a lot of trial and error, I've taken to putting a button on any page I make that uses audio with the label "Click here to unmute". Have it play a silent audio clip when it's pressed. After that, audio works.

The UI on this page should work fine on ios if the big red play button simply plays audio directly via webaudio. Who knows how it's actually coded though. It looks like an LLM's work. Probably a mess.

➕ show 4 replies
al_borland • today at 4:52 AM

Having audio in the browser respect the silent mode switch seems perfectly reasonable.

I would find it frustrating if my phone was set to silent and it played button noises on a website.

➕ show 1 reply
Barbing • today at 4:40 AM

Dev should be able to work around it though a minimum one user tap on page should be required, IIRC.

RE: your solution - For iPhones with action buttons, can disable silent mode in control center.