Merge branch 'main' into dev

This commit is contained in:
SillyLossy
2023-05-19 23:12:52 +03:00
3 changed files with 17 additions and 10 deletions

View File

@@ -30,7 +30,7 @@ class SystemTtsProvider {
}
get settingsHtml() {
if (!window.speechSynthesis) {
if (!('speechSynthesis' in window)) {
return "Your browser or operating system doesn't support speech synthesis";
}
@@ -81,7 +81,7 @@ class SystemTtsProvider {
// TTS Interfaces //
//#################//
fetchTtsVoiceIds() {
if (!window.speechSynthesis) {
if (!('speechSynthesis' in window)) {
return [];
}
@@ -92,6 +92,10 @@ class SystemTtsProvider {
}
previewTtsVoice(voiceId) {
if (!('speechSynthesis' in window)) {
throw 'Speech synthesis API is not supported';
}
const voice = speechSynthesis.getVoices().find(x => x.voiceURI === voiceId);
if (!voice) {
@@ -108,11 +112,11 @@ class SystemTtsProvider {
}
async getVoice(voiceName) {
if (!window.speechSynthesis) {
if (!('speechSynthesis' in window)) {
return { voice_id: null }
}
const voices = window.speechSynthesis.getVoices();
const voices = speechSynthesis.getVoices();
const match = voices.find(x => x.name == voiceName);
if (!match) {
@@ -123,7 +127,7 @@ class SystemTtsProvider {
}
async generateTts(text, voiceId) {
if (!window.speechSynthesis) {
if (!('speechSynthesis' in window)) {
throw 'Speech synthesis API is not supported';
}