Merge pull request #1335 from DusuWen/master

This commit is contained in:
DIYgod 2023-08-13 17:51:20 +01:00 committed by GitHub
commit b0ba40b90e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 3 deletions

View File

@ -122,11 +122,11 @@ class Controller {
percentage = Math.min(percentage, 1);
this.player.bar.set('played', percentage, 'width');
this.player.seek(this.player.bar.get('played') * this.player.video.duration);
this.player.timer.enable('progress');
this.player.moveBar = false;
};
this.player.template.playedBarWrap.addEventListener(utils.nameMap.dragStart, () => {
this.player.timer.disable('progress');
this.player.moveBar = true;
document.addEventListener(utils.nameMap.dragMove, thumbMove);
document.addEventListener(utils.nameMap.dragEnd, thumbUp);
});

View File

@ -182,6 +182,8 @@ class DPlayer {
this.play();
}
this.moveBar = false;
index++;
instances.push(this);
}
@ -537,7 +539,9 @@ class DPlayer {
});
this.on('timeupdate', () => {
this.bar.set('played', this.video.currentTime / this.video.duration, 'width');
if (!this.moveBar) {
this.bar.set('played', this.video.currentTime / this.video.duration, 'width');
}
const currentTime = utils.secondToTime(this.video.currentTime);
if (this.template.ptime.innerHTML !== currentTime) {
this.template.ptime.innerHTML = currentTime;