Skip to content

Commit bbfed5f

Browse files
jackbridgerclaude
andcommitted
fix: await unmute() to ensure VAD reinitializes before continuing
The unmute() function in the JS SDK is async because it needs to reinitialize VAD. Not awaiting it could cause race conditions where user speech isn't detected immediately after unmuting. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
1 parent 2085a4c commit bbfed5f

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/index.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -320,12 +320,12 @@ const useLayercodeAgent = (
320320
clientRef.current.mute();
321321
}, []);
322322

323-
const unmute = useCallback(() => {
323+
const unmute = useCallback(async () => {
324324
if (!clientRef.current) {
325325
console.warn('[Layercode] unmute() called but no client exists. Did you call connect() first?');
326326
return;
327327
}
328-
clientRef.current.unmute();
328+
await clientRef.current.unmute();
329329
}, []);
330330

331331
const setAudioInput = useCallback(

0 commit comments

Comments
 (0)