Skip to content

Record your screen, ship a demo. Free and open-source, GPU-accelerated, no watermarks, no subscriptions. Windows, macOS, Linux. Actively maintained.

fix: auto-finalize duration bug, restore cancelRecording, and add i18n for pause tooltips

Siddharthc868469be57e
diff --git a/src/components/launch/LaunchWindow.tsx b/src/components/launch/LaunchWindow.tsx
index 83306ee47..249dd77d3 100644
--- a/src/components/launch/LaunchWindow.tsx
+++ b/src/components/launch/LaunchWindow.tsx
@@ -459,7 +459,7 @@ export function LaunchWindow() {
</button>
{recording && (
- <Tooltip content={paused ? "Resume recording" : "Pause recording"}>
+ <Tooltip content={paused ? t("tooltips.resumeRecording") : t("tooltips.pauseRecording")}>
<button
className={`${hudIconBtnClasses} ${styles.electronNoDrag}`}
onClick={togglePaused}
diff --git a/src/hooks/useScreenRecorder.ts b/src/hooks/useScreenRecorder.ts
index b366decb9..2b07e2470 100644
--- a/src/hooks/useScreenRecorder.ts
+++ b/src/hooks/useScreenRecorder.ts
@@ -113,9 +113,7 @@ export function useScreenRecorder(): UseScreenRecorderReturn {
const getRecordingDurationMs = useCallback(() => {
const segmentDuration =
- screenRecorder.current?.recorder.state === "recording" && segmentStartedAt.current
- ? Date.now() - segmentStartedAt.current
- : 0;
+ segmentStartedAt.current === null ? 0 : Date.now() - segmentStartedAt.current;
return accumulatedDurationMs.current + segmentDuration;
}, []);
@@ -700,6 +698,17 @@ export function useScreenRecorder(): UseScreenRecorderReturn {
return () => window.clearInterval(interval);
}, [getRecordingDurationMs, paused, recording]);
+ const cancelRecording = () => {
+ const activeScreenRecorder = screenRecorder.current;
+ if (!activeScreenRecorder || activeScreenRecorder.recorder.state !== "recording") return;
+
+ const activeRecordingId = recordingId.current;
+ discardRecordingId.current = activeRecordingId;
+ allowAutoFinalize.current = false;
+
+ stopRecording.current();
+ };
+
return {
recording,
paused,
diff --git a/src/i18n/locales/en/launch.json b/src/i18n/locales/en/launch.json
index c1229cc39..cf111c437 100644
--- a/src/i18n/locales/en/launch.json
+++ b/src/i18n/locales/en/launch.json
@@ -4,6 +4,8 @@
"closeApp": "Close App",
"restartRecording": "Restart recording",
"cancelRecording": "Cancel recording",
+ "pauseRecording": "Pause recording",
+ "resumeRecording": "Resume recording",
"openVideoFile": "Open video file",
"openProject": "Open project"
},
diff --git a/src/i18n/locales/es/launch.json b/src/i18n/locales/es/launch.json
index f5be07c25..f47bc8197 100644
--- a/src/i18n/locales/es/launch.json
+++ b/src/i18n/locales/es/launch.json
@@ -4,6 +4,8 @@
"closeApp": "Cerrar aplicación",
"restartRecording": "Reiniciar grabación",
"cancelRecording": "Cancelar grabación",
+ "pauseRecording": "Pausar grabación",
+ "resumeRecording": "Reanudar grabación",
"openVideoFile": "Abrir archivo de video",
"openProject": "Abrir proyecto"
},
diff --git a/src/i18n/locales/zh-CN/launch.json b/src/i18n/locales/zh-CN/launch.json
index 0c2b3197f..6b63df190 100644
--- a/src/i18n/locales/zh-CN/launch.json
+++ b/src/i18n/locales/zh-CN/launch.json
@@ -4,6 +4,8 @@
"closeApp": "关闭应用",
"restartRecording": "重新开始录制",
"cancelRecording": "取消录制",
+ "pauseRecording": "暂停录制",
+ "resumeRecording": "继续录制",
"openVideoFile": "打开视频文件",
"openProject": "打开项目"
},