I used speechSynthesis API in this way:
speechSynthesis.speak(new SpeechSynthesisUtterance(\"hello world\"));
But right now I get error aft
This error means entire document (Website) has no user interaction and Google Chrome update its policy regarding making sound from the website without user interaction.
User interaction means: click, dblclick, mouseup, pointerup, reset, submit etc.
Solution:
So, if you want to run speechSynthesis.speak();
without real user interaction, then you just create temporary user interaction using a method like .click()
, etc.