diff --git a/Model/Player/Backends/AVPlayerBackend.swift b/Model/Player/Backends/AVPlayerBackend.swift index 9b71a9af..ad3e7200 100644 --- a/Model/Player/Backends/AVPlayerBackend.swift +++ b/Model/Player/Backends/AVPlayerBackend.swift @@ -318,7 +318,7 @@ final class AVPlayerBackend: PlayerBackend { return } - self.model.aspectRatio = self.aspectRatio + self.updatePlayerAspectRatio() if !preservingTime, let segment = self.model.sponsorBlock.segments.first, diff --git a/Model/Player/Backends/MPVBackend.swift b/Model/Player/Backends/MPVBackend.swift index 2c264ffa..38279725 100644 --- a/Model/Player/Backends/MPVBackend.swift +++ b/Model/Player/Backends/MPVBackend.swift @@ -45,6 +45,7 @@ final class MPVBackend: PlayerBackend { networkStateTimer.start() if isPlaying { + self.updatePlayerAspectRatio() startClientUpdates() } else { stopControlsUpdates() @@ -204,11 +205,9 @@ final class MPVBackend: PlayerBackend { self.model.lastSkipped = segment self.play() - self.model.aspectRatio = self.aspectRatio } } else { self.play() - self.model.aspectRatio = self.aspectRatio } } } diff --git a/Model/Player/Backends/PlayerBackend.swift b/Model/Player/Backends/PlayerBackend.swift index 3b2a4179..ee7d1b1b 100644 --- a/Model/Player/Backends/PlayerBackend.swift +++ b/Model/Player/Backends/PlayerBackend.swift @@ -98,4 +98,10 @@ extension PlayerBackend { model.advanceToItem(item) } } + + func updatePlayerAspectRatio() { + DispatchQueue.main.async { + self.model.aspectRatio = aspectRatio + } + } } diff --git a/Shared/Player/VideoPlayerView.swift b/Shared/Player/VideoPlayerView.swift index 4dff939a..f1c3e0e8 100644 --- a/Shared/Player/VideoPlayerView.swift +++ b/Shared/Player/VideoPlayerView.swift @@ -300,15 +300,10 @@ struct VideoPlayerView: View { } .overlay(GeometryReader { proxy in Color.clear - .onAppear { - player.playerSize = proxy.size - } - .onChange(of: proxy.size) { _ in - player.playerSize = proxy.size - } - .onChange(of: player.controls.presentingOverlays) { _ in - player.playerSize = proxy.size - } + .onAppear { 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: player.aspectRatio) { _ in player.playerSize = proxy.size } }) #if os(iOS) .padding(.top, player.playingFullScreen && verticalSizeClass == .regular ? 20 : 0)