From 4d27bddabff6e3b3395bf0d2e780ce41284d61e2 Mon Sep 17 00:00:00 2001
From: adetyaz <tuneymitch@gmail.com>
Date: Fri, 6 Sep 2024 10:54:27 +0100
Subject: [PATCH] fix: voice

---
 src/components/voice-assistant.tsx | 48 +++++++++++++++---------------
 1 file changed, 24 insertions(+), 24 deletions(-)

diff --git a/src/components/voice-assistant.tsx b/src/components/voice-assistant.tsx
index 7b15121..d0cd0cb 100644
--- a/src/components/voice-assistant.tsx
+++ b/src/components/voice-assistant.tsx
@@ -72,30 +72,30 @@ export const VoiceAssistant = ({
 		},
 	])
 
-	// useEffect(() => {
-	// 	const synth = window.speechSynthesis
-
-	// 	// Create a speech synthesis utterance
-	// 	const utterance = new SpeechSynthesisUtterance(
-	// 		"Welcome to our world! Feel free to explore and discover hidden treasures together with your AI companion. Let's embark on this adventure!"
-	// 	)
-
-	// 	// Speak the message after a delay of 5 seconds
-	// 	const timeoutId = setTimeout(() => {
-	// 		if (!synth.speaking) {
-	// 			synth.speak(utterance)
-	// 		}
-	// 	}, 5000)
-
-	// 	// Cleanup function to cancel speech synthesis and timeout if necessary
-	// 	return () => {
-	// 		clearTimeout(timeoutId)
-	// 		if (synth.speaking) {
-	// 			synth.cancel()
-	// 			console.log('Speech synthesis canceled')
-	// 		}
-	// 	}
-	// }, [])
+	useEffect(() => {
+		const synth = window.speechSynthesis
+
+		// Create a speech synthesis utterance
+		const utterance = new SpeechSynthesisUtterance(
+			`Welcome, Feel free to explore ${brandName} and discover hidden treasures together with your AI companion.`
+		)
+
+		// Speak the message after a delay of 5 seconds
+		const timeoutId = setTimeout(() => {
+			if (!synth.speaking) {
+				synth.speak(utterance)
+			}
+		}, 5000)
+
+		// Cleanup function to cancel speech synthesis and timeout if necessary
+		return () => {
+			clearTimeout(timeoutId)
+			if (synth.speaking) {
+				synth.cancel()
+				console.log('Speech synthesis canceled')
+			}
+		}
+	}, [])
 
 	useEffect(() => {
 		// Feature detection for webkitSpeechRecognition