diff --git a/Shared/Player/Controls/PlayerControls.swift b/Shared/Player/Controls/PlayerControls.swift index 0d4f49ab..13623e7a 100644 --- a/Shared/Player/Controls/PlayerControls.swift +++ b/Shared/Player/Controls/PlayerControls.swift @@ -342,7 +342,10 @@ struct PlayerControls: View { if player.lockedOrientation.isNil { let orientationMask = OrientationTracker.shared.currentInterfaceOrientationMask player.lockedOrientation = orientationMask - Orientation.lockOrientation(orientationMask) + let orientation = OrientationTracker.shared.currentInterfaceOrientation + Orientation.lockOrientation(orientationMask, andRotateTo: .landscapeLeft) + // iOS 16 workaround + Orientation.lockOrientation(orientationMask, andRotateTo: orientation) } else { player.lockedOrientation = nil Orientation.lockOrientation(.allButUpsideDown, andRotateTo: OrientationTracker.shared.currentInterfaceOrientation) diff --git a/iOS/Orientation.swift b/iOS/Orientation.swift index 9854272f..c1560cc9 100644 --- a/iOS/Orientation.swift +++ b/iOS/Orientation.swift @@ -30,9 +30,6 @@ struct Orientation { logger.info("rotating to \(orientationString)") - UIDevice.current.setValue(rotateOrientation.rawValue, forKey: "orientation") - UINavigationController.attemptRotationToDeviceOrientation() - if #available(iOS 16, *) { guard let windowScene = SafeArea.scene else { return } let rotateOrientationMask = rotateOrientation == .portrait ? UIInterfaceOrientationMask.portrait : @@ -43,6 +40,10 @@ struct Orientation { windowScene.requestGeometryUpdate(.iOS(interfaceOrientations: rotateOrientationMask)) { error in print("denied rotation \(error)") } + } else { + UIDevice.current.setValue(rotateOrientation.rawValue, forKey: "orientation") } + + UINavigationController.attemptRotationToDeviceOrientation() } }