dasher-project / dasher-web

Dasher text entry in HTML, CSS, JavaScript, and SVG
https://dasher-project.github.io/dasher-web/browser/
MIT License
43 stars 8 forks source link

speechSynthesis.speak() without user activation is no longer allowed #102

Open sjjhsjjh opened 3 years ago

sjjhsjjh commented 3 years ago

Current Dasher Version Six logs the following error on load in some cases:

[Deprecation] speechSynthesis.speak() without user activation is no longer allowed since M71, around December 2018. See https://www.chromestatus.com/feature/5687444770914304 for more details

This happens if Speak On Stop is selected at page load time. I think it's because Dasher speaks the phrase "Speech is now active" at that time to warn the user that their browser will make noises.

Not sure what to do about this but maybe defer speaking the warning until the user moves the pointer or does something else that counts as activation.

Looks like current code to speak the warning is here:
https://github.com/dasher-project/dasher-web/blob/debdb6022d42f378b0931071ccdd376455ce7df1/browser/dasher/userinterface.js#L264
That's the UI listener though, which gets invoked by the control panel value loader. Awkward.

willwade commented 2 years ago

That seems a rather big pain.. deferring might be best approach.

gavinhenderson commented 2 years ago

I had similar issues with morse-learn. I used hound in the end because it seemed mostly to hack around the issue, but it wasnt totally reliable https://www.npmjs.com/package/hound

We could solve this problem for the desktop version by offloading the synthesis to the main process in electron. You also might be able to override the security check in electron somehow.

Although this doesn't help us when we go to other platforms.