mirror of
https://github.com/videojs/video.js.git
synced 2024-12-14 11:23:30 +02:00
fix(seeking): don't always pause in mouse down (#3886)
In chrome 55, something changed which introduced a bug in videojs where if you seeked back, it wouldn't work. This is because we always paused the video in the mousedown handler. Instead, we should create a timer for pausing that is cleared in the mouseup handler or in the mouse move handler. This is so that if someone is seeking by clicking and waiting the video pauses. As soon as we start moving and we get a mousemove event, we can know that it's safe to pause as well. Fixes #3839.
This commit is contained in:
parent
22cf3dd935
commit
e92db4f407
@ -127,7 +127,10 @@ class SeekBar extends Slider {
|
|||||||
this.player_.scrubbing(true);
|
this.player_.scrubbing(true);
|
||||||
|
|
||||||
this.videoWasPlaying = !this.player_.paused();
|
this.videoWasPlaying = !this.player_.paused();
|
||||||
|
|
||||||
|
this.pauseTimer_ = this.setTimeout(function() {
|
||||||
this.player_.pause();
|
this.player_.pause();
|
||||||
|
}, 100);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -148,6 +151,11 @@ class SeekBar extends Slider {
|
|||||||
|
|
||||||
// Set new time (tell player to seek to new time)
|
// Set new time (tell player to seek to new time)
|
||||||
this.player_.currentTime(newTime);
|
this.player_.currentTime(newTime);
|
||||||
|
|
||||||
|
if (event.type === 'mousemove') {
|
||||||
|
this.clearTimeout(this.pauseTimer_);
|
||||||
|
this.player_.pause();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -161,6 +169,8 @@ class SeekBar extends Slider {
|
|||||||
handleMouseUp(event) {
|
handleMouseUp(event) {
|
||||||
super.handleMouseUp(event);
|
super.handleMouseUp(event);
|
||||||
|
|
||||||
|
this.clearTimeout(this.pauseTimer_);
|
||||||
|
|
||||||
this.player_.scrubbing(false);
|
this.player_.scrubbing(false);
|
||||||
if (this.videoWasPlaying) {
|
if (this.videoWasPlaying) {
|
||||||
this.player_.play();
|
this.player_.play();
|
||||||
|
Loading…
Reference in New Issue
Block a user