Reputation: 29
We i am using SpeechSynthesisUtterance onboundary event not firing properly. Its stoping middle of the sentence sometime.
Anyone come across this case? Pleas help.
var utterance = new SpeechSynthesisUtterance();
utterance.lang = 'en-UK';
utterance.rate = 1;
utterance.onboundary = function(event){
console.log(event);
};
Upvotes: 2
Views: 1498
Reputation: 20881
This is a bug specifically with:
Source: Bugs.Chromium.org - Issue 521666: speechutterance onboundary event doesn't fire.
As stated by one of the developers...
Native speech synthesis on Mac OS X, Windows, and Chrome OS all support boundary events at the word level.
That is to say, if you are using the Chrome speech synthesis (non-native), you will get irregular behavior on these alternate languages.
Upvotes: 2
Reputation: 31
Seems to be an issue with garbage collection (https://bugs.chromium.org/p/chromium/issues/detail?id=509488#c11) If you store the utterances in a variable with global context it works:
window.utterances = [];
var utterance = new SpeechSynthesisUtterance( 'hello' );
utterances.push( utterance );
speechSynthesis.speak( utterance );
Upvotes: 3