File tree Expand file tree Collapse file tree 1 file changed +31
-1
lines changed Expand file tree Collapse file tree 1 file changed +31
-1
lines changed Original file line number Diff line number Diff line change @@ -118,4 +118,34 @@ or exposed via `ref`:
118
118
` ` ` jsx
119
119
const textureRef = useRef()
120
120
<VideoTexture ref={textureRef} src="/video.mp4" />
121
- ` ` `
121
+ ` ` `
122
+
123
+ ## Recipes
124
+
125
+ <details >
126
+
127
+ <summary >Black video texture on iOS/Safari</summary >
128
+
129
+ As of 2025-05-24 (iOS 18.5), if you `start: false` the texture will be full black. To workaround this you could:
130
+
131
+ ```tsx
132
+ const texture = useVideoTexture(src, { start : false } );
133
+
134
+ async function warmup(texture: THREE.VideoTexture) {
135
+ const video = texture .image as HTMLVideoElement ;
136
+
137
+ await video .play ();
138
+ setTimeout (() => {
139
+ video .pause ();
140
+ video .currentTime = 0 ;
141
+ }, 0 );
142
+ }
143
+
144
+ useEffect(() => {
145
+ warmup (texture ).catch ((err ) => console .log (" warmup failed" , err ));
146
+ } , [texture]);
147
+ ```
148
+
149
+ This will force WebKit to send pixels to the GPU texture.
150
+
151
+ </details >
You can’t perform that action at this time.
0 commit comments