blob: 44ccae6cbbd5d7cc8d94dda8ce98a05aaf093a50 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
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<VoiceOverStore>()((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,
});
},
}));
|