From 063e1ee46c7e7bdb4209b75c488acf535b690111 Mon Sep 17 00:00:00 2001 From: "Timothy J. Baek" Date: Sat, 8 Jun 2024 03:27:56 -0700 Subject: [PATCH] refac: call --- .../components/chat/MessageInput/CallOverlay.svelte | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/lib/components/chat/MessageInput/CallOverlay.svelte b/src/lib/components/chat/MessageInput/CallOverlay.svelte index 51dae5a7c..25c68a1e3 100644 --- a/src/lib/components/chat/MessageInput/CallOverlay.svelte +++ b/src/lib/components/chat/MessageInput/CallOverlay.svelte @@ -139,7 +139,17 @@ const audio = assistantAudio[idx]; audioElement.src = audio.src; // Assume `assistantAudio` has objects with a `src` property - audioElement.play(); + + audioElement.muted = true; + + audioElement + .play() + .then(() => { + audioElement.muted = false; + }) + .catch((error) => { + toast.error(error); + }); audioElement.onended = async (e) => { await new Promise((r) => setTimeout(r, 300));