🎥 Make videos programmatically with React
`@remotion/three`: Use `cancelRender()` for `useVideoTexture()`
JonnyBurger68f6fae44f16
diff --git a/packages/three/src/use-video-texture.ts b/packages/three/src/use-video-texture.tsindex 865182aa0e..cccc1c020f 100644--- a/packages/three/src/use-video-texture.ts+++ b/packages/three/src/use-video-texture.ts@@ -1,6 +1,11 @@import React, {useCallback, useEffect, useState} from 'react';import type {Video} from 'remotion';-import {continueRender, delayRender, useCurrentFrame} from 'remotion';+import {+ cancelRender,+ continueRender,+ delayRender,+ useCurrentFrame,+} from 'remotion';import type {VideoTexture} from 'three/src/textures/VideoTexture';export type UseVideoTextureOptions = React.ComponentProps<typeof Video>;@@ -38,13 +43,8 @@ export const useVideoTexture = (const [vidText] = useState(() => import('three/src/textures/VideoTexture.js'),);- const [error, setError] = useState<Error | null>(null);const frame = useCurrentFrame();- if (error) {- throw error;- }-const onReady = useCallback(() => {vidText.then(({VideoTexture}) => {@@ -60,7 +60,7 @@ export const useVideoTexture = (continueRender(loaded);}).catch((err) => {- setError(err);+ cancelRender(err);});}, [loaded, vidText, videoRef]);