fix: Negative currentTime after seek back

This commit is contained in:
ronaldheft
2022-09-21 20:16:29 -04:00
parent cdfbbcbf8a
commit 2dbce1e3bb
2 changed files with 9 additions and 1 deletions
@@ -14,7 +14,8 @@ class PlayerTimeUtils {
static func calcSeekBackTime(currentTime: TimeInterval, lastPlayedMs: Double?) -> TimeInterval {
let sinceLastPlayed = timeSinceLastPlayed(lastPlayedMs)
let timeToSeekBack = timeToSeekBackForSinceLastPlayed(sinceLastPlayed)
return currentTime.advanced(by: -timeToSeekBack)
let currentTimeAfterSeekBack = currentTime.advanced(by: -timeToSeekBack)
return max(currentTimeAfterSeekBack, 0)
}
static internal func timeSinceLastPlayed(_ lastPlayedMs: Double?) -> TimeInterval? {