Skip to content

Commit

Permalink
doc
Browse files Browse the repository at this point in the history
  • Loading branch information
abernier committed Nov 30, 2024
1 parent 95b0d34 commit 0a09433
Show file tree
Hide file tree
Showing 4 changed files with 54 additions and 2 deletions.
26 changes: 26 additions & 0 deletions docs/loaders/screen-video-texture.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
---
title: ScreenVideoTexture
sourcecode: src/core/ScreenVideoTexture.tsx
---

[![](https://img.shields.io/badge/-storybook-%23ff69b4)](https://drei.pmnd.rs/?path=/story/misc-screenvideotexture) ![](https://img.shields.io/badge/-suspense-brightgreen)

<Intro>Create a video texture from [`getDisplayMedia`](https://developer.mozilla.org/en-US/docs/Web/API/MediaDevices/getDisplayMedia)</Intro>

```tsx
export type ScreenVideoTextureProps = Omit<VideoTextureProps, 'src'> & {
options?: DisplayMediaStreamOptions
}
```
```jsx
<ScreenVideoTexture>
{(texture) => <meshBasicMaterial map={texture} />}
```
or exposed via `ref`:
```jsx
const textureRef = useRef()
<ScreenVideoTexture ref={textureRef} />
```
26 changes: 26 additions & 0 deletions docs/loaders/webcam-video-texture.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
---
title: WebcamVideoTexture
sourcecode: src/core/WebcamVideoTexture.tsx
---

[![](https://img.shields.io/badge/-storybook-%23ff69b4)](https://drei.pmnd.rs/?path=/story/misc-webcamvideotexture) ![](https://img.shields.io/badge/-suspense-brightgreen)

<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} />
```
2 changes: 1 addition & 1 deletion src/core/ScreenVideoTexture.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ export type ScreenVideoTextureProps = Omit<VideoTextureProps, 'src'> & {
}

/**
* Create a video texture from `getDisplayMedia`
* Create a video texture from [`getDisplayMedia`](https://developer.mozilla.org/en-US/docs/Web/API/MediaDevices/getDisplayMedia)
*/
export const ScreenVideoTexture = /* @__PURE__ */ forwardRef<THREE.VideoTexture, ScreenVideoTextureProps>(
({ options = { video: true }, ...props }, fref) => {
Expand Down
2 changes: 1 addition & 1 deletion src/core/WebcamVideoTexture.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ export type WebcamVideoTextureProps = Omit<VideoTextureProps, 'src'> & {
}

/**
* Create a video texture from `getUserMedia`
* Create a video texture from [`getUserMedia`](https://developer.mozilla.org/en-US/docs/Web/API/MediaDevices/getUserMedia)
*/
export const WebcamVideoTexture = /* @__PURE__ */ forwardRef<THREE.VideoTexture, WebcamVideoTextureProps>(
(
Expand Down

0 comments on commit 0a09433

Please sign in to comment.