瀏覽代碼

refac: call

Timothy J. Baek 11 月之前
父節點
當前提交
063e1ee46c
共有 1 個文件被更改,包括 11 次插入1 次删除
  1. 11 1
      src/lib/components/chat/MessageInput/CallOverlay.svelte

+ 11 - 1
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));