Playing transparent videos with alphachannel currently requires two file formats / codecs: webm (vp9) and mov (hvc1) for Safari.
This hook makes it easy to use two files as input and pick the right one. (Variation of useVideoTexture)
Usage (Vite example):
import { Billboard } from '@react-three/drei';
import { useAlphaVideoTexture } from './useAlphaVideoTexture';
import videoSrcWebm from './your-path/your-video.webm';
import videoSrcMov from './your-path/your-video.mov';
export function VideoDemo(props:Props) {
const videoTexture = useAlphaVideoTexture(props.srcWebm, props.srcMov, {});
return (
<Billboard>
<mesh>
<planeGeometry />
<meshBasicMaterial
map={videoTexture}
transparent
/>
</mesh>
</Billboard>
);
}