зеркало из https://github.com/mozilla/gecko-dev.git
Back out fcad61fcaf73 (bug 726191) for test_videocontrols.html bustage
This commit is contained in:
Родитель
9fb4899266
Коммит
73afd44bef
|
@ -411,8 +411,6 @@
|
||||||
this.maxCurrentTimeSeen = currentTime;
|
this.maxCurrentTimeSeen = currentTime;
|
||||||
this.showPosition(currentTime, duration);
|
this.showPosition(currentTime, duration);
|
||||||
|
|
||||||
this.controlListeners = [];
|
|
||||||
|
|
||||||
// If we have metadata, check if this is a <video> without
|
// If we have metadata, check if this is a <video> without
|
||||||
// video data, or a video with no audio track.
|
// video data, or a video with no audio track.
|
||||||
if (this.video.readyState >= this.video.HAVE_METADATA) {
|
if (this.video.readyState >= this.video.HAVE_METADATA) {
|
||||||
|
@ -424,7 +422,8 @@
|
||||||
// because of bug 718107: switching to fullscreen may
|
// because of bug 718107: switching to fullscreen may
|
||||||
// cause the bindings to detach and reattach, hence
|
// cause the bindings to detach and reattach, hence
|
||||||
// unsetting the attribute.
|
// unsetting the attribute.
|
||||||
this.initVolumeControlListeners();
|
if (!this.isAudioOnly && !this.video.mozHasAudio)
|
||||||
|
this.muteButton.setAttribute("noAudio", "true");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.isAudioOnly)
|
if (this.isAudioOnly)
|
||||||
|
@ -543,7 +542,9 @@
|
||||||
this.startFadeIn(this.controlBar);
|
this.startFadeIn(this.controlBar);
|
||||||
}
|
}
|
||||||
this.showDuration(Math.round(this.video.duration * 1000));
|
this.showDuration(Math.round(this.video.duration * 1000));
|
||||||
this.initVolumeControlListeners();
|
if (!this.isAudioOnly && !this.video.mozHasAudio) {
|
||||||
|
this.muteButton.setAttribute("noAudio", "true");
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case "loadeddata":
|
case "loadeddata":
|
||||||
this.firstFrameShown = true;
|
this.firstFrameShown = true;
|
||||||
|
@ -641,29 +642,6 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
// Helper function to add an event listener to the given element.
|
|
||||||
addListener: function (elem, eventName, func) {
|
|
||||||
let boundFunc = func.bind(this);
|
|
||||||
this.controlListeners.push({ item: elem, event: eventName, func: boundFunc });
|
|
||||||
elem.addEventListener(eventName, boundFunc, false);
|
|
||||||
},
|
|
||||||
|
|
||||||
initVolumeControlListeners : function () {
|
|
||||||
if (this.isAudioOnly) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (!this.video.mozHasAudio) {
|
|
||||||
this.muteButton.setAttribute("noAudio", "true");
|
|
||||||
this.muteButton.setAttribute("disabled", "true");
|
|
||||||
} else {
|
|
||||||
this.addListener(this.muteButton, "mouseover", this.onVolumeMouseInOut);
|
|
||||||
this.addListener(this.muteButton, "mouseout", this.onVolumeMouseInOut);
|
|
||||||
this.addListener(this.volumeStack, "mouseover", this.onVolumeMouseInOut);
|
|
||||||
this.addListener(this.volumeStack, "mouseout", this.onVolumeMouseInOut);
|
|
||||||
this.addListener(this.muteButton, "command", this.toggleMute);
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
terminateEventListeners : function () {
|
terminateEventListeners : function () {
|
||||||
if (this.statsInterval) {
|
if (this.statsInterval) {
|
||||||
clearInterval(this.statsInterval);
|
clearInterval(this.statsInterval);
|
||||||
|
@ -1404,18 +1382,37 @@
|
||||||
for each (let event in this.videoEvents)
|
for each (let event in this.videoEvents)
|
||||||
this.video.addEventListener(event, this, (event == "error") ? true : false);
|
this.video.addEventListener(event, this, (event == "error") ? true : false);
|
||||||
|
|
||||||
this.addListener(this.playButton, "command", this.togglePause);
|
var self = this;
|
||||||
this.addListener(this.fullscreenButton, "command", this.toggleFullscreen);
|
|
||||||
this.addListener(this.clickToPlay, "click", this.clickToPlayClickHandler);
|
|
||||||
this.addListener(this.controlsSpacer, "click", this.clickToPlayClickHandler);
|
|
||||||
|
|
||||||
this.addListener(this.videocontrols, "transitionend", this.onTransitionEnd);
|
this.controlListeners = [];
|
||||||
this.addListener(this.video.ownerDocument, "mozfullscreenchange", this.setFullscreenButtonState);
|
|
||||||
|
// Helper function to add an event listener to the given element
|
||||||
|
function addListener(elem, eventName, func) {
|
||||||
|
let boundFunc = func.bind(self);
|
||||||
|
self.controlListeners.push({ item: elem, event: eventName, func: boundFunc });
|
||||||
|
elem.addEventListener(eventName, boundFunc, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
addListener(this.muteButton, "command", this.toggleMute);
|
||||||
|
addListener(this.playButton, "command", this.togglePause);
|
||||||
|
addListener(this.fullscreenButton, "command", this.toggleFullscreen);
|
||||||
|
addListener(this.clickToPlay, "click", this.clickToPlayClickHandler);
|
||||||
|
addListener(this.controlsSpacer, "click", this.clickToPlayClickHandler);
|
||||||
|
|
||||||
|
if (!this.isAudioOnly && this.video.mozHasAudio) {
|
||||||
|
addListener(this.muteButton, "mouseover", this.onVolumeMouseInOut);
|
||||||
|
addListener(this.muteButton, "mouseout", this.onVolumeMouseInOut);
|
||||||
|
addListener(this.volumeStack, "mouseover", this.onVolumeMouseInOut);
|
||||||
|
addListener(this.volumeStack, "mouseout", this.onVolumeMouseInOut);
|
||||||
|
}
|
||||||
|
|
||||||
|
addListener(this.videocontrols, "transitionend", this.onTransitionEnd);
|
||||||
|
addListener(this.video.ownerDocument, "mozfullscreenchange", this.setFullscreenButtonState);
|
||||||
|
|
||||||
// Make the <video> element keyboard accessible.
|
// Make the <video> element keyboard accessible.
|
||||||
this.video.setAttribute("tabindex", 0);
|
this.video.setAttribute("tabindex", 0);
|
||||||
|
|
||||||
this.addListener(this.video, "keypress", this.keyHandler);
|
addListener(this.video, "keypress", this.keyHandler);
|
||||||
|
|
||||||
this.log("--- videocontrols initialized ---");
|
this.log("--- videocontrols initialized ---");
|
||||||
}
|
}
|
||||||
|
|
Загрузка…
Ссылка в новой задаче