The following code works for onstart and onend, but not for voices, onpause, onresume or the manual speechSynthesis.paused interval. Why?
Browser: Chrome Version 47.0.2526.111 m
or:
var u = new SpeechSynthesisUtterance();
var voices = speechSynthesis.getVoices();
u.voice = voices[0];
console.log(voices);
u.text = 'Hello World';
u.onstart = function (event) {
console.log('Started');
};
u.onend = function (event) {
console.log('Ended');
};
u.onpause = function(event) {
console.log('Paused');
};
u.onresume = function(event) {
console.log('Resumed');
};
setInterval(function() {
if(speechSynthesis.paused)
console.log("Now it's paused");}
,100);
setTimeout(function(){speechSynthesis.speak(u);},2000);
setTimeout(function(){speechSynthesis.pause();},3000);
setTimeout(function(){speechSynthesis.resume();},6000);
console.log(u);