Record your screen, ship a demo. Free and open-source, GPU-accelerated, no watermarks, no subscriptions. Windows, macOS, Linux. Actively maintained.
TypeScript cross-platformelectronffmpegopen-sourceproduct-demorustscreen-capturescreen-recorderscreen-recordingscreen-studioscreencastspeech-to-texttypescriptvideo-editingvideo-editorwaylandwgpuwhisper
feat(audio): dock the voiceover recorder instead of covering the video
Ola Adebayoeeecb15907da
diff --git a/src/components/ai-edition/v4/AddAudioLayerDialog.test.tsx b/src/components/ai-edition/v4/AddAudioLayerDialog.test.tsxindex a9e80fbac..696452ed6 100644--- a/src/components/ai-edition/v4/AddAudioLayerDialog.test.tsx+++ b/src/components/ai-edition/v4/AddAudioLayerDialog.test.tsx@@ -85,6 +85,16 @@ describe("AddAudioLayerDialog", () => {await vi.waitFor(() => expect(props.onRecordingStart).toHaveBeenCalledTimes(1));});+ it("does not cover the video it is recording against", () => {+ // It used to be a modal over a dimmed backdrop, which hid the one thing a+ // voiceover needs you to watch. It is a docked bar now: no backdrop, and+ // nothing claiming to be a modal dialog.+ const { container } = renderDialog();+ expect(container.querySelector('[aria-modal="true"]')).toBeNull();+ expect(container.querySelector('[class*="Backdrop"]')).toBeNull();+ expect(screen.getByText("audio.record")).toBeTruthy();+ });+it("reports the end of a take, which is what un-mutes the timeline", async () => {// The shell silences the existing audio tracks between these two callbacks,// so a stop that never reported would leave the timeline mute for good.diff --git a/src/components/ai-edition/v4/AddAudioLayerDialog.tsx b/src/components/ai-edition/v4/AddAudioLayerDialog.tsxindex 85f69e3b6..d10edf08d 100644--- a/src/components/ai-edition/v4/AddAudioLayerDialog.tsx+++ b/src/components/ai-edition/v4/AddAudioLayerDialog.tsx@@ -18,7 +18,7 @@ import { useScopedT } from "@/contexts/I18nContext";import type { AxcutAsset } from "@/lib/ai-edition/schema";import { useProjectStore } from "@/lib/ai-edition/store/projectStore";import { probeAudioDuration } from "@/lib/ai-edition/timeline/duration";-import { ModalShell } from "../Modals";+import styles from "./EditorShellV4.module.css";const RECORDER_MIME_PREFERENCES = ["audio/webm;codecs=opus", "audio/webm", "audio/mp4"];@@ -58,6 +58,7 @@ export function AddAudioLayerDialog({onRecordingStop: () => void;}) {const t = useScopedT("timeline");+ const tc = useScopedT("common");const [busy, setBusy] = useState(false);const [recording, setRecording] = useState(false);const [elapsedSec, setElapsedSec] = useState(0);@@ -69,6 +70,9 @@ export function AddAudioLayerDialog({// Set when the user cancels (closes the dialog mid-take) — the stop handler// then discards the blob instead of importing it as a layer.const discardRef = useRef(false);+ // Read by the Escape handler, which must not re-subscribe every time the+ // elapsed-time state ticks.+ const recordingRef = useRef(false);// Reset whenever the dialog opens again — a cancelled recording must not// leak its stream or timer into the next session.@@ -76,6 +80,7 @@ export function AddAudioLayerDialog({if (open) {setBusy(false);setRecording(false);+ recordingRef.current = false;setElapsedSec(0);}return () => {@@ -120,6 +125,7 @@ export function AddAudioLayerDialog({stopRecording();onRecordingStop();setRecording(false);+ recordingRef.current = false;setElapsedSec(0);}, [stopRecording, onRecordingStop]);@@ -175,6 +181,7 @@ export function AddAudioLayerDialog({const discarded = discardRef.current;discardRef.current = false;setRecording(false);+ recordingRef.current = false;setElapsedSec(0);onRecordingStop();if (discarded) return;@@ -204,6 +211,7 @@ export function AddAudioLayerDialog({discardRef.current = false;recorder.start(250);setRecording(true);+ recordingRef.current = true;setElapsedSec(0);onRecordingStart();timerRef.current = setInterval(() => {@@ -246,88 +254,80 @@ export function AddAudioLayerDialog({}}, [finishWithPath]);- const buttonStyle: React.CSSProperties = {- display: "flex",- alignItems: "center",- justifyContent: "center",- gap: 8,- padding: "10px 14px",- borderRadius: 10,- border: "1px solid var(--border)",- background: "var(--bg-2)",- color: "var(--fg-1)",- font: "600 13px var(--font-display)",- cursor: "pointer",- };+ // Escape closes, the way it did when this was a modal — cancelling a take in+ // progress rather than saving a half-recorded one.+ useEffect(() => {+ if (!open) return;+ const onKey = (e: KeyboardEvent) => {+ if (e.key !== "Escape") return;+ e.preventDefault();+ if (recordingRef.current) cancelRecording();+ onClose();+ };+ window.addEventListener("keydown", onKey);+ return () => window.removeEventListener("keydown", onKey);+ }, [open, cancelRecording, onClose]);++ if (!open) return null;return (- <ModalShell- open={open}- onClose={() => {- if (recording) cancelRecording();- onClose();- }}- title={t("audio.addVoiceover")}- subtitle={t("audio.subtitle")}- >- <div style={{ display: "flex", flexDirection: "column", gap: 12 }}>- {recording ? (- <div- style={{- display: "flex",- flexDirection: "column",- alignItems: "center",- gap: 12,- padding: "18px 0 8px",+ // A toolbar, not a dialog: no backdrop, nothing dimmed, and the preview+ // keeps playing behind it. `aria-live` so a screen reader hears the take+ // start and stop without the focus trap a modal would impose.+ <div className={styles.voiceoverBar} role="group" aria-label={t("audio.addVoiceover")}>+ <span className={styles.voiceoverBarTitle}>+ <strong>{t("audio.addVoiceover")}</strong>+ <span>{recording ? t("audio.recordingHint") : t("audio.subtitle")}</span>+ </span>+ {recording ? (+ <>+ <span className={styles.voiceoverBarLive} aria-live="polite">+ <span className={`${styles.voiceoverBarDot} animate-pulse`} />+ {t("audio.recording")} {elapsedSec.toFixed(1)}s+ </span>+ <button+ type="button"+ onClick={stopRecording}+ className={`${styles.voiceoverBarBtn} ${styles.voiceoverBarBtnDanger}`}+ >+ <StopCircle size={16} />+ {t("audio.stop")}+ </button>+ <button+ type="button"+ onClick={() => {+ cancelRecording();+ onClose();}}+ className={styles.voiceoverBarBtn}+ >+ {tc("actions.cancel")}+ </button>+ </>+ ) : (+ <>+ <button+ type="button"+ onClick={() => void startRecording()}+ className={styles.voiceoverBarBtn}+ >+ <Mic size={16} />+ {t("audio.record")}+ </button>+ <button+ type="button"+ onClick={() => void importFile()}+ disabled={busy}+ className={styles.voiceoverBarBtn}>- <span- style={{- display: "inline-flex",- alignItems: "center",- gap: 8,- color: "var(--danger)",- font: "600 13px var(--font-display)",- }}- >- <span- className="animate-pulse"- style={{- width: 10,- height: 10,- borderRadius: 999,- background: "var(--danger)",- }}- />- {t("audio.recording")} {elapsedSec.toFixed(1)}s- </span>- <button- type="button"- onClick={stopRecording}- style={{ ...buttonStyle, borderColor: "var(--danger)", color: "var(--danger)" }}- >- <StopCircle size={16} />- {t("audio.stop")}- </button>- </div>- ) : (- <>- <button type="button" onClick={() => void startRecording()} style={buttonStyle}>- <Mic size={16} />- {t("audio.record")}- </button>- <button- type="button"- onClick={() => void importFile()}- disabled={busy}- style={buttonStyle}- >- <Upload size={16} />- {t("audio.importFile")}- </button>- </>- )}- </div>- </ModalShell>+ <Upload size={16} />+ {t("audio.importFile")}+ </button>+ <button type="button" onClick={onClose} className={styles.voiceoverBarBtn}>+ {tc("actions.close")}+ </button>+ </>+ )}+ </div>);}diff --git a/src/components/ai-edition/v4/EditorShellV4.module.css b/src/components/ai-edition/v4/EditorShellV4.module.cssindex 6f3eb5bfa..1ec4dd715 100644--- a/src/components/ai-edition/v4/EditorShellV4.module.css+++ b/src/components/ai-edition/v4/EditorShellV4.module.css@@ -1813,3 +1813,83 @@pointer-events: none;z-index: 14;}++/* ── Voiceover recorder ──────────────────────────────────────────────────+ Deliberately NOT a modal. The whole point of a voiceover is narrating to+ the video that is playing, so a centred dialog over a dimmed backdrop hides+ the one thing the user needs to watch. This docks at the bottom instead:+ no backdrop, nothing covered but a strip of the timeline, and the preview+ stays lit and playing behind it. */+.voiceoverBar {+ position: fixed;+ left: 50%;+ bottom: 24px;+ transform: translateX(-50%);+ z-index: 60;+ display: flex;+ align-items: center;+ gap: 14px;+ padding: 12px 16px;+ border-radius: 14px;+ border: 1px solid var(--border);+ background: var(--surface-1);+ box-shadow: 0 18px 40px rgb(0 0 0 / 38%);+}++.voiceoverBarTitle {+ display: flex;+ flex-direction: column;+ gap: 2px;+ margin-right: 4px;+}+.voiceoverBarTitle strong {+ font: 600 13px var(--font-display);+ color: var(--fg);+}+.voiceoverBarTitle span {+ font-size: 11px;+ color: var(--muted);+}++.voiceoverBarBtn {+ display: inline-flex;+ align-items: center;+ justify-content: center;+ gap: 7px;+ padding: 9px 14px;+ border-radius: 10px;+ border: 1px solid var(--border);+ background: var(--bg-2, var(--surface-2));+ color: var(--fg-1, var(--fg));+ font: 600 13px var(--font-display);+ cursor: pointer;+ white-space: nowrap;+}+.voiceoverBarBtn:hover:not(:disabled) {+ background: var(--surface-3);+}+.voiceoverBarBtn:disabled {+ opacity: 0.55;+ cursor: not-allowed;+}+.voiceoverBarBtnDanger {+ border-color: var(--danger);+ color: var(--danger);+}++/* The live take: a pulsing dot and the running length, so the user can see it+ is actually capturing without looking away from the video. */+.voiceoverBarLive {+ display: inline-flex;+ align-items: center;+ gap: 8px;+ color: var(--danger);+ font: 600 13px var(--font-display);+ font-variant-numeric: tabular-nums;+}+.voiceoverBarDot {+ width: 10px;+ height: 10px;+ border-radius: 999px;+ background: var(--danger);+}diff --git a/src/i18n/locales/ar/timeline.json b/src/i18n/locales/ar/timeline.jsonindex c0e026cab..e0e263b43 100644--- a/src/i18n/locales/ar/timeline.json+++ b/src/i18n/locales/ar/timeline.json@@ -97,6 +97,7 @@"importFile": "استيراد ملف صوتي","importFileHint": "أدرج موسيقى أو ملفًا صوتيًا","recording": "جارٍ التسجيل",+ "recordingHint": "علّق صوتيًا مع الفيديو — يعمل أثناء التسجيل","stop": "إيقاف","micDenied": "تم رفض الوصول إلى الميكروفون","recordingUnavailable": "التسجيل غير متاح هنا",diff --git a/src/i18n/locales/en/timeline.json b/src/i18n/locales/en/timeline.jsonindex c34ffcb24..886e8ce7a 100644--- a/src/i18n/locales/en/timeline.json+++ b/src/i18n/locales/en/timeline.json@@ -97,6 +97,7 @@"importFile": "Import audio file","importFileHint": "Bring in music or an audio file","recording": "Recording",+ "recordingHint": "Narrate along with the video — it plays while you record","stop": "Stop","micDenied": "Microphone access was denied","recordingUnavailable": "Recording is not available here",diff --git a/src/i18n/locales/es/timeline.json b/src/i18n/locales/es/timeline.jsonindex 4fcae8b40..8d6f3974b 100644--- a/src/i18n/locales/es/timeline.json+++ b/src/i18n/locales/es/timeline.json@@ -97,6 +97,7 @@"importFile": "Importar archivo de audio","importFileHint": "Importa música o un archivo de audio","recording": "Grabando",+ "recordingHint": "Narra junto al vídeo: se reproduce mientras grabas","stop": "Detener","micDenied": "Se denegó el acceso al micrófono","recordingUnavailable": "La grabación no está disponible aquí",diff --git a/src/i18n/locales/fr/timeline.json b/src/i18n/locales/fr/timeline.jsonindex c5bf1a73b..52de88c6c 100644--- a/src/i18n/locales/fr/timeline.json+++ b/src/i18n/locales/fr/timeline.json@@ -97,6 +97,7 @@"importFile": "Importer un fichier audio","importFileHint": "Importez une musique ou un fichier audio","recording": "Enregistrement",+ "recordingHint": "Commentez en même temps que la vidéo — elle joue pendant l'enregistrement","stop": "Arrêter","micDenied": "L'accès au micro a été refusé","recordingUnavailable": "L'enregistrement n'est pas disponible ici",diff --git a/src/i18n/locales/it/timeline.json b/src/i18n/locales/it/timeline.jsonindex 1026be7c3..014041e4b 100644--- a/src/i18n/locales/it/timeline.json+++ b/src/i18n/locales/it/timeline.json@@ -97,6 +97,7 @@"importFile": "Importa file audio","importFileHint": "Importa musica o un file audio","recording": "Registrazione",+ "recordingHint": "Racconta insieme al video: continua a riprodursi mentre registri","stop": "Ferma","micDenied": "Accesso al microfono negato","recordingUnavailable": "La registrazione non è disponibile qui",diff --git a/src/i18n/locales/ja-JP/timeline.json b/src/i18n/locales/ja-JP/timeline.jsonindex 7df028390..bf21fd025 100644--- a/src/i18n/locales/ja-JP/timeline.json+++ b/src/i18n/locales/ja-JP/timeline.json@@ -97,6 +97,7 @@"importFile": "音声ファイルを読み込む","importFileHint": "音楽やオーディオファイルを読み込む","recording": "録音中",+ "recordingHint": "動画に合わせて話してください — 録音中も再生されます","stop": "停止","micDenied": "マイクへのアクセスが拒否されました","recordingUnavailable": "ここでは録音できません",diff --git a/src/i18n/locales/ko-KR/timeline.json b/src/i18n/locales/ko-KR/timeline.jsonindex b92f05d6e..1a0242f10 100644--- a/src/i18n/locales/ko-KR/timeline.json+++ b/src/i18n/locales/ko-KR/timeline.json@@ -97,6 +97,7 @@"importFile": "오디오 파일 가져오기","importFileHint": "음악이나 오디오 파일 가져오기","recording": "녹음 중",+ "recordingHint": "영상에 맞춰 말하세요 — 녹음하는 동안 재생됩니다","stop": "중지","micDenied": "마이크 접근이 거부되었습니다","recordingUnavailable": "여기에서는 녹음할 수 없습니다",diff --git a/src/i18n/locales/pt-BR/timeline.json b/src/i18n/locales/pt-BR/timeline.jsonindex 21183359d..c1e6d3c27 100644--- a/src/i18n/locales/pt-BR/timeline.json+++ b/src/i18n/locales/pt-BR/timeline.json@@ -97,6 +97,7 @@"importFile": "Importar arquivo de áudio","importFileHint": "Importe música ou um arquivo de áudio","recording": "Gravando",+ "recordingHint": "Narre junto com o vídeo — ele continua tocando enquanto você grava","stop": "Parar","micDenied": "Acesso ao microfone negado","recordingUnavailable": "A gravação não está disponível aqui",diff --git a/src/i18n/locales/ru/timeline.json b/src/i18n/locales/ru/timeline.jsonindex 2258a719f..7a89391c4 100644--- a/src/i18n/locales/ru/timeline.json+++ b/src/i18n/locales/ru/timeline.json@@ -97,6 +97,7 @@"importFile": "Импортировать аудиофайл","importFileHint": "Импортируйте музыку или аудиофайл","recording": "Запись",+ "recordingHint": "Говорите под видео — оно продолжает играть во время записи","stop": "Остановить","micDenied": "Доступ к микрофону запрещён","recordingUnavailable": "Запись здесь недоступна",diff --git a/src/i18n/locales/tr/timeline.json b/src/i18n/locales/tr/timeline.jsonindex 7dda3007f..9f3d70d36 100644--- a/src/i18n/locales/tr/timeline.json+++ b/src/i18n/locales/tr/timeline.json@@ -97,6 +97,7 @@"importFile": "Ses dosyası içe aktar","importFileHint": "Müzik veya ses dosyası içe aktarın","recording": "Kaydediliyor",+ "recordingHint": "Videoyla birlikte anlatın — kayıt sırasında oynamaya devam eder","stop": "Durdur","micDenied": "Mikrofon erişimi reddedildi","recordingUnavailable": "Burada kayıt kullanılamıyor",diff --git a/src/i18n/locales/vi/timeline.json b/src/i18n/locales/vi/timeline.jsonindex d714ffdec..e585a7dce 100644--- a/src/i18n/locales/vi/timeline.json+++ b/src/i18n/locales/vi/timeline.json@@ -97,6 +97,7 @@"importFile": "Nhập tệp âm thanh","importFileHint": "Nhập nhạc hoặc tệp âm thanh","recording": "Đang ghi",+ "recordingHint": "Thuyết minh cùng video — video vẫn phát trong khi bạn ghi âm","stop": "Dừng","micDenied": "Quyền truy cập micrô bị từ chối","recordingUnavailable": "Không thể ghi âm ở đây",diff --git a/src/i18n/locales/zh-CN/timeline.json b/src/i18n/locales/zh-CN/timeline.jsonindex 343dce8d4..1513e4f39 100644--- a/src/i18n/locales/zh-CN/timeline.json+++ b/src/i18n/locales/zh-CN/timeline.json@@ -97,6 +97,7 @@"importFile": "导入音频文件","importFileHint": "导入音乐或音频文件","recording": "正在录制",+ "recordingHint": "跟着视频讲解 — 录制时视频会继续播放","stop": "停止","micDenied": "麦克风访问被拒绝","recordingUnavailable": "此处无法录音",diff --git a/src/i18n/locales/zh-TW/timeline.json b/src/i18n/locales/zh-TW/timeline.jsonindex cd7b39f33..e5e5f8d25 100644--- a/src/i18n/locales/zh-TW/timeline.json+++ b/src/i18n/locales/zh-TW/timeline.json@@ -97,6 +97,7 @@"importFile": "匯入音訊檔案","importFileHint": "匯入音樂或音訊檔案","recording": "錄製中",+ "recordingHint": "跟著影片講解 — 錄製時影片會繼續播放","stop": "停止","micDenied": "麥克風存取遭拒絕","recordingUnavailable": "此處無法錄音",