feat(recording): micMuted state + toggleMute synced to recording://mic

This commit is contained in:
iamdoubz committed 2026-07-15 13:59:04 -05:00
1 parent 95b3d34713
commit 0e2a3bb110
1 file changed
+22
+22
View File
@@ -22,6 +22,9 @@ class RecordingStore {
* (FR-CAP-7); stays 0 when the mic is disabled or not recording. */
levelRmsMic = $state(0);
levelPeakMic = $state(0);
/** Mic muted for the in-flight meeting (FR-CAP-7): mic channel goes silent
* while loopback keeps recording. Toggled by the "M" key / mute button. */
micMuted = $state(false);
/** Set while a capture-device reconnect is in progress; cleared on recovery (FR-CAP-6). */
deviceNotice = $state<string | null>(null);
/** Live notes redesign: freeform text typed in the Notes pane while recording. */
@@ -72,6 +75,22 @@ class RecordingStore {
await events.onDeviceChanged(({ recovered, message }) => {
this.deviceNotice = recovered ? null : message;
});
// Keep mute state in sync even if it was toggled elsewhere (e.g. a future
// tray control), not just from this store's toggleMute().
await events.onMicMuted(({ muted }) => {
this.micMuted = muted;
});
}
/** Toggle mic mute for the active recording (FR-CAP-7); no-op if not
* recording. Optimistically flips, then reconciles with the backend result. */
async toggleMute() {
if (!this.meetingId || this.state === "idle") return;
try {
this.micMuted = await api.toggleMicrophoneMute(this.meetingId);
} catch {
// Mic off for this meeting (or capture gone) — nothing to mute.
}
}
async start(title?: string, record = false, templateId?: string, calendarEventId?: string) {
@@ -79,6 +98,7 @@ class RecordingStore {
this.speakers = [];
this.retention = record;
this.deviceNotice = null;
this.micMuted = false;
this.notesText = "";
this.segmentNotes.clear();
// T8.7/FR-TRX-4: whatever language is currently configured in Settings
@@ -98,6 +118,7 @@ class RecordingStore {
this.levelPeak = 0;
this.levelRmsMic = 0;
this.levelPeakMic = 0;
this.micMuted = false;
this.deviceNotice = null;
}
@@ -116,6 +137,7 @@ class RecordingStore {
this.levelPeak = 0;
this.levelRmsMic = 0;
this.levelPeakMic = 0;
this.micMuted = false;
this.deviceNotice = null;
this.notesText = "";
this.segmentNotes.clear();