Skip to content

Commit

Permalink
feat(xgplayer): format offsetCurrentTime 和 offsetDuration
Browse files Browse the repository at this point in the history
  • Loading branch information
hongqx committed Jul 30, 2024
1 parent 50db39d commit 308b19d
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions packages/xgplayer/src/player.js
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,7 @@ class Player extends MediaProxy {
*/
this._offsetInfo = {
currentTime: -1,
duration: 0
duration: -1
}

/**
Expand Down Expand Up @@ -2583,15 +2583,15 @@ class Player extends MediaProxy {
}

get offsetCurrentTime () {
return this._offsetInfo.currentTime || 0
return this._offsetInfo.currentTime > -1 ? this._offsetInfo.currentTime : this.currentTime
}

set offsetCurrentTime (val) {
this._offsetInfo.currentTime = val
}

get offsetDuration () {
return this._offsetInfo.duration || 0
return this._offsetInfo.duration > -1 ? this._offsetInfo.duration : this.duration
}

set offsetDuration (val) {
Expand Down
2 changes: 1 addition & 1 deletion packages/xgplayer/src/plugins/time/timesegments.js
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 308b19d

Please sign in to comment.