Skip to content

Commit 5286a44

Browse files
authored
Merge pull request #22 from layercodedev/fix/stable-disconnect-reference
fix: await unmute() to ensure VAD reinitializes before continuing
2 parents cf299d3 + bbfed5f commit 5286a44

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)