From 6ce9ed3063e1a1afba22a35bc9fa30119786ec12 Mon Sep 17 00:00:00 2001 From: Arkadiusz Fal Date: Thu, 21 Jul 2022 22:58:32 +0200 Subject: [PATCH] Fix replaying item --- Model/Player/PlayerQueue.swift | 6 ++++-- Model/Player/PlayerQueueItem.swift | 2 +- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/Model/Player/PlayerQueue.swift b/Model/Player/PlayerQueue.swift index 70e063ef..e0ccfff4 100644 --- a/Model/Player/PlayerQueue.swift +++ b/Model/Player/PlayerQueue.swift @@ -119,9 +119,11 @@ extension PlayerModel { remove(newItem) currentItem = newItem + currentItem.playbackTime = time - accounts.api.loadDetails(newItem, failureHandler: videoLoadFailureHandler) { newItem in - self.playItem(newItem, at: time) + let playTime = currentItem.shouldRestartPlaying ? CMTime.zero : time + accounts.api.loadDetails(currentItem, failureHandler: videoLoadFailureHandler) { newItem in + self.playItem(newItem, at: playTime) } } diff --git a/Model/Player/PlayerQueueItem.swift b/Model/Player/PlayerQueueItem.swift index cfa18c7c..097ff5c2 100644 --- a/Model/Player/PlayerQueueItem.swift +++ b/Model/Player/PlayerQueueItem.swift @@ -36,7 +36,7 @@ struct PlayerQueueItem: Hashable, Identifiable, Defaults.Serializable { return false } - return duration - seconds <= 10 + return duration - seconds <= 20 } var hasDetailsLoaded: Bool {