From 3fb2c532ee2d867a157468f84a1e7a04472e37af Mon Sep 17 00:00:00 2001 From: Arkadiusz Fal Date: Mon, 15 Aug 2022 01:13:39 +0200 Subject: [PATCH] Fix player size when orientation is locked --- Shared/Player/VideoPlayerView.swift | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/Shared/Player/VideoPlayerView.swift b/Shared/Player/VideoPlayerView.swift index cd330aec..895ed79e 100644 --- a/Shared/Player/VideoPlayerView.swift +++ b/Shared/Player/VideoPlayerView.swift @@ -223,7 +223,8 @@ struct VideoPlayerView: View { } var playerHeight: Double? { - fullScreenLayout ? UIScreen.main.bounds.size.height - (OrientationTracker.shared.currentInterfaceOrientation.isPortrait ? (SafeArea.insets.top + SafeArea.insets.bottom) : 0) : nil + let lockedPortrait = player.lockedOrientation?.contains(.portrait) ?? false + return fullScreenLayout ? UIScreen.main.bounds.size.height - (OrientationTracker.shared.currentInterfaceOrientation.isPortrait || lockedPortrait ? (SafeArea.insets.top + SafeArea.insets.bottom) : 0) : nil } var playerEdgesIgnoringSafeArea: Edge.Set { @@ -372,10 +373,6 @@ struct VideoPlayerView: View { } var fullScreenLayout: Bool { - if player.currentItem.isNil { - return false - } - #if os(iOS) return player.playingFullScreen || verticalSizeClass == .compact #else