diff --git a/Shared/Constants.swift b/Shared/Constants.swift index e21b41c8..27e381c7 100644 --- a/Shared/Constants.swift +++ b/Shared/Constants.swift @@ -39,6 +39,32 @@ enum Constants { #endif } + static var isWindowFullscreen: Bool { + #if os(iOS) + guard let windowScene = UIApplication.shared.connectedScenes + .filter({ $0.activationState == .foregroundActive }) + .compactMap({ $0 as? UIWindowScene }) + .first, + let window = windowScene.windows.first + else { + return false + } + + let screenBounds = windowScene.screen.bounds + let windowBounds = window.frame + + // Check if window size matches screen bounds (accounting for small differences) + return abs(windowBounds.width - screenBounds.width) < 1 && + abs(windowBounds.height - screenBounds.height) < 1 + #else + return false + #endif + } + + static var iPadSystemControlsWidth: CGFloat { + 50 + } + static var isTvOS: Bool { #if os(tvOS) true diff --git a/Shared/Player/Controls/PlayerControls.swift b/Shared/Player/Controls/PlayerControls.swift index 64a68edf..0e355e96 100644 --- a/Shared/Player/Controls/PlayerControls.swift +++ b/Shared/Player/Controls/PlayerControls.swift @@ -329,6 +329,14 @@ struct PlayerControls: View { var buttonsBar: some View { HStack(spacing: playerControlsLayout.buttonsSpacing) { + #if os(iOS) + // On iPad in resizable windows, add leading space to avoid system window controls + if Constants.isIPad, !Constants.isWindowFullscreen { + Spacer() + .frame(width: Constants.iPadSystemControlsWidth) + } + #endif + fullscreenButton pipButton