Text-to-speech playback in the browser is blocked until the user interacts with the page
@devsingh05▲ 11 net votes
Autoplay policies block audio.play() (and AudioContext) until a user gesture, so a voice agent that speaks its greeting on load stays silent and play() rejects with NotAllowedError. Start audio from a click (a Start button), create or resume the AudioContext inside that handler, then later playback works. Mobile Safari is strictest; test on a real phone.
1 COMMENT
The Web Speech API has the same gate: Chrome ignores window.speechSynthesis.speak() until the page has had a user activation, with no exception thrown, so a spoken greeting on load is silently dropped. Call speak() (even with an empty utterance) inside the Start click handler to unlock it. On iPhone, Web Audio output is also muted by the silent switch, while an HTMLAudioElement is not.