Fix managing screen saver on macOS

Fix #245
This commit is contained in:
Arkadiusz Fal 2022-08-13 16:17:10 +02:00
parent 2086c6f679
commit cf14ff51c5

View File

@ -45,7 +45,7 @@ final class MPVBackend: PlayerBackend {
networkStateTimer.start() networkStateTimer.start()
if isPlaying { if isPlaying {
self.model.updateAspectRatio() model.updateAspectRatio()
startClientUpdates() startClientUpdates()
} else { } else {
stopControlsUpdates() stopControlsUpdates()
@ -53,7 +53,13 @@ final class MPVBackend: PlayerBackend {
updateControlsIsPlaying() 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 { DispatchQueue.main.async {
UIApplication.shared.isIdleTimerDisabled = self.model.presentingPlayer && self.isPlaying UIApplication.shared.isIdleTimerDisabled = self.model.presentingPlayer && self.isPlaying
} }