From 4969aebfe4bac207be657e87ad018227626431c5 Mon Sep 17 00:00:00 2001 From: Jicheng Lu <103353@smsassist.com> Date: Fri, 2 Aug 2024 16:31:48 -0500 Subject: [PATCH 1/3] rename --- src/lib/common/MessageImageGallery.svelte | 2 +- src/lib/common/audio-player/store.js | 4 ++-- src/lib/services/web-speech.js | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/lib/common/MessageImageGallery.svelte b/src/lib/common/MessageImageGallery.svelte index 0354918..a91733c 100644 --- a/src/lib/common/MessageImageGallery.svelte +++ b/src/lib/common/MessageImageGallery.svelte @@ -43,7 +43,7 @@ artist: '', url: isExternalUrl(item.file_url) ? item.file_url : `${PUBLIC_SERVICE_URL}${item.file_url}?access_token=${$userStore?.token}` }; - });; + }); }); } }); diff --git a/src/lib/common/audio-player/store.js b/src/lib/common/audio-player/store.js index c47306d..4d1ff06 100644 --- a/src/lib/common/audio-player/store.js +++ b/src/lib/common/audio-player/store.js @@ -1,6 +1,6 @@ import { derived, writable } from "svelte/store"; import { secondToTime } from "./utils"; -import { speechVoices } from "$lib/services/web-speech"; +import { SPEECH_VOICES } from "$lib/services/web-speech"; /** @type {HTMLAudioElement[]} */ export const instances = []; @@ -19,7 +19,7 @@ export function initPlayer(player, dispatch) { /** @param {import('$types').SpeechModel} speech */ export function initSpeech(speech) { - const foundVoice = speech.synth.getVoices().find(x => speechVoices.includes(x.name)); + const foundVoice = speech.synth.getVoices().find(x => SPEECH_VOICES.includes(x.name)); if (foundVoice) { speech.utterThis.voice = foundVoice; } diff --git a/src/lib/services/web-speech.js b/src/lib/services/web-speech.js index 692d80b..7ed502c 100644 --- a/src/lib/services/web-speech.js +++ b/src/lib/services/web-speech.js @@ -15,7 +15,7 @@ const utterThis = new SpeechSynthesisUtterance(); utterThis.pitch = 1; utterThis.rate = 1; -export const speechVoices = [ +export const SPEECH_VOICES = [ "Microsoft Michelle Online (Natural) - English (United States)", "Google US English" ]; @@ -45,7 +45,7 @@ function setVoiceSynthesis() { if (utterThis.voice == null) { const voices = synth.getVoices(); for (let i = 0; i < voices.length; i++) { - if (speechVoices.includes(voices[i].name)) { + if (SPEECH_VOICES.includes(voices[i].name)) { utterThis.voice = voices[i]; console.log(voices[i].name); break; From 3677c33beaf13ead7e286dc7421eb5f88ebf956e Mon Sep 17 00:00:00 2001 From: Jicheng Lu <103353@smsassist.com> Date: Fri, 2 Aug 2024 16:57:19 -0500 Subject: [PATCH 2/3] fix audio interrupt issue --- .../common/audio-player/AudioSpeaker.svelte | 22 ++++++++++--------- src/lib/common/audio-player/store.js | 4 ---- src/lib/helpers/types/types.js | 1 + 3 files changed, 13 insertions(+), 14 deletions(-) diff --git a/src/lib/common/audio-player/AudioSpeaker.svelte b/src/lib/common/audio-player/AudioSpeaker.svelte index 5b51a2f..57e2740 100644 --- a/src/lib/common/audio-player/AudioSpeaker.svelte +++ b/src/lib/common/audio-player/AudioSpeaker.svelte @@ -1,5 +1,5 @@