1

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?

ojas pote
  • 13
  • 1
  • 6
  • Hi - there doesn't seem to be a question here? If this is a bug report for Chrome you will need to report it to Google, not post it on Stack Overflow. – Ant P Nov 02 '18 at 08:25
  • Not sure if this is a Chrome bug or Speech Utterance issue. – ojas pote Nov 02 '18 at 12:51

1 Answers1

0

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);
}
Frazer
  • 1,049
  • 1
  • 10
  • 16