Skip to content

Commit

Permalink
fix(useVideoTexture): playsInline for ios (#2127)
Browse files Browse the repository at this point in the history
  • Loading branch information
abernier authored Oct 19, 2024
1 parent 1fb663a commit ad944f1
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
4 changes: 2 additions & 2 deletions .storybook/stories/VideoTexture.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ function VideoTextureScene(props: React.ComponentProps<typeof VideoTexture>) {

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

export const VideoTextureSt2 = {
args: {
src: 'http://commondatastorage.googleapis.com/gtv-videos-bucket/sample/BigBuckBunny.mp4',
src: 'https://commondatastorage.googleapis.com/gtv-videos-bucket/sample/BigBuckBunny.mp4',
},
render: (args) => <VideoTextureScene2 {...args} />,
name: 'Suspense',
Expand Down
1 change: 1 addition & 0 deletions docs/loaders/video-texture-use-video-texture.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ export function useVideoTexture(
crossOrigin = 'anonymous',
muted = true,
loop = true,
playsInline = true,
...videoProps
}: {
unsuspend?: keyof HTMLVideoElementEventMap
Expand Down
4 changes: 2 additions & 2 deletions src/core/VideoTexture.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ export function useVideoTexture(
crossOrigin = 'anonymous',
muted = true,
loop = true,
playsInline = true,
...videoProps
}: {
unsuspend?: keyof HTMLVideoElementEventMap
Expand All @@ -39,7 +40,6 @@ export function useVideoTexture(
) {
const gl = useThree((state) => state.gl)
const hlsRef = useRef<Hls | null>(null)
const videoRef = useRef<HTMLVideoElement | null>(null)

const texture = suspend(
() =>
Expand All @@ -58,9 +58,9 @@ export function useVideoTexture(
crossOrigin,
loop,
muted,
playsInline,
...videoProps,
})
videoRef.current = video

// hlsjs extension
if (src && IS_BROWSER && src.endsWith('.m3u8')) {
Expand Down

0 comments on commit ad944f1

Please sign in to comment.