Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Defining what should happen if an utterance is changed after passing it to speak() #76

Open
TimothyGu opened this issue May 15, 2020 · 1 comment

Comments

@TimothyGu
Copy link
Member

Consider the following case:

utterance = new SpeechSynthesisUtterance('hello world');
speechSynthesis.speak(utterance)
utterance.text = 'hello world two';

The spec currently says

If changes are made to the SpeechSynthesisUtterance object after calling this method and prior to the corresponding end or error event, it is not defined whether those changes will affect what is spoken, and those changes may cause an error to be returned.

but it's not very satisfactory, as the web platform tries very hard to avoid any possible undefined behavior.

Chrome seems to “snapshot” the actual utterance information at the time of the speak(), which sounds like a good thing to specify.

Also see #29.

@TimothyGu
Copy link
Member Author

On the other hand, the second of the following says "hello world two" in Chrome:

utterance = new SpeechSynthesisUtterance('hello world');
utterance2 = new SpeechSynthesisUtterance('hello world again');
speechSynthesis.speak(utterance)
speechSynthesis.speak(utterance2)
utterance2.text = 'hello world two';

So the internal timing of the SpeechSynthesis queue is actually observable, which seems fairly suboptimal.

cc @foolip

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant