diff --git a/frontend/js/voice.js b/frontend/js/voice.js index b78dc85..ab31b47 100644 --- a/frontend/js/voice.js +++ b/frontend/js/voice.js @@ -113,13 +113,14 @@ class VoiceManager { await this._transcribeAPI(blob); }; - // Wait for recorder to actually start before updating UI - this.mediaRecorder.start(); + // Only update UI once recording has truly started + this.mediaRecorder.onstart = () => { + this.isRecording = true; + this.lastInputWasVoice = true; + if (this.onStateChange) this.onStateChange(true); + }; - // Now we are truly recording - this.isRecording = true; - this.lastInputWasVoice = true; - if (this.onStateChange) this.onStateChange(true); + this.mediaRecorder.start(); } catch (e) { console.error('[Voice] Mic access error:', e);