diff --git a/Resources/iOS/Settings.bundle/en.lproj/Root.strings b/Resources/iOS/Settings.bundle/en.lproj/Root.strings index 0efdae45229bddd76ce2539307ea1b7c51cc048a..5f42393f27078895273b18541d528f652ca4e15d 100644 --- a/Resources/iOS/Settings.bundle/en.lproj/Root.strings +++ b/Resources/iOS/Settings.bundle/en.lproj/Root.strings @@ -97,6 +97,7 @@ "SETTINGS_HWDECODING_INFO" = "Content encoded in the H.264 and H.265 formats can be decoded in hardware leading to a significant improvement of battery life and performance. Be careful when disabling this option."; "SETTINGS_HWDECODING_ON" = "On"; "SETTINGS_HWDECODING_OFF" = "Off"; +"SETTINGS_LOCK_ROTATION" = "Force the rotation lock"; "SETTINGS_CASTING" = "Casting"; "SETTINGS_PTCASTING" = "Audio passthrough"; "SETTINGS_PTCASTINGLONG" = "Let your TV manage audio rendering"; diff --git a/Sources/Headers/VLCConstants.h b/Sources/Headers/VLCConstants.h index 23904a6b33c75f9b4c52ec7dbc28958464dea0ad..f77fb4456aa6b95367c547466465b92b05b99ec2 100644 --- a/Sources/Headers/VLCConstants.h +++ b/Sources/Headers/VLCConstants.h @@ -49,6 +49,7 @@ #define kVLCSettingDeinterlaceDefaultValue @(-1) #define kVLCSettingHardwareDecoding @"codec" #define kVLCSettingHardwareDecodingDefault @"" +#define kVLCSettingRotationLock @"kVLCSettingRotationLock" #define kVLCSettingNetworkCaching @"network-caching" #define kVLCSettingNetworkCachingDefaultValue @(999) #define kVLCSettingNetworkRTSPTCP @"rtsp-tcp" diff --git a/Sources/Playback/Player/VideoPlayer-iOS/VideoPlayerViewController.swift b/Sources/Playback/Player/VideoPlayer-iOS/VideoPlayerViewController.swift index 25e428b44f910559cfdc7507fed46f5a428661e5..3f1af126b23f9b8d22eaef26a9ff4debcce75269 100644 --- a/Sources/Playback/Player/VideoPlayer-iOS/VideoPlayerViewController.swift +++ b/Sources/Playback/Player/VideoPlayer-iOS/VideoPlayerViewController.swift @@ -1316,6 +1316,14 @@ extension VideoPlayerViewController { if currentState == .opening { updateAudioInterface(with: playbackService.metadata) + if UserDefaults.standard.bool(forKey: kVLCSettingRotationLock) { + videoPlayerControls.handleRotationLockButton(videoPlayerControls) + } + } + + if currentState == .stopped { + supportedInterfaceOrientations = .allButUpsideDown + videoPlayerControls.rotationLockButton.tintColor = .white } } diff --git a/Sources/Settings/Model/SettingsSection.swift b/Sources/Settings/Model/SettingsSection.swift index b980173f27720cea5d456e34b931d49d81a6e10c..0331bffe5528a89b5aceabf219175655950ed8c0 100644 --- a/Sources/Settings/Model/SettingsSection.swift +++ b/Sources/Settings/Model/SettingsSection.swift @@ -532,13 +532,18 @@ enum VideoOptions { ) } + static var lockRotation: SettingsItem { + .toggle(title: "SETTINGS_LOCK_ROTATION", subtitle: nil, preferenceKey: kVLCSettingRotationLock) + } + static func section() -> SettingsSection? { - .init(title: "SETTINGS_VIDEO_TITLE", items: [ - deBlockingFilter, - deInterlace, - hardwareDecoding, - rememberPlayerBrightness - ]) + var options = [deBlockingFilter, deInterlace, hardwareDecoding, rememberPlayerBrightness] + + if UIDevice.current.userInterfaceIdiom == .phone { + options.append(lockRotation) + } + + return .init(title: "SETTINGS_VIDEO_TITLE", items: options) } }