one utterance

This commit is contained in:
2026-01-26 11:43:42 +01:00
parent aa54352af2
commit d5b6149992
3 changed files with 11 additions and 5 deletions

View File

@@ -192,10 +192,16 @@ class Stats {
const speechSynthesisAvailable = 'speechSynthesis' in window;
function speak(text, volume=1) {
if (!speechSynthesisAvailable) return;
const utterance = new SpeechSynthesisUtterance(text);
let utterance;
if ('SpeechSynthesisUtterance' in window) {
utterance = new SpeechSynthesisUtterance();
utterance.lang = 'fr-FR';
}
function speak(text, volume=1) {
if (!utterance) return;
utterance.text = text ;
utterance.volume = volume;
speechSynthesis.speak(utterance);
}