fix: start VAD gate open to avoid permanent silence on model load failure
Starting the gate closed caused permanent silence if the ONNX model or WASM files failed to load (onFrameProcessed never fired). Gate now starts open so audio flows immediately; the first silence frame closes it. Also ensures the gate is always reset to open when VAD is disabled. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -454,7 +454,7 @@ export class Publisher {
|
||||
void vadGate.destroy();
|
||||
vadGate = null;
|
||||
}
|
||||
// Reset gate to open so audio flows if VAD is toggled off mid-call
|
||||
// Always reopen gate when VAD stops so audio flows without VAD
|
||||
transformer?.setVADOpen(true);
|
||||
};
|
||||
|
||||
@@ -468,8 +468,6 @@ export class Publisher {
|
||||
}
|
||||
const stream = new MediaStream([rawTrack]);
|
||||
vadGate = new SileroVADGate(stream, ctx);
|
||||
// Close the gate immediately — VAD will open it once speech is confirmed.
|
||||
transformer?.setVADOpen(false);
|
||||
vadGate.onOpen = (): void => transformer?.setVADOpen(true);
|
||||
vadGate.onClose = (): void => transformer?.setVADOpen(false);
|
||||
vadGate.start().catch((e: unknown) => {
|
||||
|
||||
Reference in New Issue
Block a user