mirror of
https://github.com/yattee/yattee.git
synced 2024-12-22 21:43:41 +00:00
Fix updating system controls playback status on macOS
This commit is contained in:
parent
6c6ba19df4
commit
c3e2e5c258
@ -480,13 +480,10 @@ final class AVPlayerBackend: PlayerBackend {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
if self.controlsUpdates {
|
self.model.updateNowPlayingInfo()
|
||||||
self.playerTime.duration = self.playerItemDuration ?? .zero
|
|
||||||
self.playerTime.currentTime = self.currentTime ?? .zero
|
|
||||||
}
|
|
||||||
|
|
||||||
#if !os(tvOS)
|
#if os(macOS)
|
||||||
self.model.updateNowPlayingInfo()
|
MPNowPlayingInfoCenter.default().playbackState = self.avPlayer.timeControlStatus == .playing ? .playing : .paused
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if let currentTime = self.currentTime {
|
if let currentTime = self.currentTime {
|
||||||
|
@ -3,6 +3,7 @@ import CoreMedia
|
|||||||
import Defaults
|
import Defaults
|
||||||
import Foundation
|
import Foundation
|
||||||
import Logging
|
import Logging
|
||||||
|
import MediaPlayer
|
||||||
import Repeat
|
import Repeat
|
||||||
import SwiftUI
|
import SwiftUI
|
||||||
|
|
||||||
@ -59,6 +60,8 @@ final class MPVBackend: PlayerBackend {
|
|||||||
} else {
|
} else {
|
||||||
ScreenSaverManager.shared.enable()
|
ScreenSaverManager.shared.enable()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
MPNowPlayingInfoCenter.default().playbackState = isPlaying ? .playing : .paused
|
||||||
#else
|
#else
|
||||||
DispatchQueue.main.async {
|
DispatchQueue.main.async {
|
||||||
UIApplication.shared.isIdleTimerDisabled = self.model.presentingPlayer && self.isPlaying
|
UIApplication.shared.isIdleTimerDisabled = self.model.presentingPlayer && self.isPlaying
|
||||||
|
Loading…
Reference in New Issue
Block a user