speechSynthesis cancel wipes out speak calls following directly after
Categories
(Core :: Web Speech, enhancement)
Tracking
()
People
(Reporter: masterjames, Unassigned)
Details
(Whiteboard: [specification][type:bug])
Attachments
(1 obsolete file)
What did you do?
If you have the speechSynthesis.speaking at the time and call cancel you then call speech to start a new.
What happened?
It fails to play the new sound requested directly after a previous utterance speaking had cancel called.
It takes maybe 500 milliseconds before a new speak call for an utterance will not get cancelled too.
What should have happened?
You should maybe have a function to halt/stop and removal all utterances from the speechSynthesis queue (especially since it's a singlton styled class I believe [aka only one instance]). BTW I like the idea of keeping the utterances for reuse later I don't think that has any baring but is also what makes sense.
Is there anything else we should know?
Well there seems to be a couple of option to cover both that there is a way to just stop everything and start a new, 'speak' could have an option to stop and clear the queue before playing the new sound and not queuing it. As in some instances they could be quite a read.
Anyway it's an inconvenience to the coder it seems unclear how to do that and my attempts resulted in a setTimeout delay after canceling of about 500 millsecs to assure it will play the utterance desired instead.
| Reporter | ||
Comment 1•6 years ago
|
||
I'm in Chrome but you have the document I use maybe I'm in the wrong location for reporting this?
| Reporter | ||
Comment 2•6 years ago
|
||
| Reporter | ||
Comment 3•6 years ago
|
||
Cross posting to Chromium
https://bugs.chromium.org/p/chromium/issues/detail?id=924503
Updated•6 years ago
|
Not sure if this is the correct component, but please correct it as such if this is not the case.
Comment 5•6 years ago
|
||
This issue should be in web speech component.
| Reporter | ||
Comment 6•6 years ago
|
||
| Reporter | ||
Comment 7•6 years ago
|
||
| Reporter | ||
Comment 8•6 years ago
|
||
I've got more to add to this now.
https://jsfiddle.net/MasterJames/3nxygaze/20/
It seems putting a call to ss.resume() after the cancel() and second speak() call, will achieve the desired effect but this is not intuitive or properly documented I guess.
| Reporter | ||
Comment 9•6 years ago
|
||
see additional info on other thread
https://bugzilla.mozilla.org/show_bug.cgi?id=1523920
Comment 10•6 years ago
|
||
(In reply to masterjames from comment #8)
I've got more to add to this now.
https://jsfiddle.net/MasterJames/3nxygaze/20/It seems putting a call to ss.resume() after the cancel() and second speak() call, will achieve the desired effect but this is not intuitive or properly documented I guess.
I can hear a voice saying "not playing anything after clear" in Firefox Nightly on my MacBook.
specifically, the following code works for me.
let uttr1 = new SpeechSynthesisUtterance("some message that goes on longer");
let uttr2 = new SpeechSynthesisUtterance("playing anything after cancel");
speechSynthesis.speak(uttr1);
speechSynthesis.cancel();
speechSynthesis.speak(uttr2);
It works in the first time but not the second time. In the second time, the problem is that the utterance is already used. This problem will be solved in bug 1523920. It's a different problem.
masterjames, can you still reproduce this problem?
Comment 11•5 years ago
|
||
The problem is still there in the latest Firefox (72.0.1 build 20200107212822).
It says in the chrome bug report how to fix it. (Pass NULL instead of empty string to API inside clear).
<html>
<head>
<meta charset="utf-8">
<title></title>
</head>
<body>
<script>
const synth = window.speechSynthesis;
synth.addEventListener("voiceschanged", populateVoiceList);
var voices = null;
function populateVoiceList() {
voices = synth.getVoices();
}
populateVoiceList();
var u = new SpeechSynthesisUtterance("First");
var u2 = new SpeechSynthesisUtterance("Second");
u.voice = voices[0];
u2.voice = voices[0];
synth.speak(u);
synth.cancel();
synth.speak(u2);
</script>
</body>
</html>
Comment 12•5 years ago
|
||
Cancel now leaves current utterance to be dequeued on end. Dequeuing current
utterance immediately would result in a newly queued utterance unintentionally
dequeued on end.
Updated•5 years ago
|
Updated•5 years ago
|
Updated•5 years ago
|
Comment 13•5 years ago
|
||
In the version 77.0.1 20200602222727.
When opening the sample I posted above in a new tab, it works (it says "second"). But reloading the page, either using F5 or the location bar and enter, doesn't create any sound at all.
This must be a defect. I suggest changing the bug type from "enhancement" to "defect".
Comment 14•3 years ago
|
||
Clear a needinfo that is pending on an inactive user.
For more information, please visit auto_nag documentation.
Updated•3 years ago
|
Description
•