From c1e219e46e6f6847cb26924024a31430ff5b9aed Mon Sep 17 00:00:00 2001 From: Arkadiusz Fal Date: Thu, 6 Jan 2022 15:55:34 +0100 Subject: [PATCH] Fix player controls progress bar --- Model/HistoryModel.swift | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/Model/HistoryModel.swift b/Model/HistoryModel.swift index 5624b91c..680d0d0a 100644 --- a/Model/HistoryModel.swift +++ b/Model/HistoryModel.swift @@ -27,7 +27,9 @@ extension PlayerModel { return } - let time = player.currentTime().seconds + let time = player.currentTime() + let seconds = time.seconds + currentItem.playbackTime = time let watch: Watch! let watchFetchRequest = Watch.fetchRequest() @@ -36,7 +38,7 @@ extension PlayerModel { let results = try? context.fetch(watchFetchRequest) if results?.isEmpty ?? true { - if time < 1 { + if seconds < 1 { return } watch = Watch(context: context) @@ -55,8 +57,8 @@ extension PlayerModel { if finished { watch.stoppedAt = watch.videoDuration - } else if time.isFinite, time > 0 { - watch.stoppedAt = time + } else if seconds.isFinite, seconds > 0 { + watch.stoppedAt = seconds } watch.watchedAt = Date()