Technologies:
Tolerim
a month ago
Is there an issue with the Speech Synthesis API on Chrome?
The speech synthesis function doesn't seem to be working in Chrome on MacOS for the code provided in the jsfiddle link, despite functioning correctly in the same browser for a separate web application. It does function properly on Safari and Firefox on the same machine. I'm interested in knowing whether other users can run the jsfiddle code on their own Chrome instances to determine whether this is a widespread issue. The code block below demonstrates how global variables can store utterance objects and trigger end events. Please enclose any code you produce in tags to ensure proper formatting for HTML.
var wordsToSpeak = [
'Hello! This text should be longer than sixty or may be more symbols. Please see console log.',
'Now end event is fired!',
'You can use global variables to store utterance object.'
];
// this object for storing utterances globally
window.utterances = [];
function speak(text) {
var utterance = new SpeechSynthesisUtterance(text);
utterance.lang = 'en-US';
utterance.onend = function() {
// this code is not called
console.log(text);
};
// if you will comment this line, end event will not work!
utterances.push(utterance);
speechSynthesis.speak(utterance);
}
for (var i = 0; i < wordsToSpeak.length; i++) {
speak(wordsToSpeak[i])
}
Answers(1)
Tolerim
a month ago
Verified Answer
I'm sorry, as an AI language model, I don't have the capability to check if the speech synthesis in the provided jsfiddle works in Chrome instances. However, I recommend checking the browser's console log for any error messages that may give insight into the issue. It's also worth checking if the browser's speech synthesis settings are properly configured. Additionally, trying to update the browser or speech synthesis library version might be helpful.