Bug 1474149 - Allow media seek amount so be configured
Satisfied ESLint.
MozReview-Commit-ID: 97wsTqRC26M
--- a/toolkit/content/widgets/videocontrols.xml
+++ b/toolkit/content/widgets/videocontrols.xml
@@ -1481,65 +1481,64 @@
break;
}
if (String.fromCharCode(event.charCode) == " ") {
keystroke += "space";
}
this.log("Got keystroke: " + keystroke);
- let oldval, newval;
try {
switch (keystroke) {
case "space": /* Play */
let target = event.originalTarget;
if (target.localName === "button" && !target.disabled) {
break;
}
this.togglePause();
break;
case "downArrow": /* Volume decrease */
- oldval = this.video.volume;
- this.video.volume = (oldval < 0.1 ? 0 : oldval - 0.1);
+ this.video.volume = this.video.volume < 0.1 ? 0
+ : this.video.volume - 0.1;
this.video.muted = false;
break;
case "upArrow": /* Volume increase */
- oldval = this.video.volume;
- this.video.volume = (oldval > 0.9 ? 1 : oldval + 0.1);
+ this.video.volume = this.video.volume > 0.9 ? 1
+ : this.video.volume + 0.1;
this.video.muted = false;
break;
case "accel-downArrow": /* Mute */
this.video.muted = true;
break;
case "accel-upArrow": /* Unmute */
this.video.muted = false;
break;
- case "leftArrow": /* Seek backward... */
- case "rightArrow": /* ...or forward a fixed amount */
- case "accel-leftArrow": /* Seek backward... */
+ case "leftArrow": /* Seek backward... */
+ case "rightArrow": /* ...or forward a fixed amount */
+ case "accel-leftArrow": /* Seek backward... */
case "accel-rightArrow": { /* ...or forward 10% */
- let maxTime = this.video.duration /*s*/ ||
- this.maxCurrentTimeSeen /*ms*/ / 1000;
+ let maxTime = this.video.duration /* s */ ||
+ this.maxCurrentTimeSeen /* ms */ / 1000;
let seekStepLength = keystroke.startsWith("accel-") ?
maxTime * 0.10
- : this.video.mozSeekStepLength /*s*/;
+ : this.video.mozSeekStepLength /* s */;
this.video.currentTime = keystroke.endsWith("leftArrow") ?
- Math.max(this.video.currentTime - seekStepLength, 0) // <-
- : Math.min(this.video.currentTime + seekStepLength, maxTime) // ->
+ Math.max(this.video.currentTime - seekStepLength, 0) // <-
+ : Math.min(this.video.currentTime + seekStepLength, maxTime); // ->
break;
}
case "home": /* Seek to beginning */
this.video.currentTime = 0;
break;
case "end": /* Seek to end */
- if (this.video.currentTime /*s*/ != this.video.duration /*s*/) {
- this.video.currentTime = this.video.duration /*s*/ ||
- this.maxCurrentTimeSeen /*ms*/ / 1000;
+ if (this.video.currentTime /* s */ != this.video.duration /* s */) {
+ this.video.currentTime = this.video.duration /* s */ ||
+ this.maxCurrentTimeSeen /* ms */ / 1000;
}
break;
default:
return;
}
} catch (e) { /* ignore any exception from setting .currentTime */ }
event.preventDefault(); // Prevent page scrolling