Fix the fullscreen bug on Android (#49)

This commit is contained in:
redphx 2023-08-08 07:35:34 +07:00
parent da7ff64471
commit 5a5c65e7a2

View File

@ -2784,6 +2784,22 @@ function onStreamStarted($video) {
}
function disablePwa() {
const userAgent = (window.navigator.orgUserAgent || window.navigator.userAgent || '').toLowerCase();
if (!userAgent) {
return;
}
// Check if it's Safari on mobile
if (userAgent.includes('mobile') && userAgent.includes('safari') && !userAgent.includes('chrom')) {
// Disable the PWA prompt
Object.defineProperty(window.navigator, 'standalone', {
value: true,
});
}
}
// Hide Settings UI when navigate to another page
window.addEventListener('xcloud_popstate', onHistoryChanged);
window.addEventListener('popstate', onHistoryChanged);
@ -2831,7 +2847,4 @@ setupVideoSettingsBar();
setupScreenshotButton();
StreamStats.render();
// Disable PWA prompt in Safari on iOS/iPadOS
Object.defineProperty(window.navigator, 'standalone', {
value: true,
});
disablePwa();