Skip to content

Commit

Permalink
fix empty text
Browse files Browse the repository at this point in the history
  • Loading branch information
ttop32 committed Nov 23, 2024
1 parent b8c2d3c commit 94f7ca8
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/tts/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,13 +43,17 @@ export default class TTS {
if (Number(timestamp) < this.stopTtsTimestamp) {
return;
}
text = TextUtil.filterSpeechText(text);
if (!text) {
return;
}
var volume = Number(setting["voiceVolume"]);
var rate = Number(setting["voiceRate"]);
var voiceFullName = setting?.["ttsVoice_" + lang];
var isExternalTts = /^(BingTTS|GoogleTranslateTTS).*/.test(voiceFullName);
var voice = isExternalTts ? voiceFullName.split("_")[1] : voiceFullName;
var engine = isExternalTts ? voiceFullName.split("_")[0] : "BrowserTTS";
text = TextUtil.filterSpeechText(text);

await tts_engine[engine].playTTSEngine(
text,
voice,
Expand Down

0 comments on commit 94f7ca8

Please sign in to comment.