Bug 749520 - Use new mozHasAudio API to let users know that the video being watched does not have an audio track r=jaws
authorPaul Adenot <paul@paul.cx>
Mon, 04 Jun 2012 16:49:57 -0700
changeset 95809 730209ed620b
parent 95808 05e95c78c017
child 95810 ae07e747d7f1
push id22851
push usergeoff@darktrojan.net
push date2012-06-05 12:52 +0000
treeherdermozilla-central@c76497029f0d [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjaws
bugs749520
milestone15.0a1
Bug 749520 - Use new mozHasAudio API to let users know that the video being watched does not have an audio track r=jaws
toolkit/content/widgets/videocontrols.xml
toolkit/themes/pinstripe/global/jar.mn
toolkit/themes/pinstripe/global/media/noAudio.png
toolkit/themes/pinstripe/global/media/videocontrols.css
toolkit/themes/winstripe/global/jar.mn
toolkit/themes/winstripe/global/media/noAudio.png
toolkit/themes/winstripe/global/media/videocontrols.css
--- a/toolkit/content/widgets/videocontrols.xml
+++ b/toolkit/content/widgets/videocontrols.xml
@@ -529,16 +529,19 @@
                             // and show the controls (they won't fade back out)
                             if (this.video instanceof HTMLVideoElement &&
                                 (this.video.videoWidth == 0 || this.video.videoHeight == 0)) {
                                 this.isAudioOnly = true;
                                 this.clickToPlay.hidden = true;
                                 this.startFadeIn(this.controlBar);
                             }
                             this.showDuration(Math.round(this.video.duration * 1000));
+                            if (!this.isAudioOnly && !this.video.mozHasAudio) {
+                              this.muteButton.setAttribute("noAudio", "true");
+                            }
                             break;
                         case "loadeddata":
                             this.firstFrameShown = true;
                             this.setupStatusFader();
                             break;
                         case "loadstart":
                             this.maxCurrentTimeSeen = 0;
                             this.controlsSpacer.removeAttribute("aria-label");
@@ -1383,17 +1386,17 @@
                     }
 
                     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) {
+                    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);
--- a/toolkit/themes/pinstripe/global/jar.mn
+++ b/toolkit/themes/pinstripe/global/jar.mn
@@ -141,16 +141,17 @@ toolkit.jar:
   skin/classic/global/notification/info-icon.png                     (notification/info-icon.png)
   skin/classic/global/notification/warning-bar-background.png        (notification/warning-bar-background.png)
   skin/classic/global/notification/warning-icon.png                  (notification/warning-icon.png)
   skin/classic/global/media/videocontrols.css                        (media/videocontrols.css)
   skin/classic/global/media/pauseButton.png                          (media/pauseButton.png)
   skin/classic/global/media/playButton.png                           (media/playButton.png)
   skin/classic/global/media/muteButton.png                           (media/muteButton.png)
   skin/classic/global/media/unmuteButton.png                         (media/unmuteButton.png)
+  skin/classic/global/media/noAudio.png                              (media/noAudio.png)
   skin/classic/global/media/fullscreenButton.png                     (media/fullscreenButton.png)
   skin/classic/global/media/scrubberThumb.png                        (media/scrubberThumb.png)
   skin/classic/global/media/scrubberThumbWide.png                    (media/scrubberThumbWide.png)
   skin/classic/global/media/error.png                                (media/error.png)
   skin/classic/global/media/throbber.png                             (media/throbber.png)
   skin/classic/global/media/stalled.png                              (media/stalled.png)
   skin/classic/global/media/volumeThumb.png                          (media/volumeThumb.png)
   skin/classic/global/media/clicktoplay-bgtexture.png                (media/clicktoplay-bgtexture.png)
