diff --git a/enjoy/src/renderer/components/medias/media-recorder.tsx b/enjoy/src/renderer/components/medias/media-recorder.tsx index f2759f62..a071b36e 100644 --- a/enjoy/src/renderer/components/medias/media-recorder.tsx +++ b/enjoy/src/renderer/components/medias/media-recorder.tsx @@ -9,6 +9,8 @@ import { t } from "i18next"; import { toast } from "@renderer/components/ui"; import { MediaRecordButton } from "@renderer/components"; +const ONE_MINUTE = 60; + export const MediaRecorder = () => { const { layout, @@ -92,6 +94,7 @@ export const MediaRecorder = () => { record.on("record-end", async (blob: Blob) => { createRecording({ blob, duration: Date.now() - startAt }); + setIsRecording(false); }); let interval: NodeJS.Timeout; @@ -103,8 +106,8 @@ export const MediaRecorder = () => { setDuration(0); interval = setInterval(() => { setDuration((duration) => { - if (duration >= 3000) { - setIsRecording(false); + if (duration >= ONE_MINUTE) { + record.stopRecording(); } return duration + 0.1; }); @@ -130,7 +133,7 @@ export const MediaRecorder = () => {
{duration.toFixed(1)} - / 300 + / {ONE_MINUTE}