Spaces:
Sleeping
Sleeping
| window.onload = function () { | |
| window.SpeechRecognition = window.SpeechRecognition || window.webkitSpeechRecognition; | |
| if (!window.SpeechRecognition) { | |
| alert("Your browser does not support Speech Recognition. Please use Chrome."); | |
| return; | |
| } | |
| const recognition = new SpeechRecognition(); | |
| recognition.continuous = true; | |
| recognition.lang = "en-US"; | |
| function startListening() { | |
| recognition.start(); | |
| let statusElement = document.getElementById("status"); | |
| if (statusElement) { | |
| statusElement.innerText = "Listening for 'Hi Biriyani Hub'..."; | |
| } | |
| } | |
| recognition.onresult = function (event) { | |
| let transcript = event.results[event.results.length - 1][0].transcript.toLowerCase(); | |
| console.log("You said:", transcript); | |
| if (transcript.includes("hi biriyani hub")) { | |
| console.log("Wake word detected! Redirecting to landing page..."); | |
| window.location.href = "/landing"; // Redirects to landing page | |
| } | |
| }; | |
| recognition.onerror = function (event) { | |
| console.error("Speech recognition error:", event.error); | |
| }; | |
| startListening(); | |
| }; | |