Bug 1367868 - Don't hide media controls when error occurred for audio even if it hasn't been played yet. r=jaws draft
authorRay Lin <ralin@mozilla.com>
Tue, 04 Jul 2017 14:34:13 +0800 (2017-07-04)
changeset 603453 99dcc34e04ef1b77add7bb12349d116a4b6af77d
parent 603394 e6a7a778ba132b87f346a5458b0879c45a3061b7
child 635944 43995bfa37b4e17327b74b78c26a88f1b0da2cef
push id66802
push userbmo:ralin@mozilla.com
push dateTue, 04 Jul 2017 06:43:53 +0000 (2017-07-04)
reviewersjaws
bugs1367868
milestone56.0a1
Bug 1367868 - Don't hide media controls when error occurred for audio even if it hasn't been played yet. r=jaws Unlike video element, audio has no status overlay to inform users if an error occurred. Instead of hiding entire media controls, we should keep it visible in order not confuse users, and see if we can come up with a better approach such as making the buttons disabled afterwards. MozReview-Commit-ID: 8YSCxbWwg2O
toolkit/content/tests/reftests/audio-with-bogus-url-ref.html
toolkit/content/tests/reftests/audio-with-bogus-url.html
toolkit/content/tests/reftests/reftest.list
toolkit/content/widgets/videocontrols.xml
new file mode 100644
--- /dev/null
+++ b/toolkit/content/tests/reftests/audio-with-bogus-url-ref.html
@@ -0,0 +1,15 @@
+<!DOCTYPE html>
+<html>
+<head>
+<style>
+  html, body {
+    margin: 0;
+    padding: 0;
+  }
+</style>
+</head>
+<body>
+  <audio controls></audio>
+</body>
+</html>
+
new file mode 100644
--- /dev/null
+++ b/toolkit/content/tests/reftests/audio-with-bogus-url.html
@@ -0,0 +1,15 @@
+<!DOCTYPE html>
+<html>
+<head>
+<style>
+  html, body {
+    margin: 0;
+    padding: 0;
+  }
+</style>
+</head>
+<body>
+  <audio src="bogus.mp3" controls></audio>
+</body>
+</html>
+
--- a/toolkit/content/tests/reftests/reftest.list
+++ b/toolkit/content/tests/reftests/reftest.list
@@ -1,3 +1,4 @@
 random-if(cocoaWidget||(/^Windows\x20NT\x206\.2/.test(http.oscpu)&&isDebugBuild)) == bug-442419-progressmeter-max.xul bug-442419-progressmeter-max-ref.xul # fails most of the time on Mac because progress meter animates
 != textbox-multiline-default-value.xul textbox-multiline-empty.xul
 fails-if(styloVsGecko) == videocontrols-dynamically-add-cc.html videocontrols-dynamically-add-cc-ref.html
+fails-if(styloVsGecko) == audio-with-bogus-url.html audio-with-bogus-url-ref.html
--- a/toolkit/content/widgets/videocontrols.xml
+++ b/toolkit/content/widgets/videocontrols.xml
@@ -672,17 +672,17 @@
             //    any of the child elements for playback during resource selection.
             if (this.hasError()) {
               this.suppressError = false;
               this.clickToPlay.hidden = true;
               this.statusIcon.setAttribute("type", "error");
               this.updateErrorText();
               this.setupStatusFader(true);
               // If video hasn't shown anything yet, disable the controls.
-              if (!this.firstFrameShown) {
+              if (!this.firstFrameShown && !this.isAudioOnly) {
                 this.startFadeOut(this.controlBar);
               }
               this.controlsSpacer.removeAttribute("hideCursor");
             }
             break;
           case "mozvideoonlyseekbegin":
             this._delayShowThrobberWhileResumingVideoDecoder();
             break;