Response title
This is preview!
I have tried to implement JavaScript speechSynthesis to play an audio on a page where there are no user interaction. I am accessing that page methods using ajax call. and onsuccess i would like to play audio output. 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
function speaktext() {
if ('speechSynthesis' in window) {
var msg = new SpeechSynthesisUtterance();
var voices = window.speechSynthesis.getVoices();
msg.voice = voices[1];
msg.rate = 1;
msg.pitch = 1;
msg.text = 'hello';
speechSynthesis.speak(msg);
}
else {
alert(' Ah man, speech synthesis isnt supported.');
}
}
if i put this function in a page with button click event it works fine.
So are there any ways to prevent the Chrome error or any alternative jquery pluginsavailable?
© 2013 jQuery Foundation
Sponsored by and others.