fix: PiP on Android

This commit is contained in:
NoCrypt 2024-08-08 13:38:44 +07:00
parent 6dbc21d4ec
commit a53d6c46bf
4 changed files with 17 additions and 3 deletions

View file

@ -41,6 +41,7 @@
"capacitor-plugin-safe-area": "^3.0.3",
"capacitor-volume-control": "^0.0.1",
"common": "workspace:*",
"cordova-plugin-fullscreen": "^1.3.0",
"cordova-plugin-navigationbar": "^1.0.31",
"cordova-plugin-pip": "^0.0.2",
"cordova-plugin-screen-orientation": "^3.0.4",

View file

@ -88,7 +88,7 @@ updateInsets()
StatusBar.setStyle({ style: Style.Dark })
StatusBar.setOverlaysWebView({ overlay: true })
navigationbar.setUp(true)
// navigationbar.setUp(true)
// cordova screen orientation plugin is also used, and it patches global screen.orientation.lock

View file

@ -108,10 +108,14 @@
document.addEventListener('fullscreenchange', () => {
isFullscreen = !!document.fullscreenElement
if (document.fullscreenElement) {
window.Capacitor.Plugins.StatusBar.hide()
// window.Capacitor.Plugins.StatusBar.hide()
window.AndroidFullScreen.immersiveMode()
screen.orientation.lock('landscape')
} else {
window.Capacitor.Plugins.StatusBar.show()
// window.Capacitor.Plugins.StatusBar.show()
window.AndroidFullScreen.showSystemUI()
window.Capacitor.Plugins.StatusBar.setOverlaysWebView({ overlay: true })
screen.orientation.unlock()
}
})

View file

@ -108,6 +108,9 @@ importers:
common:
specifier: workspace:*
version: link:../common
cordova-plugin-fullscreen:
specifier: ^1.3.0
version: 1.3.0
cordova-plugin-navigationbar:
specifier: ^1.0.31
version: 1.0.31
@ -1913,6 +1916,10 @@ packages:
peerDependencies:
webpack: ^5.1.0
cordova-plugin-fullscreen@1.3.0:
resolution: {integrity: sha512-K0SQMUyemQrezNlnfyHXQd8BgpwR3TS/fx456GueRCUdro5QG6tCzDDVBCVEGeKroDhXWmabAlhvO3gPoqw/tg==}
engines: {'0': {name: cordova, version: '>=3.0.0'}}
cordova-plugin-navigationbar@1.0.31:
resolution: {integrity: sha512-xt9tx5Aprf052OvuG2JohjRkkU/6U6XQ8mXOx93HaHFz6cCZI1+B0pl/uoyU/FkJsP41QIw1upnMdzgav11ifw==}
engines: {'0': {name: cordova, version: '>=3.0.0'}}
@ -7744,6 +7751,8 @@ snapshots:
serialize-javascript: 6.0.2
webpack: 5.91.0(webpack-cli@5.1.4)
cordova-plugin-fullscreen@1.3.0: {}
cordova-plugin-navigationbar@1.0.31: {}
cordova-plugin-pip@0.0.2: {}