/* $timeout.cancel(timer); */
window.speechSynthesis.onvoiceschanged = function(e) {
voices = speechSynthesis.getVoices();
};
window.speechSynthesis.onvoiceschanged();
var msg = new SpeechSynthesisUtterance();
function speak(text) {
msg.text = text;
msg.volume = 1;
msg.rate = 0.8;
msg.pitch = 1;
msg.voice = voices[4];
window.speechSynthesis.speak(msg);
}
function speak1(text) {
msg.text = text;
msg.volume = 1;
msg.rate = 0.8;
msg.pitch = 1;
msg.voice = voices[3];
window.speechSynthesis.speak(msg);
}
msg.onend = function(event) {
console.log('Finished in ' + event.elapsedTime + ' seconds.');
};
clearTimeout(timer1);
var timer1 = setTimeout(function(){
speak("Order No. 11"); },0);
clearTimeout(timer2);
var timer2 =setTimeout( function(){speak1("Order No. 11"); },5000);