glodrei
Version:
useful add-ons for react-three-fiber
26 lines (20 loc) • 701 B
text/mdx
title: WebcamVideoTexture
sourcecode: src/web/WebcamVideoTexture.tsx
[](https://drei.pmnd.rs/?path=/story/misc-webcamvideotexture) 
<Intro>Create a video texture from [`getUserMedia`](https://developer.mozilla.org/en-US/docs/Web/API/MediaDevices/getUserMedia)</Intro>
```tsx
export type WebcamVideoTextureProps = Omit<VideoTextureProps, 'src'> & {
constraints?: MediaStreamConstraints
}
```
```jsx
<WebcamVideoTexture>
{(texture) => <meshBasicMaterial map={texture} />}
```
or exposed via `ref`:
```jsx
const textureRef = useRef()
<WebcamVideoTexture ref={textureRef} />
```