mirror of
https://github.com/yattee/yattee.git
synced 2024-12-22 21:43:41 +00:00
Orientation fixes
This commit is contained in:
parent
08ce572b9e
commit
2b7ccc4b03
@ -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)
|
||||
|
@ -140,15 +140,6 @@ struct VideoPlayerView: View {
|
||||
}
|
||||
}
|
||||
}
|
||||
.onDisappear {
|
||||
if Defaults[.lockPortraitWhenBrowsing] {
|
||||
Orientation.lockOrientation(.portrait, andRotateTo: .portrait)
|
||||
} else {
|
||||
Orientation.lockOrientation(.allButUpsideDown)
|
||||
}
|
||||
orientationModel.stopOrientationUpdates()
|
||||
player.controls.hideOverlays()
|
||||
}
|
||||
.onReceive(NotificationCenter.default.publisher(for: UIDevice.orientationDidChangeNotification)) { _ in
|
||||
guard player.lockedOrientation.isNil else {
|
||||
return
|
||||
|
Loading…
Reference in New Issue
Block a user