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

This commit is contained in:
Siddharth
2026-04-05 10:17:35 -07:00
parent e90bba82ef
commit c868469be5
5 changed files with 19 additions and 4 deletions
+1 -1
View File
@@ -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}
+12 -3
View File
@@ -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,
+2
View File
@@ -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"
},
+2
View File
@@ -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"
},
+2
View File
@@ -4,6 +4,8 @@
"closeApp": "关闭应用",
"restartRecording": "重新开始录制",
"cancelRecording": "取消录制",
"pauseRecording": "暂停录制",
"resumeRecording": "继续录制",
"openVideoFile": "打开视频文件",
"openProject": "打开项目"
},