The rendering part of the flickering (if this helps)
<>
<Video
ref={videoRef}
src={videoSrc}
width={width}
height={height}
style={{
display: "none",
}}
crossOrigin="anonymous" // Added crossOrigin attribute
onError={handleError} // Added error handling
/>
{videoData && videoTexture ? (
<ThreeCanvas
orthographic={false}
width={width}
height={height}
style={{
background: "linear-gradient(to bottom, #2c003e, #590080)",
}}
camera={{ fov: 75, position: [0, 0, 500] }}
>
<ambientLight intensity={0.15} />
<pointLight args={[undefined, 0.4]} position={[0, 0, 0]} />
<mesh position={[imageXPosition, 0, 0]} rotation={[0, 0.01, 0]}>
<planeGeometry args={[videoData.width, videoData.height]} />
<meshBasicMaterial map={videoTexture} toneMapped={false} />
</mesh>
</ThreeCanvas>
) : null}
</>