Kill the browser completely, reopen the browser and start text-to-speech with speechSynthesis.speak(string);
speechSynthesis.pause(); won't work till you refresh the page.
Same can be seen at, https://developer.microsoft.com/en-us/microsoft-edge/testdrive/demos/speechsynthesis/
This happens on both Mac and Windows, chrome 70.
Does anybody know a workaround?
Does anybody know a workaround?
If you speak an empty text first it pauses on first load.
let btnSpeak = document.getElementById("btnSpeak");
let spoken = false;
speechSynthesis.cancel();
function speak() {
btnSpeak.disabled = true;
let msg = new SpeechSynthesisUtterance();
if (!spoken) {
let mt = new SpeechSynthesisUtterance();
mt.text = " ";
window.speechSynthesis.speak(mt);
spoken = true;
}
msg.text = "Use a long sentence to give time to hit pause";
msg.voice = voices[0];
msg.lang = voices[0].lang;
msg.onend = function(event) {
btnSpeak.disabled = false;
};
window.speechSynthesis.speak(msg);
}