1
0
mirror of https://github.com/yattee/yattee.git synced 2024-12-13 22:00:31 +05:30

Merge pull request #772 from stonerl/re-enter-fullscreen-on-background-return

fixed fullscreen handling for backgrounding
This commit is contained in:
Arkadiusz Fal 2024-08-31 13:08:40 +02:00 committed by GitHub
commit e749307a0e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -56,6 +56,7 @@ final class PlayerModel: ObservableObject {
@Published var presentingPlayer = false { didSet { handlePresentationChange() } }
@Published var activeBackend = PlayerBackendType.mpv
@Published var forceBackendOnPlay: PlayerBackendType?
@Published var wasFullscreen = false
var avPlayerBackend = AVPlayerBackend()
var mpvBackend = MPVBackend()
@ -979,6 +980,17 @@ final class PlayerModel: ObservableObject {
avPlayerBackend.bindPlayerToLayer()
}
#if os(iOS)
if wasFullscreen {
wasFullscreen = false
DispatchQueue.main.async { [weak self] in
Delay.by(0.3) {
self?.enterFullScreen()
}
}
}
#endif
guard closePiPAndOpenPlayerOnEnteringForeground, playingInPictureInPicture else {
return
}
@ -993,6 +1005,15 @@ final class PlayerModel: ObservableObject {
} else if !playingInPictureInPicture {
avPlayerBackend.removePlayerFromLayer()
}
#if os(iOS)
guard playingFullScreen else { return }
wasFullscreen = playingFullScreen
DispatchQueue.main.async { [weak self] in
Delay.by(0.3) {
self?.exitFullScreen(showControls: false)
}
}
#endif
}
#endif