speechSynthesis.speak() speechSynthesis.pause() call sequence handled incorrectly
Categories
(Core :: Web Speech, defect)
Tracking
()
People
(Reporter: czerny.jakub, Unassigned)
References
Details
Attachments
(3 files)
User Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:100.0) Gecko/20100101 Firefox/100.0
Steps to reproduce:
Version: 98.0a1 (2022-01-23) (64-bit)
- Repeatedly evaluate following snippet in DevTools console
speechSynthesis.cancel()
utt = new SpeechSynthesisUtterance("hello world")
utt.addEventListener('start', event => console.log('start'))
utt.addEventListener('end', event => console.log('end'))
utt.addEventListener('error', event => console.log('error'))
utt.addEventListener('pause', event => console.log('pause'))
utt.addEventListener('resume', event => console.log('resume'))
speechSynthesis.speak(utt)
speechSynthesis.pause()
console.log('speaking=', speechSynthesis.speaking, 'paused=', speechSynthesis.paused)
Actual results:
During first evaluation the text is read and events 'start' and 'end' are fired.
During subsequent evaluations no text is read and no events are fires.
All evaluations produces console output
speaking= false paused= true
If after second and following evaluations speechSynthesis.resume() is called, the text is read and events start and end are fired.
Expected results:
All evaluations should not read any text and events 'start' and 'pause' should be fired.
speechSynthesis should end up in state speaking=true, paused=true - already reported as Issue 1751621
Calling speechSynthesis.resume() after the second and following evaluations should read the text and fire events resume and end.
Updated•4 years ago
|
Comment 1•4 years ago
|
||
Comment 2•4 years ago
|
||
Comment 3•4 years ago
|
||
Hi,
I've tried to reproduce on my end:
Actual results:
During first evaluation the text is not read and events 'start' and 'end' are not fired, but speaking= false paused= true instead (as in my screenshot)
During subsequent evaluations no text is read and speaking= false paused= true events are fired.
If after second and following evaluations speechSynthesis.resume() is called, the text is read and events start and end are fired.
Let me know if I missed any steps to be able to reproduce exactly what you're experiencing.
Best,
Clara
| Reporter | ||
Comment 4•4 years ago
|
||
Hi,
- I can confirm that your console screenshot seems to correspond to your description
- As far as I can tell I did the same thing (screenshot attached) on current Nightly 98.0a1 (2022-01-29) (64-bit) and result was as described in original report - text is read and events
startandendare fired only during first evaluation. Subsequent evaluations (there are two of them in the screenshot) are eventless and silent. I'm not sure what might be the cause of the difference. - Both actual scenarios seems buggy to me though, since IIUIC
- state
speaking= false paused= trueshould never happen - wheneverpausedis set,speakingshould be set too - when speech synthesis becomes paused,
pauseevent should be fired - repeated evaluation should produce same results
- state
Regards
Jakub
Comment 5•4 years ago
|
||
The severity field is not set for this bug.
:anatal, could you have a look please?
For more information, please visit auto_nag documentation.
Updated•3 years ago
|
Comment 6•3 years ago
|
||
Like I said in bug 1751621, calling speak/pause/resume/cancel are asynchronous, so you can't expect the state of the synthesis to be determinate when they are called. A more reliable way of writing the snippet above is this:
speechSynthesis.cancel()
utt = new SpeechSynthesisUtterance("hello world")
utt.addEventListener('start', event => {
console.log('start')
speechSynthesis.pause()
})
utt.addEventListener('end', event => console.log('end'))
utt.addEventListener('error', event => console.log('error'))
utt.addEventListener('pause', event => {
console.log('pause')
console.log('speaking=', speechSynthesis.speaking, 'paused=', speechSynthesis.paused)
})
utt.addEventListener('resume', event => console.log('resume'))
speechSynthesis.speak(utt)
Updated•3 years ago
|
Description
•