I used speechSynthesis API in this way:
speechSynthesis.speak(new SpeechSynthesisUtterance(\"hello world\"));
But right now I get error aft
Although I haven't found any way to ask permission, the user can enable permission in Google Chrome:
Click on the icon on the left of the URL bar, and open Site settings
Change the Sound setting from "Automatic (default)" to "Allow"
After doing that, the site will be able to make sounds without any user interaction, including speech.
Unfortunately, I haven't found a way in code to know whether this is working or not. (Perhaps we could try one of the other audio APIs and see if it responds with an error message.)