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(player): label the preview with the container it actually got

Luis Ortize64498feb3b6
diff --git a/src/ui/fullview/ExportPreviewModal.tsx b/src/ui/fullview/ExportPreviewModal.tsx
index 86b99f8..aab9065 100644
--- a/src/ui/fullview/ExportPreviewModal.tsx
+++ b/src/ui/fullview/ExportPreviewModal.tsx
@@ -55,6 +55,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<'video/mp4' | 'video/webm'>('video/mp4');
const [videoChapters, setVideoChapters] = useState<VideoChapter[]>([]);
const [downloadProgress, setDownloadProgress] = useState(0);
const downloadAbort = useRef<AbortController | null>(null);
@@ -140,6 +141,7 @@ export default function ExportPreviewModal({ open, onOpenChange, guide, steps, s
const {
blob,
chapters,
+ extension,
voiceoverError: failed,
} = await exportGuideAsVideo(
guide,
@@ -158,6 +160,7 @@ export default function ExportPreviewModal({ open, onOpenChange, guide, steps, s
);
if (controller.signal.aborted) return;
url = URL.createObjectURL(blob);
+ setVideoType(extension === 'webm' ? 'video/webm' : 'video/mp4');
setVideoChapters(chapters);
setVoiceoverError(failed ?? null);
setNarratedSeconds(
@@ -583,6 +586,7 @@ export default function ExportPreviewModal({ open, onOpenChange, guide, steps, s
<VideoStepPlayer
key={videoUrl}
src={videoUrl}
+ type={videoType}
chapters={videoChapters}
narrated={voiceover && !voiceoverError}
/>
diff --git a/src/ui/fullview/VideoStepPlayer.tsx b/src/ui/fullview/VideoStepPlayer.tsx
index be4f908..08e7f55 100644
--- a/src/ui/fullview/VideoStepPlayer.tsx
+++ b/src/ui/fullview/VideoStepPlayer.tsx
@@ -25,6 +25,7 @@ const KIND_DOT: Record<StepKind, string> = {
interface VideoStepPlayerProps {
src: string;
+ type: 'video/mp4' | 'video/webm';
chapters: VideoChapter[];
narrated?: boolean;
}
@@ -149,15 +150,17 @@ function PlayerBody({ chapters }: { chapters: VideoChapter[] }) {
</div>
</div>
- {chapters.length > 0 && <StepList chapters={chapters} index={index} onJump={jump} />}
+ {chapters.length > 0 && (
+ <StepList chapters={chapters} index={index} narrated={narrated} playing={!paused} onJump={jump} />
+ )}
</>
);
}
-export default function VideoStepPlayer({ src, chapters, narrated = false }: VideoStepPlayerProps) {
+export default function VideoStepPlayer({ src, type, chapters, narrated = false }: VideoStepPlayerProps) {
return (
<MediaPlayer
- src={{ src, type: 'video/mp4' }}
+ src={{ src, type }}
autoPlay={!narrated}
muted={!narrated}
playsInline