Skip to content

armgit / mimik

Public Imported from GitHub
0

🎬 A browser extension and desktop app that turns your clicks into step-by-step guides with annotated screenshots πŸ“–

refactor(export): move video timing constants to the eager support module

Luis Ortiz7b6eff6b51e0
diff --git a/src/core/export/video-export.ts b/src/core/export/video-export.ts
index 3656193..d4d01d0 100644
--- a/src/core/export/video-export.ts
+++ b/src/core/export/video-export.ts
@@ -4,7 +4,15 @@ import { dataUrlToBytes, fitLogo, loadBranding } from '@/core/export/branding';
import type { ExportOptions } from '@/core/export/options';
import { loadExportOptions } from '@/core/export/options';
import { extractDomain, formatDate } from '@/core/export/utils';
-import { FRAME_HEIGHT, FRAME_WIDTH, pickContainer } from '@/core/export/video-support';
+import {
+ FPS,
+ FRAME_HEIGHT,
+ FRAME_WIDTH,
+ pickContainer,
+ STEP_SECONDS,
+ STEP_ZOOM_TRANSITION_SEC,
+ STEP_ZOOMED_OUT_SEC,
+} from '@/core/export/video-support';
import { actionSteps, calloutAccent, isBlock } from '@/core/guides/blocks';
import type { BlockType, Guide, Screenshot, Step } from '@/core/guides/types';
import type { Ctx } from '@/core/screenshot/draw';
@@ -12,10 +20,6 @@ import { drawRoundedRect } from '@/core/screenshot/draw';
import { clamp, resolveTarget, resolveViewport } from '@/core/screenshot/geometry';
import { renderScreenshot } from '@/core/screenshot/render';
-export const FPS = 30;
-const STEP_ZOOMED_OUT_SEC = 1.5;
-const STEP_ZOOM_TRANSITION_SEC = 0.73;
-const STEP_ZOOMED_IN_SEC = 3;
const TRANSITION_DURATION_SEC = 0.33;
const COVER_SECONDS = 3;
const KEY_FRAME_INTERVAL_SEC = 2;
@@ -58,7 +62,7 @@ const CALLOUT_MAX_LINES = 4;
const CALLOUT_BAR_WIDTH = 6;
const CALLOUT_BAR_GAP = 26;
-export const STEP_SECONDS = STEP_ZOOMED_OUT_SEC + STEP_ZOOM_TRANSITION_SEC + STEP_ZOOMED_IN_SEC;
+export { FPS, STEP_SECONDS };
export function toFrames(seconds: number, fps = FPS): number {
return Math.round(seconds * fps);
diff --git a/src/core/export/video-support.ts b/src/core/export/video-support.ts
index becad2c..191baae 100644
--- a/src/core/export/video-support.ts
+++ b/src/core/export/video-support.ts
@@ -1,6 +1,12 @@
export const FRAME_WIDTH = 1280;
export const FRAME_HEIGHT = 720;
+export const FPS = 30;
+export const STEP_ZOOMED_OUT_SEC = 1.5;
+export const STEP_ZOOM_TRANSITION_SEC = 0.73;
+export const STEP_ZOOMED_IN_SEC = 3;
+export const STEP_SECONDS = STEP_ZOOMED_OUT_SEC + STEP_ZOOM_TRANSITION_SEC + STEP_ZOOMED_IN_SEC;
+
export const AVC_CODEC = 'avc1.64001f';
export const VP9_CODEC = 'vp09.00.31.08';