Bug 1527688 - do not show caption button when there is no rendering area. r=jaws
authoralwu <alwu@mozilla.com>
Thu, 14 Feb 2019 15:30:53 +0000
changeset 459158 b30211be4a04f8fbaace77828a0d9d1e80df2df4
parent 459157 f7ab0e6e739bd54b66b8aaa6219c7dba78f37eb1
child 459159 f2b5a9d987e8ea8a38bebd32f68d5cb04247580f
push id35556
push userdvarga@mozilla.com
push dateFri, 15 Feb 2019 01:38:24 +0000
treeherdermozilla-central@b29c87add05f [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjaws
bugs1527688
milestone67.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1527688 - do not show caption button when there is no rendering area. r=jaws According to the spec 7.1.1, https://www.w3.org/TR/webvtt1/#processing-model "If the media element is an audio element, or is another playback mechanism with no rendering area, abort these steps" Which also means that we should not show the caption button if there is no rendering area. Differential Revision: https://phabricator.services.mozilla.com/D19695
toolkit/content/widgets/videocontrols.js
--- a/toolkit/content/widgets/videocontrols.js
+++ b/toolkit/content/widgets/videocontrols.js
@@ -1554,16 +1554,20 @@ this.VideoControlsImplWidget = class {
                textTrack.kind == "captions";
       },
 
       get isCastingAvailable() {
         return !this.isAudioOnly && this.video.mozAllowCasting;
       },
 
       get isClosedCaptionAvailable() {
+        // There is no rendering area, no need to show the caption.
+        if (!this.video.videoWidth || !this.video.videoHeight) {
+          return false;
+        }
         return this.overlayableTextTracks.length;
       },
 
       get overlayableTextTracks() {
         return Array.prototype.filter.call(this.video.textTracks, this.checkTextTrackSupport);
       },
 
       get currentTextTrackIndex() {