Fix:Mark as not finished when duration is not set in media progress #771

This commit is contained in:
advplyr 2022-06-25 11:01:01 -05:00
parent 59c5e2c1d9
commit 76d668514e
2 changed files with 2 additions and 1 deletions

View File

@ -57,6 +57,7 @@ class MeController {
if (!libraryItem) {
return res.status(404).send('Item not found')
}
var wasUpdated = req.user.createUpdateMediaProgress(libraryItem, req.body)
if (wasUpdated) {
await this.db.updateEntity('user', req.user)

View File

@ -91,7 +91,7 @@ class MediaProgress {
var timeRemaining = this.duration - this.currentTime
// If time remaining is less than 5 seconds then mark as finished
if ((this.progress >= 1 || (!isNaN(timeRemaining) && timeRemaining < 5))) {
if ((this.progress >= 1 || (this.duration && !isNaN(timeRemaining) && timeRemaining < 5))) {
this.isFinished = true
this.finishedAt = Date.now()
this.progress = 1