Bug 1352724 - Pause video at the point when scrubber is being click. r=jaws

MozReview-Commit-ID: 5JuDivYzhoJ

--HG--
extra : rebase_source : 81bca14502cc16beb240ca5f42096f8453bd37c8
This commit is contained in:
Ray Lin 2017-04-26 17:09:12 +08:00
Родитель acf3581ced
Коммит 483a0b8c19
2 изменённых файлов: 35 добавлений и 14 удалений

Просмотреть файл

@ -389,10 +389,39 @@ function runTest(event) {
is(event.type, "pause", "checking event type");
SimpleTest.executeSoon(() => {
SimpleTest.finish();
synthesizeMouse(video, playButtonCenterX, playButtonCenterY, { });
});
break;
case 29:
is(event.type, "play", "checking event type");
SimpleTest.executeSoon(() => {
// Bug 1352724: Click and hold on timeline should pause video immediately.
synthesizeMouse(video, scrubberOffsetX + 10, scrubberCenterY, { type: "mousedown", button: 0 });
});
break;
case 30:
is(event.type, "pause", "checking event type");
break;
case 31:
is(event.type, "seeking", "checking event type");
ok(true, "video position is at " + video.currentTime);
break;
case 32:
is(event.type, "seeked", "checking event type");
ok(true, "video position is at " + video.currentTime);
synthesizeMouse(video, scrubberOffsetX + 10, scrubberCenterY, {});
break;
case 33:
is(event.type, "play", "checking event type");
ok(true, "video resume after mouseup");
SimpleTest.finish();
break;
default:

Просмотреть файл

@ -655,7 +655,7 @@
// If the user is dragging the scrubber ignore the delayed seek
// responses (don't yank the thumb away from the user)
if (this.scrubber.isDragging || this.scrubber.startToDrag) {
if (this.scrubber.isDragging) {
return;
}
this.showPosition(currentTime, duration);
@ -899,16 +899,14 @@
const duration = Math.round(this.video.duration * 1000); // in ms
let time = this.scrubber.value;
if (!this.scrubber.startToDrag || this.scrubber.isDragging) {
this.seekToPosition(time);
this.showPosition(time, duration);
}
this.seekToPosition(time);
this.showPosition(time, duration);
this.scrubber.startToDrag = true;
this.scrubber.isDragging = true;
this.pauseVideoDuringDragging();
},
onScrubberChange(e) {
this.scrubber.startToDrag = false;
this.scrubber.isDragging = false;
if (this.isPausedByDragging) {
@ -1033,12 +1031,6 @@
},
HIDE_CONTROLS_TIMEOUT_MS: 2000,
onMouseMove(event) {
// Pause playing video when the mouse is dragging over the control bar.
if (this.scrubber.startToDrag) {
this.scrubber.isDragging = true;
this.pauseVideoDuringDragging();
}
// If the controls are static, don't change anything.
if (!this.dynamicControls) {
return;