Santhosh Bolla
Santhosh Bolla

Reputation: 29

SpeechSynthesisUtterance onboundary event not firing properly

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

Answers (2)

HoldOffHunger
HoldOffHunger

Reputation: 20881

This is a bug specifically with:

  • Chrome
  • Using the Extra Set of Chrome Voices (i.e., if you use Google UK Female, for instance, as opposed to the infamous Microsoft Dave).

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

Matthew Coyle
Matthew Coyle

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

Related Questions