mirror of
https://github.com/yattee/yattee.git
synced 2025-10-10 01:18:16 +00:00
make time updates work for .mpv and .avp
- time update notifications work for both backends - only init mpv timers when mpv is the active backend - move notification extension to playerbackend
This commit is contained in:
@@ -183,11 +183,17 @@ final class MPVBackend: PlayerBackend {
|
||||
|
||||
init() {
|
||||
clientTimer = .init(interval: .seconds(Self.timeUpdateInterval), mode: .infinite) { [weak self] _ in
|
||||
self?.getTimeUpdates()
|
||||
guard let self = self, self.model.activeBackend == .mpv else {
|
||||
return
|
||||
}
|
||||
self.getTimeUpdates()
|
||||
}
|
||||
|
||||
networkStateTimer = .init(interval: .seconds(Self.networkStateUpdateInterval), mode: .infinite) { [weak self] _ in
|
||||
self?.updateNetworkState()
|
||||
guard let self = self, self.model.activeBackend == .mpv else {
|
||||
return
|
||||
}
|
||||
self.updateNetworkState()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -624,7 +630,3 @@ final class MPVBackend: PlayerBackend {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
extension Notification.Name {
|
||||
static let getTimeUpdatesNotification = Notification.Name("getTimeUpdatesNotification")
|
||||
}
|
||||
|
Reference in New Issue
Block a user