1
0
Fork 0
mirror of https://gitlab.com/futo-org/fcast.git synced 2025-08-03 07:47:01 +00:00

WebOS 22 and 6.0 collection of fixes

This commit is contained in:
Michael Hollister 2024-12-17 22:59:41 -06:00
parent 902ccff8bc
commit d57e1368b1
13 changed files with 228 additions and 36 deletions

View file

@ -9,5 +9,6 @@
"icon": "assets/icons/icon.png",
"largeIcon": "assets/icons/largeIcon.png",
"iconColor": "#0a62f5",
"splashBackground": "assets/images/splash.png"
"splashBackground": "assets/images/splash.png",
"disableBackHistoryAPI": "true"
}

View file

@ -1,6 +1,29 @@
import 'common/main/Preload';
enum RemoteKeyCode {
Stop = 413,
Rewind = 412,
Play = 415,
Pause = 19,
FastForward = 417,
Back = 461,
}
// Cannot go back to a state where user was previously casting a video, so exit.
window.onpopstate = () => {
window.webOS.platformBack();
};
// window.onpopstate = () => {
// window.webOS.platformBack();
// };
document.addEventListener('keydown', (event: any) => {
// console.log("KeyDown", event);
switch (event.keyCode) {
// WebOS 22 and earlier does not work well using the history API,
// so manually handling page navigation...
case RemoteKeyCode.Back:
window.webOS.platformBack();
break;
default:
break;
}
});

View file

@ -2,14 +2,19 @@ import 'common/main/Renderer';
const backgroundVideo = document.getElementById('video-player');
const loadingScreen = document.getElementById('loading-screen');
let backgroundVideoLoaded = false;
let qrCodeRendered = false;
// WebOS 6.0 requires global scope for access during callback invocation
// eslint-disable-next-line no-var
var backgroundVideoLoaded: boolean;
// eslint-disable-next-line no-var
var qrCodeRendered: boolean;
backgroundVideo.onplaying = () => {
backgroundVideoLoaded = true;
if (backgroundVideoLoaded && qrCodeRendered) {
loadingScreen.style.display = 'none';
backgroundVideo.onplaying = null;
}
};

View file

@ -5,6 +5,17 @@
#overlay {
font-family: InterRegular;
font-size: 28px;
/* gap not supported in WebOS 6.0 */
gap: unset;
}
#main-view {
padding: 25px;
/* gap not supported in WebOS 6.0 */
gap: unset;
margin-right: 15vw;
}
#title-text {

View file

@ -17,12 +17,23 @@ import {
playerCtrlVolumeBarProgress,
videoCaptions,
formatDuration,
skipBack,
skipForward,
} from 'common/player/Renderer';
const captionsBaseHeightCollapsed = 150;
const captionsBaseHeightExpanded = 320;
const captionsLineHeight = 68;
enum RemoteKeyCode {
Stop = 413,
Rewind = 412,
Play = 415,
Pause = 19,
FastForward = 417,
Back = 461,
}
export function targetPlayerCtrlStateUpdate(event: PlayerControlEvent): boolean {
let handledCase = false;
@ -74,11 +85,57 @@ export function targetPlayerCtrlStateUpdate(event: PlayerControlEvent): boolean
}
// eslint-disable-next-line @typescript-eslint/no-explicit-any
export function targetKeyDownEventListener(event: any) {
switch (event.code) {
export function targetKeyDownEventListener(event: any): boolean {
let handledCase = false;
switch (event.keyCode) {
case RemoteKeyCode.Stop:
// history.back();
window.open('../main_window/index.html');
handledCase = true;
break;
case RemoteKeyCode.Rewind:
skipBack();
event.preventDefault();
handledCase = true;
break;
case RemoteKeyCode.Play:
if (player.isPaused()) {
player.play();
}
event.preventDefault();
handledCase = true;
break;
case RemoteKeyCode.Pause:
if (!player.isPaused()) {
player.pause();
}
event.preventDefault();
handledCase = true;
break;
case RemoteKeyCode.FastForward:
skipForward();
event.preventDefault();
handledCase = true;
break;
// WebOS 22 and earlier does not work well using the history API,
// so manually handling page navigation...
case RemoteKeyCode.Back:
// history.back();
window.open('../main_window/index.html');
event.preventDefault();
handledCase = true;
break;
default:
break;
}
return handledCase;
};
if (window.webOSAPI.pendingPlay !== null) {

View file

@ -1,8 +1,8 @@
{
"compilerOptions": {
"target": "ES2022",
"module": "ES2022",
"moduleResolution": "node",
"target": "ES2015",
"module": "ES2015",
"moduleResolution": "node10",
"sourceMap": false,
"emitDecoratorMetadata": true,
"esModuleInterop": true,