Skip to content

Commit

Permalink
fix: avoid error due to get Voices
Browse files Browse the repository at this point in the history
  • Loading branch information
johannesjo committed Mar 2, 2025
1 parent 3113ad0 commit be602ec
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/app/features/domina-mode/getAvailableVoices.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,15 @@
export const getAvailableVoices = (): SpeechSynthesisVoice[] => {
const synth = window.speechSynthesis;
if (!synth) {
console.warn('window.speechSynthesis not available');
return [];
}

return synth.getVoices();
};

export const getDefaultVoice = (): string => {
const voices = window.speechSynthesis.getVoices();
const voices = getAvailableVoices();
if (voices.length === 0) {
return 'null';
}
Expand Down

0 comments on commit be602ec

Please sign in to comment.