Closed Bug 1258526 Opened 8 years ago Closed 8 years ago

The window.speechSynthesis.pause() makes the SpeechSynthesis.speaking equal true until browser restart and stop working if it is pressed at the tail end of the speaking text.

Categories

(Core :: Web Speech, defect)

45 Branch
x86_64
Windows 10
defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla49
Tracking Status
firefox49 --- fixed

People

(Reporter: brandonkeithbiggs, Assigned: m_kato)

References

Details

Attachments

(1 file)

User Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:45.0) Gecko/20100101 Firefox/45.0
Build ID: 20160315153207

Steps to reproduce:

Queue a text object to speak using the window.speechSynthesis.speak() function.
Next, setup a button to pause or resume speech when pressed.
First notice that there is a delay when the speech is run and the pause button is pressed. It can be a considerable delay, sometimes lasting almost up to a second.
Next press the pause button right before the speech ends. It should sound like it paused right as the text ended, even though you pressed space while the speech was still talking.


Actual results:

When you go to play the speech again, nothing happens. Even if you close and reopen the page the speech does not play. In order to get the speech to play again the whole web browser needs to be restarted.



Expected results:

First, speech should pause instantly, not waiting for any delay.
Second, I should be able to pause and resume even while no speech is queued.
Third, the speech should always work, even after it has been paused and resumed after it has finished.
Summary: The window.speechSynthesis.pause() makes the speech stop working on the page if it is pressed at the tail end of the speaking text. → The window.speechSynthesis.pause() makes the SpeechSynthesis.speaking equal true until browser restart and stop working if it is pressed at the tail end of the speaking text.
I just noticed that what is happening is SpeechSynthesis.speaking is always true after the pause is pressed at the tail-end of the text. There appears to be no way of making it false. Even when pause is false, the speech does not continue.
Component: Untriaged → Web Speech
Product: Firefox → Core
Brandon, could you test same test on the Nightly (48.0), too?   45.0 is not stable as Web Speech implementation (So we don't turn on it as default).
Flags: needinfo?(brandonkeithbiggs)
Is it possible to install the future build along side the non future build? Here is the html just in case you would like to try it. Just save it as an html file... Then pause the speech just before it ends. Press space to pause, f to read the state of the different flags on window.speechSynthesis.


<!DOCTYPE html>
<head>
<title>onboundary bug</title>
</head>
<body>
<button id="b1">Click me to talk</button>

<script>
var synth = window.speechSynthesis;

var press_function = function(e){
	if(e.key == " "){
		console.log("paused");
		synth.pause()};
	if(e.key == "f"){
		console.log("paused: " + synth.paused + "\npending: " + synth.pending + "\nspeaking: " + synth.speaking);
}

	};

var spk = function(){
	var u = new SpeechSynthesisUtterance("Hello people, I like cheese. I will win, I will eat food.");
	u.onboundary = function(event){console.log(event.name + ' boundary reached after ' + event.elapsedTime + ' milliseconds.');};
	synth.speak(u);
	};

b1.onclick = spk;
b1.onkeydown = press_function;

</script>
</body>
</html>
Flags: needinfo?(brandonkeithbiggs)
OK, I installed Nightly and yes, it still is the same.
I found another bug though that drove me in sain:
When I installed nightly, even though my old firefox was enabled with speech, both browsers gave me an error that SpeechSynthesisUtterance was not defined. In order to fix this, I had to go into about:config and uncheck and recheck speech.
OS: Unspecified → Windows
OS: Windows → Windows 10
Hardware: Unspecified → x86_64
Status: UNCONFIRMED → NEW
Ever confirmed: true
OK.  I make sense this.

Even if SAPI calls cancel, paused state on current SAPI instance isn't clear.  So, new speech instance doesn't start until resume is called.

So I think that we should create instance after cancel.
Assignee: nobody → m_kato
Blocks: 1268633
When using the following script, stop method cannot clear pause state on SAPI backend.

speech.pause();
speech.stop();

Since SPF_PURGEBEFORESPEAK doesn't clear previous speech state, we should create SAPI object per speech instead of recycling it.

Review commit: https://reviewboard.mozilla.org/r/51041/diff/#index_header
See other reviews: https://reviewboard.mozilla.org/r/51041/
Attachment #8749571 - Flags: review?(eitan)
I'm going to get to this next week, sorry for the delay.
Comment on attachment 8749571 [details]
MozReview Request: Bug 1258526 - Create SAPI object per speech to clear previous speech state at force. r?eeejay

https://reviewboard.mozilla.org/r/51041/#review48205

This looks good.
Attachment #8749571 - Flags: review?(eitan) → review+
https://hg.mozilla.org/mozilla-central/rev/d6c7ebc1417b
Status: NEW → RESOLVED
Closed: 8 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla49
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: