I'm displaying an animated graphic whilst SpeechSynthesisUtterance is speaking. I'm using the onend property to detect when speaking has finished to remove the animated graphic. However there is a significant delay between the speaking finishing and the onend event firing, which means the animated graphic carries on playing for approximately 1 second even though the speaking has finished. Is it possible to remove this delay? The below code is a simple demonstration of the problem.
let utterance = new SpeechSynthesisUtterance("Approximately a second delay after utterance has finished and the onend event firing");
speechSynthesis.speak(utterance);
utterance.onend = function () {
console.log("There is a delay before this message appears?");
}