JavaScript speechSynthesis.speak() without user activation is no longer allowed since M71

speechsynthesis speak chrome not working
speechsynthesisutterance
jquery speechsynthesis
speechsynthesis angular
window speechsynthesis getvoices returns nothing
speechsynthesis mute
speechsynthesis speak new speechsynthesisutterance hey
html5 text to speech

I used speechSynthesis API in this way:

speechSynthesis.speak(new SpeechSynthesisUtterance("hello world"));

But right now I get error after update Google Chrome:

[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 speechSynthesisMessage @ application-2c16c437c2795ae01c0a8852e5f8da58dad99d6e17814a31f1eea19922c5ebd2.js:147

How I can fix this issue and ask permission?

This is part of Chrome's new policies regarding making sound from web-pages. You simply need your user to provide an user-gesture (for which you can find a list here) during the lifetime of the parent document (i.e the event may long be dead, as long as the user ever interacted with the page).

Note that these events can even traverse frames, so for instance, in StackOverflow, the simple fact that you do have to click on the "Run" button will make the inner frame allowed to execute this code:

const ut = new SpeechSynthesisUtterance('No warning should arise');
speechSynthesis.speak(ut);

JavaScript speechSynthesis Autoplay, I have tried to implement JavaScript speechSynthesis to play an audio speechSynthesis.speak() without user activation is no longer allowed  Remove SpeechSynthesis.speak without user activation (removed) This API is being abused by sites since it is one of the only remaining APIs which didn't adhere to

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.

[bug][speech][chrome] speechSynthesis.speak() without user , responsivevoice.js:136 [Deprecation] speechSynthesis.speak() without user activation is no longer allowed since M71, around December 2018  13 JavaScript speechSynthesis.speak() without user activation is no longer allowed since M71 Jan 19 '19 6 capistrano-env file permissions Jun 17 '15 5 Update `create_at` model attribute only if it is null or blank Jul 3 '15

If you set your site address as "trusted" in chrome://settings/content/sound it seems to enable sound and speech synthesis even without user interactions.

I use Chrome in a TV just as a system monitor, using kiosk mode and without any user interactions. It doesn't even have keyboard and mouse. Still, I was able to enable in some versions of Chrome/Chromium, but not in others.

Intent to Remove: speechSynthesis.speak without user activation , Deprecated in M70, slated for removal in M71. After deprecation, the plan is to cause speechSynthesis.speak to immediately fire a “not-allowed” error if specific autoplay rules are not satisfied. It's understaffed but the accessibility team is supporting it and hoping to put more resources into it in the future. The speak() method of the SpeechSynthesis interface adds an utterance to the utterance queue; it will be spoken when any other utterances queued before it have been spoken.

I resorted to swal("Click OK to speak").then(() => speakButton.click()); (with https://sweetalert.js.org) -- https://patarapolw.github.io/tts-api/?q=你好&lang=zh-CN&rate=0.8

Note that if (confirm("Click OK to speak")) speakButton.click() doesn't work.

SpeechSynthesis.speak(), The speak() method of the SpeechSynthesis interface adds an utterance to the When a form containing the text we want to speak is submitted, we Chrome Full support 33, Edge Full support 14, Firefox Full support 49, IE No support No, Opera Full support 21 User must explicitly enable this feature. To overcome a similar problem, I put getAudioContext().resume() as a first line into the touchStarted method, since you need to have a user input first anyways.

A simple hack, without needing a real user activity, is to execute a click event on a hidden button like so.

document.querySelector('button').click();
var msg = new SpeechSynthesisUtterance('Test');

Remove SpeechSynthesis.speak without user activation, This deprecation will cause speechSynthesis.speak to immediately fire an error if the document has not received user activation. This API is being abused by sites since it is one of the only remaining APIs CSS · JS/HTML  But I understand Google Chrome prevents auto play of any audio and gives an error [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

812767, Speech should not play without user gesture. at least on Android, we don't allow audio autoplay without user gesture: a page from playing audio via JavaScript, for example via the Web Audio API. UseCounter for speechSynthesis.speak that would be blocked with autoplay policy. The deprecation will target M71. I need any text to speech javascript library or function which works only browser. No any type of backend scripts. I tried with SpeechSynthesis but it doesn't work because of: [Deprecation] speechSynthesis.speak () without user activation is no longer allowed since M71, around December 2018.

Google Chrome: blocking Speech Synthesis API audio autoplay , Google Chrome will block audio autoplay on websites that use the Speech on desktop that may allow autoplay on sites even if the user did not interact with the Note that the browser may block JavaScript execution on that  The AudioContext was not allowed to start. It must be resumed (or created) after a user gesture on the page. [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

Speech Synthesis API Being Restricted in Chrome 71 Due to Abuse, Web developers can use the SpeechSynthesis API to convert text on a web page is being abused by sites and advertisements, and does not adhere to Google's Starting in Chrome 71, the SpeechSynthesis.speak method will be they feel more people abuse it then use it for good reason, which is why  A voice control - voice commands - speech recognition and speech synthesis javascript library. Create your own siri,google now or cortana with Google Chrome within your website. - sdkcarlos/artyom.js

Comments
  • So, we can call this speechSynthesis.speak(message); multiple times for 1 (initial) user interaction?
  • UPDATE: I'm using Chromium in Raspbian, seems it no longer comes with pre-installed voices. So I synth the voices elsewhere and sent them as audio files, working fine now even without user interactions.
  • I tried confirm() and alert(). Yeah, those clicks don't count, apparently.