Playback controls should not hide while AirPlay is active
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 12 Jul 2017 18:19:28 +0000 (18:19 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 12 Jul 2017 18:19:28 +0000 (18:19 +0000)
https://bugs.webkit.org/show_bug.cgi?id=174422
<rdar://problem/33011477>

Patch by Antoine Quint <graouts@apple.com> on 2017-07-12
Reviewed by Eric Carlson.

Source/WebCore:

We now also track changes in AirPlay playback status and account for it when identifying whether we
ought to let media controls automatically hide, which should only happen if the media is playing and
not playing back through AirPlay.

* Modules/modern-media-controls/media/controls-visibility-support.js:
(ControlsVisibilitySupport.prototype.get mediaEvents):
(ControlsVisibilitySupport.prototype._updateControls):
(ControlsVisibilitySupport):

LayoutTests:

Expand the existing AirPlaySupport test to check that when we enter AirPlay we correctly prevent
the media controls from automatically hiding.

* media/modern-media-controls/airplay-support/airplay-support-expected.txt:
* media/modern-media-controls/airplay-support/airplay-support.html:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@219412 268f45cc-cd09-0410-ab3c-d52691b4dbfc

LayoutTests/ChangeLog
LayoutTests/media/modern-media-controls/airplay-support/airplay-support-expected.txt
LayoutTests/media/modern-media-controls/airplay-support/airplay-support.html
Source/WebCore/ChangeLog
Source/WebCore/Modules/modern-media-controls/media/controls-visibility-support.js

index 3ec73bd..4e913f2 100644 (file)
@@ -1,3 +1,17 @@
+2017-07-12  Antoine Quint  <graouts@apple.com>
+
+        Playback controls should not hide while AirPlay is active
+        https://bugs.webkit.org/show_bug.cgi?id=174422
+        <rdar://problem/33011477>
+
+        Reviewed by Eric Carlson.
+
+        Expand the existing AirPlaySupport test to check that when we enter AirPlay we correctly prevent
+        the media controls from automatically hiding.
+
+        * media/modern-media-controls/airplay-support/airplay-support-expected.txt:
+        * media/modern-media-controls/airplay-support/airplay-support.html:
+
 2017-07-12  Nan Wang  <n_wang@apple.com>
 
         AX: [iOS] Implement a way to retrieve a text marker range with desired text that is closest to a position
index 1643491..33627f4 100644 (file)
@@ -7,11 +7,13 @@ Making AirPlay routes available.
 PASS mediaController.controls.airplayButton.enabled is true
 PASS mediaController.controls.airplayButton.on is false
 PASS mediaController.controls.muteButton.enabled is true
+PASS mediaController.controls.autoHideController.fadesWhileIdle is true
 
 Entering AirPlay playback mode.
 PASS mediaController.controls.airplayButton.enabled is true
 PASS mediaController.controls.airplayButton.on is true
 PASS mediaController.controls.muteButton.enabled is false
+PASS mediaController.controls.autoHideController.fadesWhileIdle is false
 
 PASS successfullyParsed is true
 
index 708ca4b..e29071b 100644 (file)
@@ -1,7 +1,7 @@
 <script src="../../../resources/js-test-pre.js"></script>
 <script src="../resources/media-controls-loader.js" type="text/javascript"></script>
 <body>
-<video src="../../content/test.mp4" style="width: 320px; height: 240px;"></video>
+<video src="../../content/test.mp4" style="width: 320px; height: 240px;" autoplay></video>
 <div id="host"></div>
 <script type="text/javascript">
 
@@ -43,6 +43,7 @@ function playbackTargetAvailabilityChangedAgain(event)
     shouldBeTrue("mediaController.controls.airplayButton.enabled");
     shouldBeFalse("mediaController.controls.airplayButton.on");
     shouldBeTrue("mediaController.controls.muteButton.enabled");
+    shouldBeTrue("mediaController.controls.autoHideController.fadesWhileIdle");
 
     enterAirPlay();
 }
@@ -64,7 +65,8 @@ function currentPlaybackTargetIsWirelessChanged(event)
     shouldBeTrue("mediaController.controls.airplayButton.enabled");
     shouldBeTrue("mediaController.controls.airplayButton.on");
     shouldBeFalse("mediaController.controls.muteButton.enabled");
-
+    shouldBeFalse("mediaController.controls.autoHideController.fadesWhileIdle");
+    
     debug("");
     container.remove();
     media.remove();
index ede2e55..35b3cac 100644 (file)
@@ -1,3 +1,20 @@
+2017-07-12  Antoine Quint  <graouts@apple.com>
+
+        Playback controls should not hide while AirPlay is active
+        https://bugs.webkit.org/show_bug.cgi?id=174422
+        <rdar://problem/33011477>
+
+        Reviewed by Eric Carlson.
+
+        We now also track changes in AirPlay playback status and account for it when identifying whether we
+        ought to let media controls automatically hide, which should only happen if the media is playing and
+        not playing back through AirPlay.
+
+        * Modules/modern-media-controls/media/controls-visibility-support.js:
+        (ControlsVisibilitySupport.prototype.get mediaEvents):
+        (ControlsVisibilitySupport.prototype._updateControls):
+        (ControlsVisibilitySupport):
+
 2017-07-12  Daniel Bates  <dabates@apple.com>
 
         Attempt to fix the build following <https://trac.webkit.org/changeset/219407>
index 278eb75..97a336e 100644 (file)
@@ -45,7 +45,7 @@ class ControlsVisibilitySupport extends MediaControllerSupport
 
     get mediaEvents()
     {
-        return ["loadedmetadata", "play", "pause", "webkitfullscreenchange"];
+        return ["loadedmetadata", "play", "pause", "webkitfullscreenchange", "webkitcurrentplaybacktargetiswirelesschanged"];
     }
 
     get tracksToMonitor()
@@ -69,7 +69,7 @@ class ControlsVisibilitySupport extends MediaControllerSupport
 
         const controls = this.mediaController.controls;
         controls.visible = shouldShowControls;
-        controls.autoHideController.fadesWhileIdle = isVideo ? !media.paused : false;
+        controls.autoHideController.fadesWhileIdle = isVideo ? !media.paused && !media.webkitCurrentPlaybackTargetIsWireless : false;
     }
 
 }