Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/google-chrome/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript speechSynthesis.speak和ONED触发之间的显著延迟_Javascript_Google Chrome_Text To Speech_Speech Synthesis_Google Text To Speech - Fatal编程技术网

Javascript speechSynthesis.speak和ONED触发之间的显著延迟

Javascript speechSynthesis.speak和ONED触发之间的显著延迟,javascript,google-chrome,text-to-speech,speech-synthesis,google-text-to-speech,Javascript,Google Chrome,Text To Speech,Speech Synthesis,Google Text To Speech,你可以在这个演示中看到它。从演讲结束到onEnd触发几乎0.3秒的延迟。是否有解决方法或解决方案 var btn = document.getElementById('btn'); speechSynthesis.cancel() var u = new SpeechSynthesisUtterance(); u.text = 'This is umer please dont come here'; var t; u.onstart = function (event) { t =

你可以在这个演示中看到它。从演讲结束到onEnd触发几乎0.3秒的延迟。是否有解决方法或解决方案

var btn = document.getElementById('btn');
speechSynthesis.cancel()
var u = new SpeechSynthesisUtterance();
u.text = 'This is umer please dont come here';

var  t;
u.onstart = function (event) {
    t = event.timeStamp;
    console.log(t);
};

u.onend = function (event) {
    t = event.timeStamp-t;
    console.log(event.timeStamp);
    console.log((t/1000) +' seconds');
};

btn.onclick = function () {speechSynthesis.speak(u);};