Fix video details offset

This commit is contained in:
Arkadiusz Fal 2022-06-27 00:15:01 +02:00
parent c960a82885
commit 575c2dd2ba
2 changed files with 5 additions and 5 deletions

View File

@ -4,20 +4,20 @@ import SwiftUI
struct VideoDetailsPaddingModifier: ViewModifier {
static var defaultAdditionalDetailsPadding = 0.0
let geometry: GeometryProxy
let playerSize: CGSize
let aspectRatio: Double?
let minimumHeightLeft: Double
let additionalPadding: Double
let fullScreen: Bool
init(
geometry: GeometryProxy,
playerSize: CGSize,
aspectRatio: Double? = nil,
minimumHeightLeft: Double? = nil,
additionalPadding: Double? = nil,
fullScreen: Bool = false
) {
self.geometry = geometry
self.playerSize = playerSize
self.aspectRatio = aspectRatio ?? VideoPlayerView.defaultAspectRatio
self.minimumHeightLeft = minimumHeightLeft ?? VideoPlayerView.defaultMinimumHeightLeft
self.additionalPadding = additionalPadding ?? Self.defaultAdditionalDetailsPadding
@ -33,7 +33,7 @@ struct VideoDetailsPaddingModifier: ViewModifier {
}
var playerHeight: Double {
[geometry.size.width / usedAspectRatio, geometry.size.height - minimumHeightLeft].min()!
playerSize.height
}
var topPadding: Double {

View File

@ -240,7 +240,7 @@ struct VideoPlayerView: View {
}
.background(colorScheme == .dark ? Color.black : Color.white)
.modifier(VideoDetailsPaddingModifier(
geometry: geometry,
playerSize: player.playerSize,
aspectRatio: player.avPlayerBackend.controller?.aspectRatio,
fullScreen: fullScreenDetails
))