Aspect ratio improvements

This commit is contained in:
Arkadiusz Fal
2022-07-10 03:15:15 +02:00
parent 5f858bc6d4
commit 1e21c50b5d
7 changed files with 56 additions and 72 deletions

View File

@@ -33,18 +33,11 @@ struct VideoPlayerSizeModifier: ViewModifier {
}
var usedAspectRatio: Double {
guard aspectRatio != nil, aspectRatio != 0 else {
guard let aspectRatio = aspectRatio, aspectRatio != 0 else {
return VideoPlayerView.defaultAspectRatio
}
let ratio = [aspectRatio!, VideoPlayerView.defaultAspectRatio].min()!
let viewRatio = geometry.size.width / geometry.size.height
#if os(iOS)
return verticalSizeClass == .regular ? ratio : viewRatio
#else
return ratio
#endif
return [aspectRatio, VideoPlayerView.defaultAspectRatio].min()!
}
var usedAspectRatioContentMode: ContentMode {