This commit is contained in:
Nicolas Mowen 2024-03-08 06:48:06 -07:00
parent 61cc47034e
commit 53638cac9e

View File

@ -45,7 +45,6 @@ export default function PreviewVideoPlayer({
// controlling playback // controlling playback
const previewRef = useRef<HTMLVideoElement | null>(null); const previewRef = useRef<HTMLVideoElement | null>(null);
const [previewReady, setPreviewReady] = useState(false);
const controller = useMemo(() => { const controller = useMemo(() => {
if (!config || !previewRef.current) { if (!config || !previewRef.current) {
return undefined; return undefined;
@ -54,7 +53,7 @@ export default function PreviewVideoPlayer({
return new PreviewVideoController(camera, previewRef); return new PreviewVideoController(camera, previewRef);
// we only care when preview is ready // we only care when preview is ready
// eslint-disable-next-line react-hooks/exhaustive-deps // eslint-disable-next-line react-hooks/exhaustive-deps
}, [camera, config, previewReady]); }, [camera, config, previewRef.current]);
useEffect(() => { useEffect(() => {
if (!controller) { if (!controller) {
@ -135,7 +134,6 @@ export default function PreviewVideoPlayer({
onSeeked={onPreviewSeeked} onSeeked={onPreviewSeeked}
onLoadedData={() => { onLoadedData={() => {
previewRef.current?.pause(); previewRef.current?.pause();
setPreviewReady(true);
controller?.previewReady(); controller?.previewReady();
}} }}
> >