🎥 Make videos programmatically with React
throw error if trying to add GIF into an <Img> tag
Jonny Burgerd2f593b769f2
diff --git a/packages/core/src/Img.tsx b/packages/core/src/Img.tsxindex 97372a91b7..3345d49c95 100644--- a/packages/core/src/Img.tsx+++ b/packages/core/src/Img.tsx@@ -16,6 +16,12 @@ const ImgRefForwarding: React.ForwardRefRenderFunction<> = ({onError, ...props}, ref) => {const imageRef = useRef<HTMLImageElement>(null);+ if (props.src?.endsWith('.gif')) {+ throw new TypeError(+ 'The <Img> component does not support GIFs. Use the <Gif> instead: https://remotion.dev/docs/gif'+ );+ }+useImperativeHandle(ref, () => {return imageRef.current as HTMLImageElement;});