Skip to content

Commit ad944f1

Browse files
authored
fix(useVideoTexture): playsInline for ios (#2127)
1 parent 1fb663a commit ad944f1

File tree

3 files changed

+5
-4
lines changed

3 files changed

+5
-4
lines changed

.storybook/stories/VideoTexture.stories.tsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ function VideoTextureScene(props: React.ComponentProps<typeof VideoTexture>) {
3535

3636
export const VideoTextureSt = {
3737
args: {
38-
src: 'http://commondatastorage.googleapis.com/gtv-videos-bucket/sample/BigBuckBunny.mp4',
38+
src: 'https://commondatastorage.googleapis.com/gtv-videos-bucket/sample/BigBuckBunny.mp4',
3939
},
4040
render: (args) => <VideoTextureScene {...args} />,
4141
name: 'Default',
@@ -64,7 +64,7 @@ function FallbackMaterial({ url }: { url: string }) {
6464

6565
export const VideoTextureSt2 = {
6666
args: {
67-
src: 'http://commondatastorage.googleapis.com/gtv-videos-bucket/sample/BigBuckBunny.mp4',
67+
src: 'https://commondatastorage.googleapis.com/gtv-videos-bucket/sample/BigBuckBunny.mp4',
6868
},
6969
render: (args) => <VideoTextureScene2 {...args} />,
7070
name: 'Suspense',

docs/loaders/video-texture-use-video-texture.mdx

+1
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ export function useVideoTexture(
2828
crossOrigin = 'anonymous',
2929
muted = true,
3030
loop = true,
31+
playsInline = true,
3132
...videoProps
3233
}: {
3334
unsuspend?: keyof HTMLVideoElementEventMap

src/core/VideoTexture.tsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ export function useVideoTexture(
3030
crossOrigin = 'anonymous',
3131
muted = true,
3232
loop = true,
33+
playsInline = true,
3334
...videoProps
3435
}: {
3536
unsuspend?: keyof HTMLVideoElementEventMap
@@ -39,7 +40,6 @@ export function useVideoTexture(
3940
) {
4041
const gl = useThree((state) => state.gl)
4142
const hlsRef = useRef<Hls | null>(null)
42-
const videoRef = useRef<HTMLVideoElement | null>(null)
4343

4444
const texture = suspend(
4545
() =>
@@ -58,9 +58,9 @@ export function useVideoTexture(
5858
crossOrigin,
5959
loop,
6060
muted,
61+
playsInline,
6162
...videoProps,
6263
})
63-
videoRef.current = video
6464

6565
// hlsjs extension
6666
if (src && IS_BROWSER && src.endsWith('.m3u8')) {

0 commit comments

Comments
 (0)