SpeechSynthesisUtterance.onboundary not working in mobile

Viewed 55

I set the onboundary property of a new SpeechSynthesisUtterance object to a callback. But in mobile the callback never fires.

const speech = new (window.SpeechSynthesisUtterance || window.webkitSpeechSynthesisUtterance)();
speech.volume = 1;
speech.rate = 1;
speech.onboundary = console.log;
speech.text = "Hello World. Lorem Ipsum dolor sit amet consectour adpiscing elit";
window.speechSynthesis.speak(speech)

This code doesn't even give any errrors. Even in Chrome Browser the code works well and it begins to speak the text but the onboundary event is never fired and nothing is logged to the console

Please help.

1 Answers

This is a known issue by the Chromium team that apparently they are not going to fix.

Not all platforms provide speech engines that fire boundary events at the word level, particularly Android. There is no upstream API for them to use.

Firefox and Edge should fire boundary events on Android, however. You can check out this example on different browsers to see if the words are highlighted while spoken. If not, the browser is not firing boundary events.

Related