Skip to content

Commit 5f8c517

Browse files
authored
fix: fixing pip and fullscreen video in player for mobile devices (#641)
* fix: fixing video rendering in player for mobiles
1 parent 2cb9239 commit 5f8c517

File tree

3 files changed

+11
-3
lines changed

3 files changed

+11
-3
lines changed

src/blocks/Media/__stories__/data.json

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,6 @@
131131
"customControlsOptions": {
132132
"type": "with-play-pause-button",
133133
"muteButtonShown": false,
134-
"backgroundShadowHidden": true,
135134
"positioning": "left"
136135
},
137136
"muted": true,
@@ -154,7 +153,6 @@
154153
"customControlsOptions": {
155154
"type": "with-play-pause-button",
156155
"muteButtonShown": false,
157-
"backgroundShadowHidden": true,
158156
"positioning": "left"
159157
},
160158
"muted": true,

src/components/ReactPlayer/CustomBarControls.scss

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ $withMuteControlWidth: 32px;
1616
bottom: 0;
1717
opacity: 0;
1818
transition: opacity $animationDuration ease 3s;
19+
z-index: 1;
1920

2021
&_shown {
2122
opacity: 1;

src/components/ReactPlayer/ReactPlayer.tsx

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ export const ReactPlayerBlock = React.forwardRef<ReactPlayerBlockHandler, ReactP
115115
const [started, setStarted] = useState(autoPlay);
116116
const [ended, setEnded] = useState<boolean>(false);
117117
const [isMounted, setIsMounted] = useState(false);
118-
const [hovered, setHovered] = useState(false);
118+
const [hovered, setHovered] = useState(isMobile);
119119

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

@@ -391,6 +391,15 @@ export const ReactPlayerBlock = React.forwardRef<ReactPlayerBlockHandler, ReactP
391391
onProgress={onProgress}
392392
onEnded={onEnded}
393393
aria-label={ariaLabel}
394+
config={{
395+
file: {
396+
attributes: {
397+
pip: isMobile ? 'false' : undefined,
398+
playsinline: isMobile ? '' : undefined,
399+
disablepictureinpicture: isMobile ? '' : undefined,
400+
},
401+
},
402+
}}
394403
/>
395404
{controls === MediaVideoControlsType.Custom && (
396405
<CustomBarControls

0 commit comments

Comments
 (0)