Bug 1447544 - Set firstShow to false before the control fades out
The flag is used to trigger play() when the control first hides.
There is no reason to set only after transition ends. We can set it to false
as soon as we trigger play().
This is likely to fix a regression from
bug 1449532 given that we have switched
to Web Animation API there.
MozReview-Commit-ID: F4n3rKdzYKr
--- a/toolkit/content/widgets/videocontrols.xml
+++ b/toolkit/content/widgets/videocontrols.xml
@@ -1946,30 +1946,19 @@
}, aTimeout);
},
hideControls() {
if (!this.Utils.dynamicControls) {
return;
}
this.Utils.startFadeOut(this.Utils.controlBar);
- if (this.firstShow) {
- this.videocontrols.addEventListener("transitionend", this);
- }
},
handleEvent(aEvent) {
- if (aEvent.type == "transitionend") {
- this.firstShow = false;
- try {
- this.videocontrols.removeEventListener("transitionend", this);
- } catch (ex) {}
- return;
- }
-
if (this.videocontrols.randomID != this.Utils.randomID) {
this.terminateEventListeners();
}
},
terminateEventListeners() {
for (var event of this.videoEvents) {
try {
@@ -1997,16 +1986,17 @@
self.delayHideControls(self.controlsTimeout);
});
this.Utils.muteButton.addEventListener("click", function() { self.delayHideControls(self.controlsTimeout); });
this.Utils.controlsSpacer.addEventListener("mouseup", function(event) {
if (event.originalTarget == self.Utils.controlsSpacer) {
if (self.firstShow) {
self.Utils.video.play();
+ self.firstShow = false;
}
self.toggleControls();
}
});
// The first time the controls appear we want to just display
// a play button that does not fade away. The firstShow property
// makes that happen. But because of bug 718107 this init() method