Title: [176714] trunk
Revision
176714
Author
[email protected]
Date
2014-12-03 02:09:06 -0800 (Wed, 03 Dec 2014)

Log Message

[Media] Audio content shouldn't have fullscreen buttons, even if in a video element
https://bugs.webkit.org/show_bug.cgi?id=139200
<rdar://problem/18914506>

Reviewed by Eric Carlson.

Source/WebCore:

An audio-only resource, even if loaded into a <video> element, should not
present the fullscreen or optimised fullscreen controls. This includes a
MediaDocument, which is always a <video> element. We can detect this by
examining the length of the videoTracks property as our content loads.

Test: media/audio-as-video-fullscreen.html

* Modules/mediacontrols/mediaControlsApple.js:
(Controller): Initialize a hasVisualMedia to false.
(Controller.prototype.handleReadyStateChange): If we see a videoTrack, hasVisualMedia is now true.
(Controller.prototype.updateFullscreenButtons): Merge the updateFullscreenButton and
updateOptimizedFullscreenButton methods into this single spot, and check for
hasVisualMedia.
(Controller.prototype.updateFullscreenButton): Deleted.
(Controller.prototype.updateOptimizedFullscreenButton): Deleted.

* Modules/mediacontrols/mediaControlsBase.js: Do the same for the other ports.

LayoutTests:

Loads an audio file via the video element and checks if the
fullscreen button is visible.

* media/audio-as-video-fullscreen-expected.txt: Added.
* media/audio-as-video-fullscreen.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (176713 => 176714)


--- trunk/LayoutTests/ChangeLog	2014-12-03 10:08:41 UTC (rev 176713)
+++ trunk/LayoutTests/ChangeLog	2014-12-03 10:09:06 UTC (rev 176714)
@@ -1,3 +1,17 @@
+2014-12-02  Dean Jackson  <[email protected]>
+
+        [Media] Audio content shouldn't have fullscreen buttons, even if in a video element
+        https://bugs.webkit.org/show_bug.cgi?id=139200
+        <rdar://problem/18914506>
+
+        Reviewed by Eric Carlson.
+
+        Loads an audio file via the video element and checks if the
+        fullscreen button is visible.
+
+        * media/audio-as-video-fullscreen-expected.txt: Added.
+        * media/audio-as-video-fullscreen.html: Added.
+
 2014-12-03  Eva Balazsfalvi  <[email protected]>
 
         [EFL] Add subtle crypto to the build system

Added: trunk/LayoutTests/media/audio-as-video-fullscreen-expected.txt (0 => 176714)


--- trunk/LayoutTests/media/audio-as-video-fullscreen-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/media/audio-as-video-fullscreen-expected.txt	2014-12-03 10:09:06 UTC (rev 176714)
@@ -0,0 +1,8 @@
+Tests that an audio file in a video element should not have a fullscreen button
+
+
+** Playing the video **
+RUN(video.play())
+** Testing if the fullscreen button is hidden **
+EXPECTED (fullscreenButton.classList.contains('hidden') == 'true') OK
+
Property changes on: trunk/LayoutTests/media/audio-as-video-fullscreen-expected.txt
___________________________________________________________________

Added: svn:mime-type

Added: svn:keywords

Added: svn:eol-style

Added: trunk/LayoutTests/media/audio-as-video-fullscreen.html (0 => 176714)


--- trunk/LayoutTests/media/audio-as-video-fullscreen.html	                        (rev 0)
+++ trunk/LayoutTests/media/audio-as-video-fullscreen.html	2014-12-03 10:09:06 UTC (rev 176714)
@@ -0,0 +1,37 @@
+<html>
+<head>
+    <title>Test that an audio file in a video element should not have a fullscreen button</title>
+    <script src=""
+    <script src=""
+    <script src=""
+    <script>
+        var video;
+        var panel;
+        var fullscreenButton;
+
+        function init()
+        {
+            video = document.querySelector("video");
+
+            consoleWrite("");
+            consoleWrite("** Playing the video **");
+            run("video.play()");
+        }
+
+        function test()
+        {
+            consoleWrite("** Testing if the fullscreen button is hidden **");
+            if (window.internals) {
+                fullscreenButton = mediaControlsElement(internals.shadowRoot(video).firstChild, "-webkit-media-controls-fullscreen-button");
+                testExpected("fullscreenButton.classList.contains('hidden')", true);
+                testRunner.notifyDone();
+            }
+        }
+
+    </script>
+</head>
+<body _onload_="init()">
+    Tests that an audio file in a video element should not have a fullscreen button<br>
+    <video src="" _onplay_="test()" controls></video>
+</body>
+</html>
Property changes on: trunk/LayoutTests/media/audio-as-video-fullscreen.html
___________________________________________________________________

Added: svn:mime-type

Added: svn:keywords

Added: svn:eol-style

Modified: trunk/Source/WebCore/ChangeLog (176713 => 176714)


--- trunk/Source/WebCore/ChangeLog	2014-12-03 10:08:41 UTC (rev 176713)
+++ trunk/Source/WebCore/ChangeLog	2014-12-03 10:09:06 UTC (rev 176714)
@@ -1,5 +1,31 @@
 2014-12-02  Dean Jackson  <[email protected]>
 
