1
0
mirror of https://github.com/yattee/yattee.git synced 2024-12-14 22:30:32 +05:30

Aspect ratio fixes

This commit is contained in:
Arkadiusz Fal 2022-07-11 18:21:03 +02:00
parent 79f801ea60
commit d3336b3ae1
4 changed files with 12 additions and 12 deletions

View File

@ -318,7 +318,7 @@ final class AVPlayerBackend: PlayerBackend {
return return
} }
self.model.aspectRatio = self.aspectRatio self.updatePlayerAspectRatio()
if !preservingTime, if !preservingTime,
let segment = self.model.sponsorBlock.segments.first, let segment = self.model.sponsorBlock.segments.first,

View File

@ -45,6 +45,7 @@ final class MPVBackend: PlayerBackend {
networkStateTimer.start() networkStateTimer.start()
if isPlaying { if isPlaying {
self.updatePlayerAspectRatio()
startClientUpdates() startClientUpdates()
} else { } else {
stopControlsUpdates() stopControlsUpdates()
@ -204,11 +205,9 @@ final class MPVBackend: PlayerBackend {
self.model.lastSkipped = segment self.model.lastSkipped = segment
self.play() self.play()
self.model.aspectRatio = self.aspectRatio
} }
} else { } else {
self.play() self.play()
self.model.aspectRatio = self.aspectRatio
} }
} }
} }

View File

@ -98,4 +98,10 @@ extension PlayerBackend {
model.advanceToItem(item) model.advanceToItem(item)
} }
} }
func updatePlayerAspectRatio() {
DispatchQueue.main.async {
self.model.aspectRatio = aspectRatio
}
}
} }

View File

@ -300,15 +300,10 @@ struct VideoPlayerView: View {
} }
.overlay(GeometryReader { proxy in .overlay(GeometryReader { proxy in
Color.clear Color.clear
.onAppear { .onAppear { player.playerSize = proxy.size }
player.playerSize = proxy.size .onChange(of: proxy.size) { _ in player.playerSize = proxy.size }
} .onChange(of: player.controls.presentingOverlays) { _ in player.playerSize = proxy.size }
.onChange(of: proxy.size) { _ in .onChange(of: player.aspectRatio) { _ in player.playerSize = proxy.size }
player.playerSize = proxy.size
}
.onChange(of: player.controls.presentingOverlays) { _ in
player.playerSize = proxy.size
}
}) })
#if os(iOS) #if os(iOS)
.padding(.top, player.playingFullScreen && verticalSizeClass == .regular ? 20 : 0) .padding(.top, player.playingFullScreen && verticalSizeClass == .regular ? 20 : 0)