Fix player overlay opacity

This commit is contained in:
Arkadiusz Fal 2023-04-24 12:57:31 +02:00
parent 40097de1fd
commit c7b64c973d
2 changed files with 8 additions and 2 deletions

View File

@ -10,7 +10,7 @@ extension PlayerModel {
} }
var videoForDisplay: Video? { var videoForDisplay: Video? {
videoBeingOpened ?? (closing ? nil : currentVideo) videoBeingOpened ?? currentVideo
} }
func play(_ videos: [Video], shuffling: Bool = false) { func play(_ videos: [Video], shuffling: Bool = false) {

View File

@ -30,10 +30,16 @@ struct PlayerOverlayModifier: ViewModifier {
} }
} }
.animation(.easeIn, value: player.videoForDisplay) .animation(.easeIn, value: player.videoForDisplay)
.opacity(player.videoForDisplay == nil ? 0 : 1) .opacity(opacity)
} }
} }
var opacity: Double {
guard !player.closing else { return 0 }
return player.videoForDisplay == nil ? 0 : 1
}
var maxWidth: Double { var maxWidth: Double {
playerBarMaxWidth == "0" ? .infinity : (Double(playerBarMaxWidth) ?? 600) playerBarMaxWidth == "0" ? .infinity : (Double(playerBarMaxWidth) ?? 600)
} }