Skip to content

🎥 Make videos programmatically with React

convert progress

Jonny Burgera3a32412d4b0
diff --git a/packages/convert/app/components/ConvertProgress.tsx b/packages/convert/app/components/ConvertProgress.tsx
index 7bc7c66fc0..3694f6918b 100644
--- a/packages/convert/app/components/ConvertProgress.tsx
+++ b/packages/convert/app/components/ConvertProgress.tsx
@@ -17,7 +17,7 @@ export const ConvertProgress: React.FC<{
return (
<>
<Card className="overflow-hidden">
- <VideoThumbnail ref={convertProgressRef} />
+ <VideoThumbnail ref={convertProgressRef} smallThumbOnMobile={false} />
<div className="border-b-2 border-black" />
<div className="h-5 overflow-hidden">
{state.overallProgress ? (
diff --git a/packages/convert/app/components/Probe.tsx b/packages/convert/app/components/Probe.tsx
index 062bcbd66e..e4207de997 100644
--- a/packages/convert/app/components/Probe.tsx
+++ b/packages/convert/app/components/Probe.tsx
@@ -69,7 +69,7 @@ export const Probe: React.FC<{
className={`w-full lg:${probeDetails ? 'w-[800px]' : 'w-[350px]'} overflow-hidden`}
>
<div className="flex flex-row lg:flex-col w-full border-b-2 border-black">
- <VideoThumbnail ref={videoThumbnailRef} />
+ <VideoThumbnail ref={videoThumbnailRef} smallThumbOnMobile />
<CardHeader className=" p-3 lg:p-4 w-full">
<CardTitle title={name ?? undefined}>
{name ? name : <Skeleton className="h-5 w-[220px] inline-block" />}
diff --git a/packages/convert/app/components/VideoThumbnail.tsx b/packages/convert/app/components/VideoThumbnail.tsx
index 452d15abfe..174afd2466 100644
--- a/packages/convert/app/components/VideoThumbnail.tsx
+++ b/packages/convert/app/components/VideoThumbnail.tsx
@@ -4,13 +4,18 @@ import {useIsNarrow} from '~/lib/is-narrow';
const THUMBNAIL_HEIGHT = Math.round((350 / 16) * 9);
+type Props = {
+ readonly smallThumbOnMobile: boolean;
+};
+
export type VideoThumbnailRef = {
draw: (videoFrame: VideoFrame) => void;
};
const VideoThumbnailRefForward: React.ForwardRefRenderFunction<
- VideoThumbnailRef
-> = (_props, forwardedRef) => {
+ VideoThumbnailRef,
+ Props
+> = ({smallThumbOnMobile}, forwardedRef) => {
const ref = useRef<HTMLCanvasElement>(null);
const [color, setColor] = useState<string>('transparent');
@@ -51,7 +56,7 @@ const VideoThumbnailRefForward: React.ForwardRefRenderFunction<
const isNarrow = useIsNarrow();
- const scale = isNarrow ? 0.5 : 1;
+ const scale = isNarrow && smallThumbOnMobile ? 0.5 : 1;
return (
<div