new file mode 100644
index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..3db8c973b6594cb8820661564eb8dacb673c09b9
GIT binary patch
literal 930
zc$@*E16}-yP)<h;3K|Lk000e1NJLTq001EX000~a1ONa4MF}34000ANNkl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JaPw-diriaRTh#@!g_9H-gPPcy%gxGwV_BsrRy;;LWR3=0UL0PW?`RZB6tf
zWG5VkesGZY(^n_0=-;M+7Dh+yW1zllrr*ZOBlut0a}?V-%PVhp)&Kwi07*qoM6N<$
Ef)`c7YybcN
--- a/toolkit/themes/pinstripe/global/media/videocontrols.css
+++ b/toolkit/themes/pinstripe/global/media/videocontrols.css
@@ -33,16 +33,20 @@
   padding: 0;
   min-height: 28px;
   min-width: 33px;
 }
 .muteButton[muted] {
   background: url(chrome://global/skin/media/unmuteButton.png) no-repeat center;
 }
 
+.muteButton[noAudio] {
+  background: url(chrome://global/skin/media/noAudio.png) no-repeat center;
+}
+
 .fullscreenButton {
   background: -moz-image-rect(url("chrome://global/skin/media/fullscreenButton.png"), 0, 16, 16, 0) no-repeat center;
   -moz-appearance: none;
   margin: 0;
   padding: 0;
   min-height: 28px;
   min-width: 28px;
   border: none;
--- a/toolkit/themes/winstripe/global/jar.mn
+++ b/toolkit/themes/winstripe/global/jar.mn
@@ -145,16 +145,17 @@ toolkit.jar:
         skin/classic/global/icons/windowControls.png             (icons/windowControls.png)
         skin/classic/global/icons/wrap.png                       (icons/wrap.png)
         skin/classic/global/inContentUI/background-texture.png  (inContentUI/background-texture.png)
         skin/classic/global/media/videocontrols.css              (media/videocontrols.css)
         skin/classic/global/media/pauseButton.png                (media/pauseButton.png)
         skin/classic/global/media/playButton.png                 (media/playButton.png)
         skin/classic/global/media/muteButton.png                 (media/muteButton.png)
         skin/classic/global/media/unmuteButton.png               (media/unmuteButton.png)
+        skin/classic/global/media/noAudio.png                    (media/noAudio.png)
         skin/classic/global/media/fullscreenButton.png           (media/fullscreenButton.png)
         skin/classic/global/media/scrubberThumb.png              (media/scrubberThumb.png)
         skin/classic/global/media/scrubberThumbWide.png          (media/scrubberThumbWide.png)
         skin/classic/global/media/throbber.png                   (media/throbber.png)
         skin/classic/global/media/stalled.png                    (media/stalled.png)
         skin/classic/global/media/volumeThumb.png                (media/volumeThumb.png)
         skin/classic/global/media/error.png                      (media/error.png)
         skin/classic/global/media/clicktoplay-bgtexture.png      (media/clicktoplay-bgtexture.png)
@@ -321,16 +322,17 @@ toolkit.jar:
         skin/classic/aero/global/icons/windowControls.png                (icons/windowControls-aero.png)
         skin/classic/aero/global/icons/wrap.png                          (icons/wrap-aero.png)
         skin/classic/aero/global/inContentUI/background-texture.png     (inContentUI/background-texture.png)
         skin/classic/aero/global/media/videocontrols.css                 (media/videocontrols.css)
         skin/classic/aero/global/media/pauseButton.png                   (media/pauseButton.png)
         skin/classic/aero/global/media/playButton.png                    (media/playButton.png)
         skin/classic/aero/global/media/muteButton.png                    (media/muteButton.png)
         skin/classic/aero/global/media/unmuteButton.png                  (media/unmuteButton.png)
+        skin/classic/aero/global/media/noAudio.png                       (media/noAudio.png)
         skin/classic/aero/global/media/fullscreenButton.png              (media/fullscreenButton.png)
         skin/classic/aero/global/media/scrubberThumb.png                 (media/scrubberThumb.png)
         skin/classic/aero/global/media/scrubberThumbWide.png             (media/scrubberThumbWide.png)
         skin/classic/aero/global/media/throbber.png                      (media/throbber.png)
         skin/classic/aero/global/media/stalled.png                       (media/stalled.png)
         skin/classic/aero/global/media/volumeThumb.png                   (media/volumeThumb.png)
         skin/classic/aero/global/media/error.png                         (media/error.png)
         skin/classic/aero/global/media/clicktoplay-bgtexture.png         (media/clicktoplay-bgtexture.png)
new file mode 100644
index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..3db8c973b6594cb8820661564eb8dacb673c09b9
GIT binary patch
literal 930
zc$@*E16}-yP)<h;3K|Lk000e1NJLTq001EX000~a1ONa4MF}34000ANNkl<ZILqCX
z?@v=_6vqz%v=&iHOG-DP0(OCJD#{=Q1&xu!IO0M`VQ8~WGmX(8lMX7gI4G@GdV5>i
zTie@T^vAvTINcVvw|ljB+x~;SAWP<p=kM^eh(D5BaWD2}=OoR|^Ynb4bH2|x55WK3
zeETwE#k-1xsLFDzcsDcV+xIWRuj{f-bpyYD)76cvb9T?W#Mkf^S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css
@@ -35,16 +35,20 @@
   min-height: 28px;
   min-width: 33px;
   border: none;
 }
 .muteButton[muted] {
   background: url(chrome://global/skin/media/unmuteButton.png) no-repeat center;
 }
 
+.muteButton[noAudio] {
+  background: url(chrome://global/skin/media/noAudio.png) no-repeat center;
+}
+
 .fullscreenButton {
   background: -moz-image-rect(url("chrome://global/skin/media/fullscreenButton.png"), 0, 16, 16, 0) no-repeat center;
   -moz-appearance: none;
   margin: 0;
   padding: 0;
   min-height: 28px;
   min-width: 28px;
   border: none;