Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 29 additions & 0 deletions FAQ.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
- [My voices are gone or have changed after I updated my OS](#my-voices-are-gone-or-have-changed-after-i-updated-my-os)
- [Error 'EasySpeech: text exceeds max length of 4096 bytes.'](#error-easyspeech-text-exceeds-max-length-of-4096-bytes)
- [Safari plays speech delayed after interaction with other audio](#safari-plays-speech-delayed-after-interaction-with-other-audio)
- [speechSynthesis.speak function not working on iOS Safari when triggered programmatically](#speechsynthesisspeak-function-not-working-on-ios-safari-when-triggered-programmatically)

<!-- END doctoc generated TOC please keep comment here to allow auto update -->

Expand Down Expand Up @@ -137,3 +138,31 @@ You can try to speak with `volume=0` before your actual voice is intended to spe

Related issues:
- https://github.com/jankapunkt/easy-speech/issues/51

## speechSynthesis.speak function not working on iOS Safari when triggered programmatically

The issue on iOS devices is likely due to WebKit's autoplay restrictions on speech synthesis.
Safari blocks `speechSynthesis.speak()` when it's not triggered by a direct user interaction, such as a button click.
If invoked from an asynchronous source like an API response
Copy link

Copilot AI Apr 30, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider clarifying the sentence by explicitly stating that a dummy utterance must be triggered by a visible user action (e.g., a button click), so readers can better understand where to bind this workaround.

Copilot uses AI. Check for mistakes.
— especially within a useEffect — it fails because there's no associated user gesture.

**Workaround:**
To bypass this restriction, initiate a minimal call to speechSynthesis.speak()
during an actual user interaction (e.g., clicking a button or sending the first message).

In order to not disturb the user, you can use a dummy utterance like this:

```js
await EasySpeech.speak({
text: " ", // whitespace
volume: 0, // muted
rate: 10 // very fast
});
```

This creates a "trusted session" in Safari. Once this is done:

Subsequent calls to `.speak()` will work programmatically, even without user interaction.

Related issues:
- https://github.com/leaonline/easy-speech/issues/366
Loading