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 πŸ“–

fix: tell the video player which container it is playing

Luis Ortiz1f72cae28eec
diff --git a/AGENTS.md b/AGENTS.md
index e33c1c5..41162be 100644
--- a/AGENTS.md
+++ b/AGENTS.md
@@ -1016,6 +1016,14 @@ everywhere but macOS.
| Video | `core/export/video-export.ts` | WebCodecs via mediabunny (lazy), mp4/H.264 with WebM/VP9 fallback |
| GIF | `core/export/gif-export.ts` | gifenc (lazy), same frame timeline as the video; user picks Small/Medium/Large from `GIF_SPECS` |
+The preview player is told the container rather than assuming one. `pickContainer` answers `mp4`
+only when the machine can encode H.264 and falls back to WebM/VP9 otherwise, so a hardcoded
+`type: 'video/mp4'` on the player describes the file wrongly on any machine without an H.264
+encoder β€” a VM without GPU acceleration, typically. The export itself succeeds and the chapter list
+fills in, so the only symptom is a black frame reading 0:00 / 0:00. `VideoStepPlayer` now takes the
+mime alongside the url and `ExportPreviewModal` reads it off the blob. `check:pipeline` asserts the
+blob's type matches the extension, which is the pairing that was wrong.
+
Video frames reuse `renderScreenshot`, so the auto-crop, click-target outline, annotations and
redactions are already baked in. Each step holds 1.5s wide, eases into a crop around the target
over 0.73s, holds 3s close, and consecutive steps cross-dissolve over 0.33s at 30fps. Capability
diff --git a/apps/desktop/src/renderer/check-pipeline.ts b/apps/desktop/src/renderer/check-pipeline.ts
index e3d54f0..c398b9a 100644
--- a/apps/desktop/src/renderer/check-pipeline.ts
+++ b/apps/desktop/src/renderer/check-pipeline.ts
@@ -122,6 +122,28 @@ window.mimik.onRequest('mimik:check:verify', async (payload) => {
['DOCX', () => exportGuideAsDOCX(guide, steps, screenshots)],
];
+ try {
+ const { canExportVideo } = await import('@mimik/core/export/video-support');
+ if (!(await canExportVideo())) {
+ results.push({ name: 'video export', ok: true, detail: 'n/a β€” this build encodes no video' });
+ } else {
+ const { exportGuideAsVideo } = await import('@mimik/core/export/video-export');
+ const out = await exportGuideAsVideo(guide, steps, screenshots);
+ const mime = out.blob.type;
+ results.push({
+ name: 'video export',
+ ok: out.blob.size > 0 && mime === `video/${out.extension}` && out.chapters.length === steps.length,
+ detail: `${out.blob.size} bytes, ${mime}, .${out.extension}, ${out.chapters.length} chapter(s)`,
+ });
+ }
+ } catch (error) {
+ results.push({
+ name: 'video export',
+ ok: false,
+ detail: error instanceof Error ? error.message : String(error),
+ });
+ }
+
for (const [name, run] of exporters) {
try {
const output = await run();
diff --git a/packages/ui/src/fullview/ExportPreviewModal.tsx b/packages/ui/src/fullview/ExportPreviewModal.tsx
index 8ec72cf..5a7c263 100644
--- a/packages/ui/src/fullview/ExportPreviewModal.tsx
+++ b/packages/ui/src/fullview/ExportPreviewModal.tsx
@@ -20,6 +20,8 @@ import { Dialog, DialogContent, DialogHeader, DialogTitle } from '@mimik/ui/comp
import { FileCode, FileDown, FileImage, FileText, Loader2, Video } from 'lucide-react';
import { lazy, Suspense, useEffect, useRef, useState } from 'react';
+import type { VideoMime } from './VideoStepPlayer';
+
const VideoStepPlayer = lazy(() => import('./VideoStepPlayer'));
const VIDEO_AUTOPLAY_STEP_LIMIT = 25;
@@ -44,6 +46,7 @@ export default function ExportPreviewModal({ open, onOpenChange, guide, steps, s
const [videoSupported, setVideoSupported] = useState(false);
const [mode, setMode] = useState<PreviewMode>('document');
const [videoUrl, setVideoUrl] = useState<string | null>(null);
+ const [videoType, setVideoType] = useState<VideoMime>('video/mp4');
const [videoChapters, setVideoChapters] = useState<VideoChapter[]>([]);
const [downloadProgress, setDownloadProgress] = useState(0);
const downloadAbort = useRef<AbortController | null>(null);
@@ -111,6 +114,7 @@ export default function ExportPreviewModal({ open, onOpenChange, guide, steps, s
);
if (controller.signal.aborted) return;
url = URL.createObjectURL(blob);
+ setVideoType(blob.type === 'video/webm' ? 'video/webm' : 'video/mp4');
setVideoChapters(chapters);
setVideoUrl(url);
} catch (error) {
@@ -391,7 +395,7 @@ export default function ExportPreviewModal({ open, onOpenChange, guide, steps, s
</div>
) : videoUrl ? (
<Suspense fallback={null}>
- <VideoStepPlayer key={videoUrl} src={videoUrl} chapters={videoChapters} />
+ <VideoStepPlayer key={videoUrl} src={videoUrl} type={videoType} chapters={videoChapters} />
</Suspense>
) : (
<div className="flex flex-col items-center gap-2 bg-card border border-border rounded-xl px-4 py-3">
diff --git a/packages/ui/src/fullview/VideoStepPlayer.tsx b/packages/ui/src/fullview/VideoStepPlayer.tsx
index 476a75f..d46b43a 100644
--- a/packages/ui/src/fullview/VideoStepPlayer.tsx
+++ b/packages/ui/src/fullview/VideoStepPlayer.tsx
@@ -22,8 +22,11 @@ const KIND_DOT: Record<StepKind, string> = {
note: 'bg-muted-foreground',
};
+export type VideoMime = 'video/mp4' | 'video/webm';
+
interface VideoStepPlayerProps {
src: string;
+ type: VideoMime;
chapters: VideoChapter[];
}
@@ -144,10 +147,10 @@ function PlayerBody({ chapters }: { chapters: VideoChapter[] }) {
);
}
-export default function VideoStepPlayer({ src, chapters }: VideoStepPlayerProps) {
+export default function VideoStepPlayer({ src, type, chapters }: VideoStepPlayerProps) {
return (
<MediaPlayer
- src={{ src, type: 'video/mp4' }}
+ src={{ src, type }}
autoPlay
muted
playsInline