mirror of
https://github.com/yattee/yattee.git
synced 2024-12-22 21:43:41 +00:00
make thumbnail fill the view in music mode
Signed-off-by: Toni Förster <toni.foerster@gmail.com>
This commit is contained in:
parent
a194738bb6
commit
1cb695848c
@ -248,29 +248,31 @@ struct PlayerControls: View {
|
|||||||
return [player.playerSize.height - inset, 500].min()!
|
return [player.playerSize.height - inset, 500].min()!
|
||||||
}
|
}
|
||||||
|
|
||||||
@ViewBuilder var controlsBackground: some View {
|
@ViewBuilder
|
||||||
|
var controlsBackground: some View {
|
||||||
|
GeometryReader { geometry in
|
||||||
ZStack {
|
ZStack {
|
||||||
if player.musicMode,
|
if player.musicMode,
|
||||||
let url = controlsBackgroundURL
|
let video = player.videoForDisplay
|
||||||
{
|
{
|
||||||
|
let thumbnail = thumbnails.best(video)
|
||||||
|
if let url = thumbnail.url,
|
||||||
|
let quality = thumbnail.quality
|
||||||
|
{
|
||||||
|
let aspectRatio = (quality == .default || quality == .high) ? Constants.aspectRatio4x3 : Constants.aspectRatio16x9
|
||||||
|
|
||||||
ThumbnailView(url: url)
|
ThumbnailView(url: url)
|
||||||
.frame(maxWidth: .infinity, maxHeight: .infinity)
|
.aspectRatio(aspectRatio, contentMode: .fill)
|
||||||
|
.frame(width: geometry.size.width, height: geometry.size.height)
|
||||||
.transition(.opacity)
|
.transition(.opacity)
|
||||||
.animation(.default)
|
.animation(.default)
|
||||||
|
.clipped()
|
||||||
|
}
|
||||||
} else if player.videoForDisplay == nil {
|
} else if player.videoForDisplay == nil {
|
||||||
Color.black
|
Color.black
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
var controlsBackgroundURL: URL? {
|
|
||||||
if let video = player.videoForDisplay,
|
|
||||||
let url = thumbnails.best(video).url
|
|
||||||
{
|
|
||||||
return url
|
|
||||||
}
|
|
||||||
|
|
||||||
return nil
|
|
||||||
}
|
}
|
||||||
|
|
||||||
var timeline: some View {
|
var timeline: some View {
|
||||||
|
Loading…
Reference in New Issue
Block a user