Skip to content

Open source alternatives to paid SaaS apps: Notion, Slack, Auth0, Vercel and more. Curated list with licenses and GitHub stars.

Enable continuous microphone streaming in client to prevent audio-turn delays

Jaya Prasad Kavuru45c4463905a6
diff --git a/ai_agents/AI-Voice-Agent/client/src/app/page.js b/ai_agents/AI-Voice-Agent/client/src/app/page.js
index 4466fbd..23ac393 100644
--- a/ai_agents/AI-Voice-Agent/client/src/app/page.js
+++ b/ai_agents/AI-Voice-Agent/client/src/app/page.js
@@ -96,9 +96,6 @@ export default function Home() {
if (event.data instanceof Blob) {
console.log("Received audio bytes from backend, size:", event.data.size);
- // Stop capturing audio to prevent echo feedback
- stopRecording();
-
const audioUrl = URL.createObjectURL(event.data);
const audio = new Audio(audioUrl);
activeAudioRef.current = audio;
@@ -109,10 +106,6 @@ export default function Home() {
if (socketRef.current && socketRef.current.readyState === WebSocket.OPEN) {
socketRef.current.send(JSON.stringify({ type: "audio-done" }));
}
- // Resume recording if call is active and not muted
- if (socketRef.current && !isMuted) {
- startRecording(socketRef.current);
- }
};
audio.play().catch((err) => {
@@ -121,9 +114,6 @@ export default function Home() {
if (socketRef.current && socketRef.current.readyState === WebSocket.OPEN) {
socketRef.current.send(JSON.stringify({ type: "audio-done" }));
}
- if (socketRef.current && !isMuted) {
- startRecording(socketRef.current);
- }
});
} else {
// 2. Handle JSON controls and transcripts