From edbc474b9aa8940b15d089bed9d976a11cb58898 Mon Sep 17 00:00:00 2001 From: Jerry Date: Sun, 10 Jul 2022 00:31:32 +0800 Subject: [PATCH] fix nan duration --- app/cyp.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/app/cyp.js b/app/cyp.js index 821f9e4..2ecf006 100644 --- a/app/cyp.js +++ b/app/cyp.js @@ -1028,6 +1028,7 @@ class Player extends Component { DOM.subtitle.textContent = subtitle(data, {duration:false}); let duration = Number(data["duration"]); + duration = Number.isNaN(duration) ? 1 : duration; DOM.duration.textContent = time(duration); DOM.progress.max = duration; DOM.progress.disabled = false; @@ -1073,6 +1074,7 @@ class Player extends Component { } DOM.progress.value = elapsed; + if (elapsed >= DOM.progress.max) { DOM.progress.max = elapsed; DOM.duration.textContent = time(elapsed); } DOM.elapsed.textContent = time(elapsed); this._app.style.setProperty("--progress", DOM.progress.value/DOM.progress.max); }