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)