New issue
Advanced search Search tips

Issue 509488 link

Starred by 8 users

Issue metadata

Status: Untriaged
Owner: ----
Components:
EstimatedDays: ----
NextAction: ----
OS: Windows
Pri: 2
Type: Bug



Sign in to add a comment

Web Speech API: 'end' event of SpeechSynthesisUtterance object is not dispatched sometimes

Reported by gtk2kri...@gmail.com, Jul 13 2015

Issue description

UserAgent: Mozilla/5.0 (Windows NT 6.3; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/43.0.2357.132 Safari/537.36

Steps to reproduce the problem:
<!-- test.html -->
<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8" />
  <title>Web Speech API onend event test</title>
</head>
<body>
  <script>
    var speechTexts = ['こんにちは', 'おはようございます'];
    (function speech(text) {
      if (text) {
        var synthes = new SpeechSynthesisUtterance();
        synthes.voiceURI = 'Google 日本語';
        synthes.volume = 1; // 0~1   
        synthes.rate = 1;   // 0.1~10
        synthes.pitch = 1;  // 0~2
        synthes.text = text;
        synthes.lang = 'ja-JP';
        synthes.onend = function () {
          console.log('end', Date.now());
          var text = speechTexts.shift();
          speech(text);
        }
        speechSynthesis.speak(synthes);
      }
    })(speechTexts.shift());
  </script>
</body>
</html>

What is the expected behavior?
"こんにちは"の後に"おはようございます"とスピーチする。

What went wrong?
ページのリロードを繰り返すと"こんにちは"のスピーチが終わったあとに、SpeechSynthesisUtteranceオブジェクトのonendイベントが10回に1回ぐらいの割合で発生せず、"おはようございます"がスピーチされない。

Did this work before? N/A 

Chrome version: 43.0.2357.132  Channel: stable
OS Version: 6.3
Flash Version: Shockwave Flash 18.0 r0
 

Comment 1 by tkent@chromium.org, Jul 13 2015

Labels: -Cr-Blink-JavaScript Cr-Blink-Speech
Summary: Web Speech API: 'end' event of SpeechSynthesisUtterance object is not dispatched sometimes (was: Web Speech API SpeechSynthesisUtteranceオブジェクトのonendイベントが発生しない時がある。)
What is the expected behavior?
 Speak "こんにちは", then "おはようございます".

What went wrong?
If we repeatedly reload the page, "onend" handler of the SpeechSynthesisUtterance object for "こんにちは" is not called once per 10 times, and "おはようございます" is not spoken.

Labels: Needs-Feedback
[triage] what feedback is needed here?
Labels: -Needs-Feedback
Owner: dmazz...@chromium.org
Status: Assigned
I'm clearing the feedback label since it looks like the original report has the full source for a repro. Sending to dmazzoni@ since this appears to be related to speech synthesis.

Comment 5 by osy...@gmail.com, Sep 12 2015

Any ETA on when this might be fixed?
Labels: Hotlist-Recharge
This issue likely requires triage.  The current issue owner maybe inactive (i.e. hasn't fixed an issue in the last 30 days).  Thanks for helping out!

-Anthony
Status: Available
Owner: ----
I confirm this issue is still present in Chrome 47.0.2526.106.
I also believe I am seeing this issue.  I followed a stackoverflow suggestion and wrapped the call to window.speechSynthesis.speak() in a setTimeout and that seems to guarantee the onend callback.  This seems to imply a timing issue.

http://stackoverflow.com/questions/23483990/speechsynthesis-api-onend-callback-not-working
I found that if SpeechSynthesisUtterance instance will be stored in other scope (for example in global variable) onend event will work.

Please see examples:
1) end event does not work - https://jsfiddle.net/pilyugin/qt82j1yy/
2) end event workaround with global storing - https://jsfiddle.net/pilyugin/dgygqLw2/

It seems like garbage collector removes utterance object before end-event is fired.
Project Member

Comment 12 by sheriffbot@chromium.org, Jan 20 2017

Labels: Hotlist-Recharge-Cold
Status: Untriaged (was: Available)
This issue has been available for more than 365 days, and should be re-evaluated. Please re-triage this issue.
The Hotlist-Recharge-Cold label is applied for tracking purposes, and should not be removed after re-triaging the issue.

For more details visit https://www.chromium.org/issue-tracking/autotriage - Your friendly Sheriffbot
I had this problem in Chrome 70, then upgraded to 71 and I wasn't able to reproduce it again. It might have been fixed. I can't really confirm though.

Sign in to add a comment