Skip to content

Commit

Permalink
Prevent scrolling on iOS when fake full screen mode
Browse files Browse the repository at this point in the history
  • Loading branch information
SangwonOh committed Jul 9, 2024
1 parent 12a2cff commit a705904
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 7 deletions.
2 changes: 1 addition & 1 deletion dist/ovenplayer.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/ovenplayer.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "ovenplayer",
"version": "0.10.37",
"version": "0.10.37.1",
"description": "OvenPlayer is Open-Source HTML5 Player. OvenPlayer supports WebRTC Signaling from OvenMediaEngine for Sub-Second Latency Streaming.",
"main": "dist/ovenplayer.js",
"scripts": {
Expand Down
10 changes: 9 additions & 1 deletion src/js/view/components/controls/fullScreenButton.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,13 +59,19 @@ const FullScreenButton = function ($container, api) {
function resetFullscreenButtonState() {
OvenPlayerConsole.log("FULLSCREEN STATE : ", checkFullScreen());
if (checkFullScreen()) {
if (isForceMode) {
document.body.classList.add('op-fullscreen-helper');
}
$root.addClass("op-fullscreen");
isFullScreen = true;
$iconExpand.hide();
$iconCompress.show();

} else {
$root.removeClass("op-fullscreen");
if (isForceMode) {
$root.removeClass("op-fullscreen");
}
document.body.classList.remove('op-fullscreen-helper');
isFullScreen = false;
$iconExpand.show();
$iconCompress.hide();
Expand All @@ -80,12 +86,14 @@ const FullScreenButton = function ($container, api) {

function forcedFakeFullscreenToggle() {
if (!isFullScreen) {
document.body.classList.add('op-fullscreen-helper');
$root.addClass("op-fullscreen");
isFullScreen = true;
$iconExpand.hide();
$iconCompress.show();
} else {
$root.removeClass("op-fullscreen");
document.body.classList.remove('op-fullscreen-helper');
isFullScreen = false;
$iconExpand.show();
$iconCompress.hide();
Expand Down
12 changes: 9 additions & 3 deletions src/stylesheet/ovenplayer.less
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,12 @@
--op-accent-color: #50e3c2;
}

.op-fullscreen-helper {
overflow: hidden;
// for preventing scroll on iOS
position: fixed;
}

.op-wrapper.ovenplayer {
position: relative;
max-height: 100%;
Expand Down Expand Up @@ -142,8 +148,8 @@
}

&.op-fullscreen {
width: 100% !important;
height: 100% !important;
width: 100vw !important;
height: 100vh !important;
top: 0;
right: 0;
bottom: 0;
Expand Down Expand Up @@ -1970,4 +1976,4 @@ i.op-con {
.op-seek-button {
display: none !important;
}
}
}

0 comments on commit a705904

Please sign in to comment.