From cf14ff51c517be70fde124a6998cc341b4efa67e Mon Sep 17 00:00:00 2001 From: Arkadiusz Fal Date: Sat, 13 Aug 2022 16:17:10 +0200 Subject: [PATCH] Fix managing screen saver on macOS Fix #245 --- Model/Player/Backends/MPVBackend.swift | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/Model/Player/Backends/MPVBackend.swift b/Model/Player/Backends/MPVBackend.swift index 57fad010..49b95c83 100644 --- a/Model/Player/Backends/MPVBackend.swift +++ b/Model/Player/Backends/MPVBackend.swift @@ -45,7 +45,7 @@ final class MPVBackend: PlayerBackend { networkStateTimer.start() if isPlaying { - self.model.updateAspectRatio() + model.updateAspectRatio() startClientUpdates() } else { stopControlsUpdates() @@ -53,7 +53,13 @@ final class MPVBackend: PlayerBackend { updateControlsIsPlaying() - #if !os(macOS) + #if os(macOS) + if isPlaying { + ScreenSaverManager.shared.disable(reason: "Yattee is playing video") + } else { + ScreenSaverManager.shared.enable() + } + #else DispatchQueue.main.async { UIApplication.shared.isIdleTimerDisabled = self.model.presentingPlayer && self.isPlaying }