diff --git a/packages/tldraw/src/lib/shapes/video/VideoShapeUtil.tsx b/packages/tldraw/src/lib/shapes/video/VideoShapeUtil.tsx index 8c0ffb493..89eb5f83c 100644 --- a/packages/tldraw/src/lib/shapes/video/VideoShapeUtil.tsx +++ b/packages/tldraw/src/lib/shapes/video/VideoShapeUtil.tsx @@ -46,6 +46,7 @@ export class VideoShapeUtil extends BaseBoxShapeUtil { const handlePlay = useCallback>( (e) => { const video = e.currentTarget + if (!video) return editor.updateShapes([ { @@ -64,6 +65,7 @@ export class VideoShapeUtil extends BaseBoxShapeUtil { const handlePause = useCallback>( (e) => { const video = e.currentTarget + if (!video) return editor.updateShapes([ { @@ -82,6 +84,7 @@ export class VideoShapeUtil extends BaseBoxShapeUtil { const handleSetCurrentTime = useCallback>( (e) => { const video = e.currentTarget + if (!video) return if (isEditing) { editor.updateShapes([ @@ -103,6 +106,7 @@ export class VideoShapeUtil extends BaseBoxShapeUtil { const handleLoadedData = useCallback>( (e) => { const video = e.currentTarget + if (!video) return if (time !== video.currentTime) { video.currentTime = time } @@ -119,7 +123,6 @@ export class VideoShapeUtil extends BaseBoxShapeUtil { // If the current time changes and we're not editing the video, update the video time useEffect(() => { const video = rVideo.current - if (!video) return if (isLoaded && !isEditing && time !== video.currentTime) { @@ -136,6 +139,7 @@ export class VideoShapeUtil extends BaseBoxShapeUtil { useEffect(() => { if (prefersReducedMotion) { const video = rVideo.current + if (!video) return video.pause() video.currentTime = 0 }