From 8900f96ce77e6329804f886d46ba30cb9d902746 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Toni=20F=C3=B6rster?= Date: Tue, 21 Nov 2023 13:47:51 +0100 Subject: [PATCH 1/4] honour the aspect ratio when resizing The `defaultMinimumHeightLeft? has been adjusted to make the radio of the video view 16:9 in its initial state. Also on macOS when resizing the window, the aspect ratio of the view now correlates with the video. --- Shared/Player/VideoPlayerSizeModifier.swift | 5 +---- Shared/Player/VideoPlayerView.swift | 8 ++++---- 2 files changed, 5 insertions(+), 8 deletions(-) diff --git a/Shared/Player/VideoPlayerSizeModifier.swift b/Shared/Player/VideoPlayerSizeModifier.swift index f1d07ed6..57fb7537 100644 --- a/Shared/Player/VideoPlayerSizeModifier.swift +++ b/Shared/Player/VideoPlayerSizeModifier.swift @@ -27,10 +27,7 @@ struct VideoPlayerSizeModifier: ViewModifier { content .frame(width: geometry.size.width) .frame(maxHeight: maxHeight) - - #if !os(macOS) .aspectRatio(ratio, contentMode: usedAspectRatioContentMode) - #endif } var ratio: CGFloat? { // swiftlint:disable:this no_cgfloat @@ -49,7 +46,7 @@ struct VideoPlayerSizeModifier: ViewModifier { #if os(iOS) fullScreen ? .fill : .fit #else - .fit + .fit #endif } diff --git a/Shared/Player/VideoPlayerView.swift b/Shared/Player/VideoPlayerView.swift index 568a9a1f..1b22d3b5 100644 --- a/Shared/Player/VideoPlayerView.swift +++ b/Shared/Player/VideoPlayerView.swift @@ -22,7 +22,7 @@ struct VideoPlayerView: View { static let defaultAspectRatio = 16 / 9.0 static var defaultMinimumHeightLeft: Double { #if os(macOS) - 300 + 335 #else 200 #endif @@ -315,7 +315,7 @@ struct VideoPlayerView: View { .id(player.currentVideo?.cacheKey) .transition(.opacity) } else { - VStack {} + VStack { } } } #endif @@ -393,7 +393,7 @@ struct VideoPlayerView: View { } #endif } else { - VStack {} + VStack { } } } .onChange(of: fullScreenPlayer) { newValue in @@ -508,6 +508,6 @@ struct VideoPlayerView_Previews: PreviewProvider { return view } - func updateUIView(_: UIView, context _: Context) {} + func updateUIView(_: UIView, context _: Context) { } } #endif From df47ffb0136958ed83f6ba0fbb9b8396b74422e1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Toni=20F=C3=B6rster?= Date: Tue, 21 Nov 2023 17:49:29 +0100 Subject: [PATCH 2/4] change default minWidth with hidden sidebar --- Shared/Player/VideoPlayerView.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Shared/Player/VideoPlayerView.swift b/Shared/Player/VideoPlayerView.swift index 1b22d3b5..612feff4 100644 --- a/Shared/Player/VideoPlayerView.swift +++ b/Shared/Player/VideoPlayerView.swift @@ -156,7 +156,7 @@ struct VideoPlayerView: View { .persistentSystemOverlays(!fullScreenPlayer) #endif #if os(macOS) - .frame(minWidth: 1100, minHeight: 700) + .frame(minWidth: playerSidebar != .never ? 1100 : 650, minHeight: 700) #endif } From c3e1465f312e6e96f71a51880f9e67757b28bbc1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Toni=20F=C3=B6rster?= Date: Tue, 21 Nov 2023 17:58:44 +0100 Subject: [PATCH 3/4] fix broken fullscreen on macOS --- Shared/Player/VideoPlayerSizeModifier.swift | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Shared/Player/VideoPlayerSizeModifier.swift b/Shared/Player/VideoPlayerSizeModifier.swift index 57fb7537..8fb0ff17 100644 --- a/Shared/Player/VideoPlayerSizeModifier.swift +++ b/Shared/Player/VideoPlayerSizeModifier.swift @@ -43,10 +43,10 @@ struct VideoPlayerSizeModifier: ViewModifier { } var usedAspectRatioContentMode: ContentMode { - #if os(iOS) - fullScreen ? .fill : .fit + #if os(tvOS) + .fit #else - .fit + fullScreen ? .fill : .fit #endif } From fc7a7b085f2415ea57fce22a82aaf5b1032df362 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Toni=20F=C3=B6rster?= Date: Sun, 26 Nov 2023 10:33:58 +0100 Subject: [PATCH 4/4] fixed styling --- Shared/Player/VideoPlayerView.swift | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Shared/Player/VideoPlayerView.swift b/Shared/Player/VideoPlayerView.swift index 612feff4..f9463d6a 100644 --- a/Shared/Player/VideoPlayerView.swift +++ b/Shared/Player/VideoPlayerView.swift @@ -315,7 +315,7 @@ struct VideoPlayerView: View { .id(player.currentVideo?.cacheKey) .transition(.opacity) } else { - VStack { } + VStack {} } } #endif @@ -393,7 +393,7 @@ struct VideoPlayerView: View { } #endif } else { - VStack { } + VStack {} } } .onChange(of: fullScreenPlayer) { newValue in @@ -508,6 +508,6 @@ struct VideoPlayerView_Previews: PreviewProvider { return view } - func updateUIView(_: UIView, context _: Context) { } + func updateUIView(_: UIView, context _: Context) {} } #endif