fix nan duration
This commit is contained in:
parent
838f11aa77
commit
edbc474b9a
1 changed files with 2 additions and 0 deletions
|
@ -1028,6 +1028,7 @@ class Player extends Component {
|
||||||
DOM.subtitle.textContent = subtitle(data, {duration:false});
|
DOM.subtitle.textContent = subtitle(data, {duration:false});
|
||||||
|
|
||||||
let duration = Number(data["duration"]);
|
let duration = Number(data["duration"]);
|
||||||
|
duration = Number.isNaN(duration) ? 1 : duration;
|
||||||
DOM.duration.textContent = time(duration);
|
DOM.duration.textContent = time(duration);
|
||||||
DOM.progress.max = duration;
|
DOM.progress.max = duration;
|
||||||
DOM.progress.disabled = false;
|
DOM.progress.disabled = false;
|
||||||
|
@ -1073,6 +1074,7 @@ class Player extends Component {
|
||||||
}
|
}
|
||||||
|
|
||||||
DOM.progress.value = elapsed;
|
DOM.progress.value = elapsed;
|
||||||
|
if (elapsed >= DOM.progress.max) { DOM.progress.max = elapsed; DOM.duration.textContent = time(elapsed); }
|
||||||
DOM.elapsed.textContent = time(elapsed);
|
DOM.elapsed.textContent = time(elapsed);
|
||||||
this._app.style.setProperty("--progress", DOM.progress.value/DOM.progress.max);
|
this._app.style.setProperty("--progress", DOM.progress.value/DOM.progress.max);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue