Improve MPV performance

This commit is contained in:
Arkadiusz Fal
2022-06-16 02:03:15 +02:00
parent 0a797db129
commit e91c7fb2d5
4 changed files with 33 additions and 30 deletions

View File

@@ -273,9 +273,17 @@ final class MPVBackend: PlayerBackend {
func updateControls() {
DispatchQueue.main.async { [weak self] in
self?.logger.info("updating controls")
self?.controls.currentTime = self?.currentTime ?? .zero
self?.controls.duration = self?.playerItemDuration ?? .zero
guard let self = self else {
return
}
guard self.controls.player.presentingPlayer else {
return
}
self.logger.info("updating controls")
self.controls.currentTime = self.currentTime ?? .zero
self.controls.duration = self.playerItemDuration ?? .zero
}
}
@@ -296,8 +304,6 @@ final class MPVBackend: PlayerBackend {
private var handleSegmentsThrottle = Throttle(interval: 1)
private func getClientUpdates() {
self.logger.info("getting client updates")
currentTime = client?.currentTime
playerItemDuration = client?.duration