mirror of
https://github.com/yattee/yattee.git
synced 2025-08-09 20:24:06 +00:00
no need for NotificationCenter
This commit is contained in:
@@ -116,10 +116,6 @@ final class AVPlayerBackend: PlayerBackend {
|
||||
#endif
|
||||
}
|
||||
|
||||
deinit {
|
||||
NotificationCenter.default.removeObserver(self, name: .getTimeUpdatesNotification, object: self.currentTime)
|
||||
}
|
||||
|
||||
func bestPlayable(_ streams: [Stream], maxResolution: ResolutionSetting) -> Stream? {
|
||||
let sortedByResolution = streams
|
||||
.filter { ($0.kind == .adaptive || $0.kind == .stream) && $0.resolution <= maxResolution.value }
|
||||
@@ -601,7 +597,7 @@ final class AVPlayerBackend: PlayerBackend {
|
||||
self.updateControls()
|
||||
}
|
||||
|
||||
NotificationCenter.default.post(name: .getTimeUpdatesNotification, object: self.currentTime)
|
||||
self.model.updateTime(self.currentTime!)
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -182,6 +182,7 @@ final class MPVBackend: PlayerBackend {
|
||||
}
|
||||
|
||||
init() {
|
||||
// swiftlint:disable shorthand_optional_binding
|
||||
clientTimer = .init(interval: .seconds(Self.timeUpdateInterval), mode: .infinite) { [weak self] _ in
|
||||
guard let self = self, self.model.activeBackend == .mpv else {
|
||||
return
|
||||
@@ -195,10 +196,7 @@ final class MPVBackend: PlayerBackend {
|
||||
}
|
||||
self.updateNetworkState()
|
||||
}
|
||||
}
|
||||
|
||||
deinit {
|
||||
NotificationCenter.default.removeObserver(self, name: .getTimeUpdatesNotification, object: self.currentTime)
|
||||
// swiftlint:enable shorthand_optional_binding
|
||||
}
|
||||
|
||||
typealias AreInIncreasingOrder = (Stream, Stream) -> Bool
|
||||
@@ -443,7 +441,7 @@ final class MPVBackend: PlayerBackend {
|
||||
self.model.updateWatch(time: self.currentTime)
|
||||
}
|
||||
|
||||
NotificationCenter.default.post(name: .getTimeUpdatesNotification, object: self.currentTime)
|
||||
self.model.updateTime(self.currentTime!)
|
||||
}
|
||||
|
||||
private func stopClientUpdates() {
|
||||
|
@@ -154,7 +154,3 @@ extension PlayerBackend {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
extension Notification.Name {
|
||||
static let getTimeUpdatesNotification = Notification.Name("getTimeUpdatesNotification")
|
||||
}
|
||||
|
Reference in New Issue
Block a user