Fix animation of overlays

This commit is contained in:
Arkadiusz Fal 2022-08-23 23:15:00 +02:00
parent 9197309115
commit 9def7fc8ac

View File

@ -60,10 +60,12 @@ struct VideoPlayerView: View {
var body: some View { var body: some View {
ZStack(alignment: overlayAlignment) { ZStack(alignment: overlayAlignment) {
videoPlayer videoPlayer
.zIndex(-1)
#if os(iOS) #if os(iOS)
.gesture(playerControls.presentingControlsOverlay ? videoPlayerCloseControlsOverlayGesture : nil) .gesture(playerControls.presentingControlsOverlay ? videoPlayerCloseControlsOverlayGesture : nil)
#endif #endif
VStack {
if playerControls.presentingControlsOverlay { if playerControls.presentingControlsOverlay {
HStack { HStack {
HStack { HStack {
@ -81,7 +83,6 @@ struct VideoPlayerView: View {
.padding() .padding()
.modifier(ControlBackgroundModifier()) .modifier(ControlBackgroundModifier())
.clipShape(RoundedRectangle(cornerRadius: 4)) .clipShape(RoundedRectangle(cornerRadius: 4))
.transition(.opacity)
} }
#if !os(tvOS) #if !os(tvOS)
.frame(maxWidth: fullScreenLayout ? .infinity : player.playerSize.width) .frame(maxWidth: fullScreenLayout ? .infinity : player.playerSize.width)
@ -96,6 +97,9 @@ struct VideoPlayerView: View {
#if os(tvOS) #if os(tvOS)
.clipShape(RoundedRectangle(cornerRadius: 10)) .clipShape(RoundedRectangle(cornerRadius: 10))
#endif #endif
.zIndex(1)
.transition(.opacity)
}
} }
} }
.onAppear { .onAppear {