Skip to content

Commit

Permalink
fix: off pip and enable playsinline for mobile with autoplay
Browse files Browse the repository at this point in the history
  • Loading branch information
kkmch committed Oct 16, 2023
1 parent c010913 commit a59565b
Showing 1 changed file with 4 additions and 8 deletions.
12 changes: 4 additions & 8 deletions src/components/ReactPlayer/ReactPlayer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -349,7 +349,7 @@ export const ReactPlayerBlock = React.forwardRef<ReactPlayerBlockHandler, ReactP

const onFocusIn = useCallback(() => setHovered(true), []);
const onFocusOut = useCallback(() => setHovered(false), []);
const pictureInPictureEnabled = !isMobile || !autoPlay;
const isPipEnabled = !isMobile || !props.autoplay;

return (
<div
Expand Down Expand Up @@ -392,16 +392,12 @@ export const ReactPlayerBlock = React.forwardRef<ReactPlayerBlockHandler, ReactP
onProgress={onProgress}
onEnded={onEnded}
aria-label={ariaLabel}
pip={pictureInPictureEnabled}
playsinline={autoPlay}
config={{
file: {
attributes: {
pip: pictureInPictureEnabled ? undefined : 'false',
playsinline: autoPlay ? '' : undefined,
disablepictureinpicture: pictureInPictureEnabled
? undefined
: '',
pip: isPipEnabled ? undefined : 'false',
playsinline: isPipEnabled ? undefined : '',
disablepictureinpicture: isPipEnabled ? undefined : '',
},
},
}}
Expand Down

0 comments on commit a59565b

Please sign in to comment.