dasher-web
dasher-web copied to clipboard
speechSynthesis.speak() without user activation is no longer allowed
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.
That seems a rather big pain.. deferring might be best approach.
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.