upvote
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.

reply
Largely not an LLM's work as far as I can tell: https://github.com/joshwcomeau/button-sounds

Also, here's the author's AI policy: https://www.joshwcomeau.com/ai-policy/

They're also a somewhat active user here.

reply
>After that, audio works.

untill you get stuck in some CORS permissions nightmare like try to click through a link or expose iFrames etc this is as much W3C as it is Apple also big blocker for immersive web (webxr) permissioning just gets in the way

reply
deleted
reply
> 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.

So anyone who wants to defy the reason for this limitation simply needs to lead the visitor to click something that doesn't reload the page? Instead of "unmute," maybe a throbbing "next" arrow or any innocuous link such as a menu item...

I wonder if some set of navigation-like things, such as doing a history.pushState() to change the address bar, cancels what this trick would otherwise achieve.

reply
Yeah more or less. I’ve seen people put a big invisible button over the whole page that plays a silent audio clip when pressed, so any touch interaction enabled audio. Last I checked it worked fine.
reply
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.

reply
I believe the intent of the silent switch is to silence the ringer, not to mute the whole OS. For example, music keeps playing at the selected volume even when you activate silent mode.

However, a bunch of 3rd-party apps misinterpreted the meaning of this signal, so for example, a number of popular games mute all of their audio when the silent switch is enabled, meaning I have to un-silence the ringer just to hear game audio.

reply
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.

reply