Speak onboarding and all game dialogue automatically
Build and publish frontend / publish (push) Successful in 38s

This commit is contained in:
Ein Anderssono
2026-10-15 10:54:10 +02:00
parent 5354132489
commit 69184d1920
5 changed files with 70 additions and 36 deletions
+5 -3
View File
@@ -42,11 +42,13 @@
}
const stored = JSON.parse(current || '{}');
const settings = {...DEFAULT_SETTINGS, ...stored};
if (!['screen-reader', 'game-voice', 'text-only'].includes(settings.mode)) settings.mode = DEFAULT_SETTINGS.mode;
// Game dialogue is always spoken. These assignments also migrate older
// local settings that allowed text-only or screen-reader-only playback.
settings.mode = 'game-voice';
settings.autoSpeak = true;
settings.rate = Math.min(2, Math.max(0.5, Number(settings.rate) || 1));
settings.voiceName = typeof settings.voiceName === 'string' ? settings.voiceName : '';
settings.speakerProfiles = settings.speakerProfiles && typeof settings.speakerProfiles === 'object' ? settings.speakerProfiles : {};
settings.autoSpeak = settings.autoSpeak === true;
settings.soundSignals = settings.soundSignals !== false;
return settings;
} catch (_) { return {...DEFAULT_SETTINGS}; }
@@ -177,7 +179,7 @@
}
function speak(text, voiceOptions = {}) {
if (!text || settings.mode !== 'game-voice' || !win.speechSynthesis || !win.SpeechSynthesisUtterance) return false;
if (!text || !win.speechSynthesis || !win.SpeechSynthesisUtterance) return false;
stopListening();
cancelSpeech();
const token = generation;