From 783e9ac8462751adc14d78b070095fd63e45bda0 Mon Sep 17 00:00:00 2001 From: cashmere Date: Mon, 27 Jul 2026 01:21:20 +0200 Subject: feat: voice-over recording into the timeline MediaRecorder mic capture (defensive mimeType picking, permission/no-mic toasts) with elapsed display in the timeline toolbar. Stop produces an audio asset and inserts it at the playhead on an audio track as ONE BatchCommand undo step, freeze-frame precedent. voice-over action registered, no default keybinding. 20 tests; smoke-tested in Chromium with a fake mic end to end. --- apps/web/src/voiceover/voiceover-store.ts | 41 +++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 apps/web/src/voiceover/voiceover-store.ts (limited to 'apps/web/src/voiceover/voiceover-store.ts') diff --git a/apps/web/src/voiceover/voiceover-store.ts b/apps/web/src/voiceover/voiceover-store.ts new file mode 100644 index 00000000..44ccae6c --- /dev/null +++ b/apps/web/src/voiceover/voiceover-store.ts @@ -0,0 +1,41 @@ +/** + * Voice-over recording UI state. + * Transient by nature — a recording never survives a reload, so unlike most + * stores here this one is intentionally NOT persisted (same pattern as + * editor-store / properties-store). + */ + +import { create } from "zustand"; +import type { MediaTime } from "@/wasm"; + +export type VoiceOverStatus = "idle" | "recording"; + +interface VoiceOverStore { + status: VoiceOverStatus; + startedAtMs: number | null; + playheadStartTime: MediaTime | null; + startRecording: ({ playheadTime }: { playheadTime: MediaTime }) => void; + stopRecording: () => void; +} + +export const useVoiceOverStore = create()((set) => ({ + status: "idle", + startedAtMs: null, + playheadStartTime: null, + + startRecording: ({ playheadTime }) => { + set({ + status: "recording", + startedAtMs: Date.now(), + playheadStartTime: playheadTime, + }); + }, + + stopRecording: () => { + set({ + status: "idle", + startedAtMs: null, + playheadStartTime: null, + }); + }, +})); -- cgit v1.3.1