Bug 191745 - Web Speech API: `speechSynthesis.clear()` removes utterances from following `speechSynthesis.speak(...)` as well
Summary: Web Speech API: `speechSynthesis.clear()` removes utterances from following `...
Status: NEW
Alias: None
Product: WebKit
Classification: Unclassified
Component: Accessibility (show other bugs)
Version: Safari 12
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Nobody
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2018-11-16 06:13 PST by Giovanni Piller Cottrer
Modified: 2018-11-18 23:46 PST (History)
4 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Giovanni Piller Cottrer 2018-11-16 06:13:38 PST
`speechSynthesis.clear()` removes following `speechSynthesis.speak(....)` instances as well.

JSFiddle: https://jsfiddle.net/4perg5cs/1/

Code for reproduction:

```
var synth = window.speechSynthesis;

var utterance1 = new SpeechSynthesisUtterance('How about we say this now? This is quite a long sentence to say.');
var utterance2 = new SpeechSynthesisUtterance('We should say another sentence too, just to be on the safe side.');
var utterance3 = new SpeechSynthesisUtterance('WebKit only speaks this.');

synth.speak(utterance1);

synth.cancel();


synth.speak(utterance2);
synth.speak(utterance3);

// actual result: only utterance3 is spoken
// expected result: utterance2 is spoken, then utterance3 is spoken
```

Note: adding multiple `speechSynthesis.speak(....)` before utterance3 won't change the actual result.
Comment 1 Giovanni Piller Cottrer 2018-11-16 06:15:00 PST
As reference, this doesn't happen on:
- Chrome 70.0.3538.102
- Firefox 63.0.1
Comment 2 Radar WebKit Bug Importer 2018-11-17 12:25:30 PST
<rdar://problem/46151521>
Comment 3 chris fleizach 2018-11-18 23:27:29 PST
(In reply to Giovanni Piller Cottrer from comment #1)
> As reference, this doesn't happen on:
> - Chrome 70.0.3538.102
> - Firefox 63.0.1

yea seems like we're not honoring this

" If it is not paused and no other utterances are in the queue, then this utterance is spoken immediately, else this utterance is queued to begin speaking after the other utterances in the queue have been spoken"

https://w3c.github.io/speech-api/speechapi.html#tts-attributes
Comment 4 chris fleizach 2018-11-18 23:42:03 PST
(In reply to chris fleizach from comment #3)
> (In reply to Giovanni Piller Cottrer from comment #1)
> > As reference, this doesn't happen on:
> > - Chrome 70.0.3538.102
> > - Firefox 63.0.1
> 
> yea seems like we're not honoring this
> 
> " If it is not paused and no other utterances are in the queue, then this
> utterance is spoken immediately, else this utterance is queued to begin
> speaking after the other utterances in the queue have been spoken"
> 
> https://w3c.github.io/speech-api/speechapi.html#tts-attributes

NSSpeechSynthesizer doesn't do any queuing by default, so we're getting bit by that
Comment 5 chris fleizach 2018-11-18 23:46:41 PST
(In reply to chris fleizach from comment #4)
> (In reply to chris fleizach from comment #3)
> > (In reply to Giovanni Piller Cottrer from comment #1)
> > > As reference, this doesn't happen on:
> > > - Chrome 70.0.3538.102
> > > - Firefox 63.0.1
> > 
> > yea seems like we're not honoring this
> > 
> > " If it is not paused and no other utterances are in the queue, then this
> > utterance is spoken immediately, else this utterance is queued to begin
> > speaking after the other utterances in the queue have been spoken"
> > 
> > https://w3c.github.io/speech-api/speechapi.html#tts-attributes
> 
> NSSpeechSynthesizer doesn't do any queuing by default, so we're getting bit
> by that

hmm, but SpeechSynthesis looks like it should be handling queueing