Skip to content

Commit

Permalink
fix: fixing pip and fullscreen video in player for mobile devices (#641)
Browse files Browse the repository at this point in the history
* fix: fixing video rendering in player for mobiles
  • Loading branch information
Kyzyl-ool authored Oct 17, 2023
1 parent 2cb9239 commit 5f8c517
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 3 deletions.
2 changes: 0 additions & 2 deletions src/blocks/Media/__stories__/data.json
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,6 @@
"customControlsOptions": {
"type": "with-play-pause-button",
"muteButtonShown": false,
"backgroundShadowHidden": true,
"positioning": "left"
},
"muted": true,
Expand All @@ -154,7 +153,6 @@
"customControlsOptions": {
"type": "with-play-pause-button",
"muteButtonShown": false,
"backgroundShadowHidden": true,
"positioning": "left"
},
"muted": true,
Expand Down
1 change: 1 addition & 0 deletions src/components/ReactPlayer/CustomBarControls.scss
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ $withMuteControlWidth: 32px;
bottom: 0;
opacity: 0;
transition: opacity $animationDuration ease 3s;
z-index: 1;

&_shown {
opacity: 1;
Expand Down
11 changes: 10 additions & 1 deletion src/components/ReactPlayer/ReactPlayer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ export const ReactPlayerBlock = React.forwardRef<ReactPlayerBlockHandler, ReactP
const [started, setStarted] = useState(autoPlay);
const [ended, setEnded] = useState<boolean>(false);
const [isMounted, setIsMounted] = useState(false);
const [hovered, setHovered] = useState(false);
const [hovered, setHovered] = useState(isMobile);

useMount(() => setIsMounted(true));

Expand Down Expand Up @@ -391,6 +391,15 @@ export const ReactPlayerBlock = React.forwardRef<ReactPlayerBlockHandler, ReactP
onProgress={onProgress}
onEnded={onEnded}
aria-label={ariaLabel}
config={{
file: {
attributes: {
pip: isMobile ? 'false' : undefined,
playsinline: isMobile ? '' : undefined,
disablepictureinpicture: isMobile ? '' : undefined,
},
},
}}
/>
{controls === MediaVideoControlsType.Custom && (
<CustomBarControls
Expand Down

0 comments on commit 5f8c517

Please sign in to comment.