Skip to content

The free and privacy-friendly screen recorder with no limits 🎥

Fixed recording duration issue / editor post-recording

Alyssa X3889367dede8
diff --git a/src/manifest.json b/src/manifest.json
index cc04d9a..3ec403f 100755
--- a/src/manifest.json
+++ b/src/manifest.json
@@ -101,7 +101,7 @@
"managed_schema": "schema.json"
},
"externally_connectable": {
- "matches": ["https://app.screenity.io/*"]
+ "matches": ["https://app.screenity.io/*", "http://localhost:3000/*"]
},
"optional_permissions": [
"offscreen",
diff --git a/src/pages/Background/recording/stopRecording.js b/src/pages/Background/recording/stopRecording.js
index 4c1e796..cb0e068 100644
--- a/src/pages/Background/recording/stopRecording.js
+++ b/src/pages/Background/recording/stopRecording.js
@@ -8,18 +8,35 @@ import { supportsWebCodecs } from "../utils/featureDetection";
export const stopRecording = async () => {
chrome.action.setIcon({ path: "assets/icon-34.png" });
chrome.storage.local.set({ restarting: false });
- const { recordingStartTime, isSubscribed } = await chrome.storage.local.get([
+ const {
+ recordingStartTime,
+ isSubscribed,
+ paused,
+ pausedAt,
+ totalPausedMs,
+ } = await chrome.storage.local.get([
"recordingStartTime",
"isSubscribed",
+ "paused",
+ "pausedAt",
+ "totalPausedMs",
]);
- let duration = Date.now() - recordingStartTime;
+ const startTime = Number(recordingStartTime);
+ const now = Date.now();
+ const basePaused = Number(totalPausedMs) || 0;
+ const pausedAtMs = Number(pausedAt);
+ const extraPaused =
+ paused && Number.isFinite(pausedAtMs) && pausedAtMs > 0
+ ? Math.max(0, now - pausedAtMs)
+ : 0;
+
+ let duration =
+ Number.isFinite(startTime) && startTime > 0
+ ? Math.max(0, now - startTime - basePaused - extraPaused)
+ : 0;
const maxDuration = 7 * 60 * 1000;
- if (recordingStartTime === 0) {
- duration = 0;
- }
-
chrome.storage.local.set({
recording: false,
recordingDuration: duration,