From 6c4acca4d2ad6bba441aa045ca5e01d829fba111 Mon Sep 17 00:00:00 2001 From: lixiangfei Date: Tue, 18 Mar 2025 16:05:29 +0800 Subject: [PATCH] fix(xgplayer): fix percent NaN and fix to currentTime percent --- packages/xgplayer/src/plugins/progress/index.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/packages/xgplayer/src/plugins/progress/index.js b/packages/xgplayer/src/plugins/progress/index.js index 7392fb55..eb8989b0 100644 --- a/packages/xgplayer/src/plugins/progress/index.js +++ b/packages/xgplayer/src/plugins/progress/index.js @@ -620,6 +620,9 @@ class Progress extends Plugin { offset = offset > rWidth ? rWidth : (offset < 0 ? 0 : offset) let percent = offset / rWidth percent = percent < 0 ? 0 : (percent > 1 ? 1 : percent) + if(Number.isNaN(percent)){ + percent = this.player.currentTime / this.offsetDuration + } const currentTime = parseInt(percent * this.offsetDuration * 1000, 10) / 1000 const seekTime = Util.getCurrentTimeByOffset(currentTime, player.timeSegments) return {