From a222c722c3e57c334ff4900e828ea2a07c866f50 Mon Sep 17 00:00:00 2001 From: Arkadiusz Fal Date: Wed, 17 Aug 2022 00:35:12 +0200 Subject: [PATCH] Fix applying video player size on iOS --- Model/Player/Backends/MPVClient.swift | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Model/Player/Backends/MPVClient.swift b/Model/Player/Backends/MPVClient.swift index dfb60efd..f81bf305 100644 --- a/Model/Player/Backends/MPVClient.swift +++ b/Model/Player/Backends/MPVClient.swift @@ -259,7 +259,8 @@ final class MPVClient: ObservableObject { DispatchQueue.main.async { [weak self] in guard let self = self else { return } UIView.animate(withDuration: 0.2, animations: { - let height = [self.backend.model.playerSize.height, self.backend.model.playerSize.width / self.aspectRatio].min()! + let aspectRatio = self.aspectRatio > 0 && self.aspectRatio < VideoPlayerView.defaultAspectRatio ? self.aspectRatio : VideoPlayerView.defaultAspectRatio + let height = [self.backend.model.playerSize.height, self.backend.model.playerSize.width / aspectRatio].min()! let offsetY = self.backend.model.playingFullScreen ? ((self.backend.model.playerSize.height / 2.0) - (height / 2)) : 0 self.glView?.frame = CGRect(x: 0, y: offsetY, width: roundedWidth, height: height) }) { completion in