From 53638cac9ec167a6b8970e7afa323a7f49b54f4e Mon Sep 17 00:00:00 2001 From: Nicolas Mowen Date: Fri, 8 Mar 2024 06:48:06 -0700 Subject: [PATCH] Simplify --- web/src/components/player/PreviewVideoPlayer.tsx | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/web/src/components/player/PreviewVideoPlayer.tsx b/web/src/components/player/PreviewVideoPlayer.tsx index f1371b650..dfa263853 100644 --- a/web/src/components/player/PreviewVideoPlayer.tsx +++ b/web/src/components/player/PreviewVideoPlayer.tsx @@ -45,7 +45,6 @@ export default function PreviewVideoPlayer({ // controlling playback const previewRef = useRef(null); - const [previewReady, setPreviewReady] = useState(false); const controller = useMemo(() => { if (!config || !previewRef.current) { return undefined; @@ -54,7 +53,7 @@ export default function PreviewVideoPlayer({ return new PreviewVideoController(camera, previewRef); // we only care when preview is ready // eslint-disable-next-line react-hooks/exhaustive-deps - }, [camera, config, previewReady]); + }, [camera, config, previewRef.current]); useEffect(() => { if (!controller) { @@ -135,7 +134,6 @@ export default function PreviewVideoPlayer({ onSeeked={onPreviewSeeked} onLoadedData={() => { previewRef.current?.pause(); - setPreviewReady(true); controller?.previewReady(); }} >