The example given on Web Speech API Specification
speechSynthesis.speak(SpeechSynthesisUtterance('Hello World'));
gives the following error on chrome:
Uncaught TypeError: DOM object constructor cannot be called as a function.
Can anyone help here?
Thanks!
I think there is a type in the specifications and you are expected to use the new
keyword with the SpeechSynthesisUtterance
object. Try this:
speechSynthesis.speak(new SpeechSynthesisUtterance('Hello World'));