From 308b19d781c0283236f8efbb58d730d38db0689a Mon Sep 17 00:00:00 2001 From: hongqiongxing Date: Tue, 30 Jul 2024 21:15:46 +0800 Subject: [PATCH] =?UTF-8?q?feat(xgplayer):=20format=20offsetCurrentTime=20?= =?UTF-8?q?=E5=92=8C=20offsetDuration?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/xgplayer/src/player.js | 6 +++--- packages/xgplayer/src/plugins/time/timesegments.js | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/packages/xgplayer/src/player.js b/packages/xgplayer/src/player.js index 422c87e56..8da69676a 100644 --- a/packages/xgplayer/src/player.js +++ b/packages/xgplayer/src/player.js @@ -274,7 +274,7 @@ class Player extends MediaProxy { */ this._offsetInfo = { currentTime: -1, - duration: 0 + duration: -1 } /** @@ -2583,7 +2583,7 @@ class Player extends MediaProxy { } get offsetCurrentTime () { - return this._offsetInfo.currentTime || 0 + return this._offsetInfo.currentTime > -1 ? this._offsetInfo.currentTime : this.currentTime } set offsetCurrentTime (val) { @@ -2591,7 +2591,7 @@ class Player extends MediaProxy { } get offsetDuration () { - return this._offsetInfo.duration || 0 + return this._offsetInfo.duration > -1 ? this._offsetInfo.duration : this.duration } set offsetDuration (val) { diff --git a/packages/xgplayer/src/plugins/time/timesegments.js b/packages/xgplayer/src/plugins/time/timesegments.js index f9fd6a308..dca3f97b6 100644 --- a/packages/xgplayer/src/plugins/time/timesegments.js +++ b/packages/xgplayer/src/plugins/time/timesegments.js @@ -50,7 +50,7 @@ export default class TimeSegmentsControls extends BasePlugin { const { player } = this if (disable || !segments || segments.length === 0) { player.timeSegments = [] - player.offsetDuration = 0 + player.offsetDuration = -1 player.offsetCurrentTime = -1 } else { const _segs = this.formatTimeSegments(segments, player.duration)