Bug 448909 - Need more controls WHATWG Video tag (followup patch). r=mconnor

This commit is contained in:
Justin Dolske 2008-10-29 00:35:49 -07:00
parent a61e3edeee
commit 3799b16701

View File

@ -14,15 +14,13 @@
<xbl:content xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
<spacer flex="1"/>
<stack xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
<hbox id="controlsBackground">
<image id="playButton"
onclick="this.parentNode.parentNode.parentNode.Utils.togglePause();"/>
<box id="controlsMiddle" flex="1"/>
<image id="muteButton"
onclick="this.parentNode.parentNode.parentNode.Utils.toggleMute();"/>
</hbox>
</stack>
<hbox id="controlsBackground">
<image id="playButton"
onclick="if (event.button == 0) this.parentNode.parentNode.Utils.togglePause();"/>
<box id="controlsMiddle" flex="1"/>
<image id="muteButton"
onclick="if (event.button == 0) this.parentNode.parentNode.Utils.toggleMute();"/>
</hbox>
</xbl:content>
<implementation implements="nsISecurityCheckedComponent">
@ -88,7 +86,7 @@
animationDirection : 1,
animationTimer : null,
onMediaEvent : function (aEvent) {
handleEvent : function (aEvent) {
this.log("Got " + aEvent.type + " media event");
switch (aEvent.type) {
case "play":
@ -103,8 +101,6 @@
default:
this.log("!!! event " + aEvent.type + " not handled!");
}
return false;
},
fadeControls : function (self) {
@ -163,26 +159,22 @@
<method name="init">
<body>
<![CDATA[
var self = this;
var video = this.parentNode;
this.Utils.video = video;
this.Utils.controls = self;
this.Utils.controls = this;
this.Utils.playButton = document.getAnonymousElementByAttribute(self, "id", "playButton");
this.Utils.muteButton = document.getAnonymousElementByAttribute(self, "id", "muteButton");
this.Utils.playButton = document.getAnonymousElementByAttribute(this, "id", "playButton");
this.Utils.muteButton = document.getAnonymousElementByAttribute(this, "id", "muteButton");
// Set initial state of play/pause button.
this.Utils.playButton.setAttribute("paused", video.paused);
function eventBouncer(aEvent) {
self.Utils.onMediaEvent(aEvent);
}
this.style.opacity = 0;
video.addEventListener("play", eventBouncer, false);
video.addEventListener("pause", eventBouncer, false);
video.addEventListener("volumechange", eventBouncer, false);
// Use Utils.handleEvent() callback for all media events.
video.addEventListener("play", this.Utils, false);
video.addEventListener("pause", this.Utils, false);
video.addEventListener("volumechange", this.Utils, false);
this.Utils.log("--- videocontrols initialized ---");
]]>