Orientation fixes

This commit is contained in:
Arkadiusz Fal
2023-05-21 11:54:17 +02:00
parent 08ce572b9e
commit 2b7ccc4b03
2 changed files with 14 additions and 9 deletions

View File

@@ -486,6 +486,7 @@ final class PlayerModel: ObservableObject {
#endif
controls.hide()
controls.hideOverlays()
#if !os(macOS)
UIApplication.shared.isIdleTimerDisabled = presentingPlayer
@@ -502,6 +503,18 @@ final class PlayerModel: ObservableObject {
self?.pause()
}
}
if !presentingPlayer {
#if os(iOS)
if Defaults[.lockPortraitWhenBrowsing] {
Orientation.lockOrientation(.portrait, andRotateTo: .portrait)
} else {
Orientation.lockOrientation(.allButUpsideDown)
}
OrientationModel.shared.stopOrientationUpdates()
#endif
}
}
func changeActiveBackend(from: PlayerBackendType, to: PlayerBackendType, changingStream: Bool = true) {
@@ -1024,6 +1037,7 @@ final class PlayerModel: ObservableObject {
} else {
if activeBackend == .appleAVPlayer, avPlayerUsesSystemControls {
avPlayerBackend.controller.exitFullScreen(animated: true)
avPlayerBackend.controller.dismiss(animated: true)
}
let rotationOrientation = rotateToPortraitOnExitFullScreen ? UIInterfaceOrientation.portrait : nil
Orientation.lockOrientation(.allButUpsideDown, andRotateTo: rotationOrientation)