+        [Media] Audio content shouldn't have fullscreen buttons, even if in a video element
+        https://bugs.webkit.org/show_bug.cgi?id=139200
+        <rdar://problem/18914506>
+
+        Reviewed by Eric Carlson.
+
+        An audio-only resource, even if loaded into a <video> element, should not
+        present the fullscreen or optimised fullscreen controls. This includes a
+        MediaDocument, which is always a <video> element. We can detect this by
+        examining the length of the videoTracks property as our content loads.
+
+        Test: media/audio-as-video-fullscreen.html
+
+        * Modules/mediacontrols/mediaControlsApple.js:
+        (Controller): Initialize a hasVisualMedia to false.
+        (Controller.prototype.handleReadyStateChange): If we see a videoTrack, hasVisualMedia is now true.
+        (Controller.prototype.updateFullscreenButtons): Merge the updateFullscreenButton and
+        updateOptimizedFullscreenButton methods into this single spot, and check for
+        hasVisualMedia.
+        (Controller.prototype.updateFullscreenButton): Deleted.
+        (Controller.prototype.updateOptimizedFullscreenButton): Deleted.
+
+        * Modules/mediacontrols/mediaControlsBase.js: Do the same for the other ports.
+
+2014-12-02  Dean Jackson  <[email protected]>
+
         Missing support for innerHTML on SVGElement
         https://bugs.webkit.org/show_bug.cgi?id=136903
 

Modified: trunk/Source/WebCore/Modules/mediacontrols/mediaControlsApple.js (176713 => 176714)


--- trunk/Source/WebCore/Modules/mediacontrols/mediaControlsApple.js	2014-12-03 10:08:41 UTC (rev 176713)
+++ trunk/Source/WebCore/Modules/mediacontrols/mediaControlsApple.js	2014-12-03 10:09:06 UTC (rev 176714)
@@ -12,6 +12,7 @@
     this.listeners = {};
     this.isLive = false;
     this.statusHidden = true;
+    this.hasVisualMedia = false;
 
     this.addVideoListeners();
     this.createBase();
@@ -26,7 +27,7 @@
     this.updateThumbnail();
     this.updateCaptionButton();
     this.updateCaptionContainer();
-    this.updateFullscreenButton();
+    this.updateFullscreenButtons();
     this.updateVolume();
     this.updateHasAudio();
     this.updateHasVideo();
@@ -554,12 +555,12 @@
 
     handleReadyStateChange: function(event)
     {
+        this.hasVisualMedia = this.video.videoTracks && this.video.videoTracks.length > 0;
         this.updateReadyState();
         this.updateDuration();
         this.updateCaptionButton();
         this.updateCaptionContainer();
-        this.updateFullscreenButton();
-        this.updateOptimizedFullscreenButton();
+        this.updateFullscreenButtons();
         this.updateProgress();
     },
 
@@ -860,16 +861,13 @@
         return true;
     },
 
-    updateFullscreenButton: function()
+    updateFullscreenButtons: function()
     {
-        this.controls.fullscreenButton.classList.toggle(this.ClassNames.hidden, !this.video.webkitSupportsFullscreen);
+        var shouldBeHidden = !this.video.webkitSupportsFullscreen || !this.hasVisualMedia;
+        this.controls.fullscreenButton.classList.toggle(this.ClassNames.hidden, shouldBeHidden);
+        this.controls.optimizedFullscreenButton.classList.toggle(this.ClassNames.hidden, shouldBeHidden);
     },
 
-    updateOptimizedFullscreenButton: function()
-    {
-        this.controls.optimizedFullscreenButton.classList.toggle(this.ClassNames.hidden, !this.video.webkitSupportsFullscreen);
-    },
-    
     handleFullscreenButtonClicked: function(event)
     {
         if (this.isFullScreen())

Modified: trunk/Source/WebCore/Modules/mediacontrols/mediaControlsBase.js (176713 => 176714)


--- trunk/Source/WebCore/Modules/mediacontrols/mediaControlsBase.js	2014-12-03 10:08:41 UTC (rev 176713)
+++ trunk/Source/WebCore/Modules/mediacontrols/mediaControlsBase.js	2014-12-03 10:09:06 UTC (rev 176714)
@@ -12,6 +12,7 @@
     this.listeners = {};
     this.isLive = false;
     this.statusHidden = true;
+    this.hasVisualMedia = false;
 
     this.addVideoListeners();
     this.createBase();
@@ -554,6 +555,7 @@
 
     handleReadyStateChange: function(event)
     {
+        this.hasVisualMedia = this.video.videoTracks && this.video.videoTracks.length > 0;
         this.updateReadyState();
         this.updateDuration();
         this.updateCaptionButton();
@@ -836,7 +838,7 @@
 
     updateFullscreenButton: function()
     {
-        this.controls.fullscreenButton.classList.toggle(this.ClassNames.hidden, !this.video.webkitSupportsFullscreen);
+        this.controls.fullscreenButton.classList.toggle(this.ClassNames.hidden, (!this.video.webkitSupportsFullscreen || !this.hasVisualMedia));
     },
 
     handleFullscreenButtonClicked: function(event)
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to