Skip to content

Take control over your live stream video by running it yourself. Streaming + chat out of the box.

add a delay before recalculating vh 😭

Ginger Wong59ab5e9e9837
diff --git a/webroot/index.html b/webroot/index.html
index 9e15e3b9cd..3803b9cd70 100644
--- a/webroot/index.html
+++ b/webroot/index.html
@@ -30,6 +30,7 @@ problems;
- chat windwo placementis messedup on orientation changes.. needs new vh.
orientationchange oly happens on mobile.
does orientationchange happen when keyboard appears?
+- changing vh after orientation change sometimes yields same value
possible hacks
- if mobile, don't show chat + chat icon in landscape?..
diff --git a/webroot/js/app.js b/webroot/js/app.js
index d8070130fe..835b9a2a07 100644
--- a/webroot/js/app.js
+++ b/webroot/js/app.js
@@ -28,9 +28,8 @@ function setupApp() {
// style hackings
window.VIDEOJS_NO_DYNAMIC_STYLE = true;
if (hasTouchScreen()) {
- mobileVHhack();
+ setVHvar();
window.onorientationchange = handleOrientationChange;
- // document.addEventListener("orientationchange", handleOrientationChange);
}
diff --git a/webroot/js/message.js b/webroot/js/message.js
index a40f3c4b43..5281be2f3a 100644
--- a/webroot/js/message.js
+++ b/webroot/js/message.js
@@ -99,11 +99,11 @@ class Messaging {
handleKeyboardAppear() {
this.tagAppContainer.classList.add("android-message-focus");
- setVHvar();
+ mobileVHhack();
}
handleKeyboardOut() {
this.tagAppContainer.classList.remove("android-message-focus");
- setVHvar();
+ mobileVHhack();
}
handleChatToggle() {
diff --git a/webroot/js/utils.js b/webroot/js/utils.js
index ce9545bbcc..8e1d1cf981 100644
--- a/webroot/js/utils.js
+++ b/webroot/js/utils.js
@@ -44,9 +44,9 @@ function setVHvar() {
document.documentElement.style.setProperty('--vh', `${vh}px`);
console.log("== new vh", vh)
}
+// delayed
function mobileVHhack() {
- setVHvar();
- // window.addEventListener("orientationchange", setVHvar);
+ setTimeout(setVHvar, 100);
}
function isAndroidMobile() {
@@ -83,5 +83,5 @@ function hasTouchScreen() {
function handleOrientationChange(event) {
console.log("====orientation change 123", event, window.screen.orientation, window.orientation)
- setVHvar();
+ mobileVHhack();
}