Title: [278622] trunk
Revision
278622
Author
[email protected]
Date
2021-06-08 11:39:39 -0700 (Tue, 08 Jun 2021)

Log Message

[Modern Media Controls] Don't show Playback Speed when up-to-date Live Boadcasts
https://bugs.webkit.org/show_bug.cgi?id=226744

Reviewed by Eric Carlson.

Source/WebCore:

Test: http/tests/media/modern-media-controls/overflow-support/playback-speed-live-broadcast.html

* Modules/modern-media-controls/media/overflow-support.js:
(OverflowSupport.prototype.get mediaEvents):
(OverflowSupport.prototype.syncControl):
(OverflowSupport.prototype.get _includePlaybackRates): Added.
Rework existing logic that determines whether to include "Playback Speed" into a separate
function for clarity.

LayoutTests:

* http/tests/media/modern-media-controls/overflow-support/playback-speed-live-broadcast.html: Added.
* http/tests/media/modern-media-controls/overflow-support/playback-speed-live-broadcast-expected.txt: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (278621 => 278622)


--- trunk/LayoutTests/ChangeLog	2021-06-08 18:02:20 UTC (rev 278621)
+++ trunk/LayoutTests/ChangeLog	2021-06-08 18:39:39 UTC (rev 278622)
@@ -1,5 +1,15 @@
 2021-06-08  Devin Rousso  <[email protected]>
 
+        [Modern Media Controls] Don't show Playback Speed when up-to-date Live Boadcasts
+        https://bugs.webkit.org/show_bug.cgi?id=226744
+
+        Reviewed by Eric Carlson.
+
+        * http/tests/media/modern-media-controls/overflow-support/playback-speed-live-broadcast.html: Added.
+        * http/tests/media/modern-media-controls/overflow-support/playback-speed-live-broadcast-expected.txt: Added.
+
+2021-06-08  Devin Rousso  <[email protected]>
+
         [Modern Media Controls] upstream new features
         https://bugs.webkit.org/show_bug.cgi?id=226736
         <rdar://problem/78957464>

Added: trunk/LayoutTests/http/tests/media/modern-media-controls/overflow-support/playback-speed-live-broadcast-expected.txt (0 => 278622)


--- trunk/LayoutTests/http/tests/media/modern-media-controls/overflow-support/playback-speed-live-broadcast-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/http/tests/media/modern-media-controls/overflow-support/playback-speed-live-broadcast-expected.txt	2021-06-08 18:39:39 UTC (rev 278622)
@@ -0,0 +1,13 @@
+Testing the OverflowSupport behavior for Playback Speed with a live broadcast video.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS shadowRoot.querySelector('button.overflow') became different from null
+PASS shadowRoot.querySelector('button.overflow').getBoundingClientRect().width became different from 0
+Tapping overflow button...
+PASS contextmenu[0].children.filter((item) => item.title === 'Playback Speed').length is 0
+PASS successfullyParsed is true
+
+TEST COMPLETE
+

Added: trunk/LayoutTests/http/tests/media/modern-media-controls/overflow-support/playback-speed-live-broadcast.html (0 => 278622)


--- trunk/LayoutTests/http/tests/media/modern-media-controls/overflow-support/playback-speed-live-broadcast.html	                        (rev 0)
+++ trunk/LayoutTests/http/tests/media/modern-media-controls/overflow-support/playback-speed-live-broadcast.html	2021-06-08 18:39:39 UTC (rev 278622)
@@ -0,0 +1,41 @@
+<!DOCTYPE html> <!-- webkit-test-runner [ useFlexibleViewport=true ] -->
+<meta name="viewport" content="width=device-width">
+<script src=""
+<script src=""
+<script src=""
+<body>
+<video src="" style="position: absolute; left: 0; top: 0; width: 600px;" controls autoplay muted playsinline>
+    <track src="" kind="chapters"> <!-- guarantees that the overflow button is shown -->
+</video>
+<script type="text/_javascript_">
+
+window.jsTestIsAsync = true;
+
+description("Testing the <code>OverflowSupport</code> behavior for Playback Speed with a live broadcast video.");
+
+const media = document.querySelector("video");
+const shadowRoot = window.internals.shadowRoot(media);
+
+let contextmenu = null;
+
+media.addEventListener("play", function() {
+    media.pause();
+
+    shouldBecomeDifferent("shadowRoot.querySelector('button.overflow')", "null", () => {
+        shouldBecomeDifferent("shadowRoot.querySelector('button.overflow').getBoundingClientRect().width", "0", async () => {
+            debug("Tapping overflow button...");
+            await pressOnElement(shadowRoot.querySelector("button.overflow"));
+            contextmenu = await getTracksContextMenu();
+            checkedItems = contextmenu[0].children.filter((item) => item.checked);
+            shouldBe("contextmenu[0].children.filter((item) => item.title === 'Playback Speed').length", "0");
+            await UIHelper.waitForContextMenuToHide();
+
+            media.remove();
+            finishJSTest();
+        });
+    });
+});
+
+</script>
+<script src=""
+</body>

Modified: trunk/Source/WebCore/ChangeLog (278621 => 278622)


--- trunk/Source/WebCore/ChangeLog	2021-06-08 18:02:20 UTC (rev 278621)
+++ trunk/Source/WebCore/ChangeLog	2021-06-08 18:39:39 UTC (rev 278622)
@@ -1,3 +1,19 @@
+2021-06-08  Devin Rousso  <[email protected]>
+
+        [Modern Media Controls] Don't show Playback Speed when up-to-date Live Boadcasts
+        https://bugs.webkit.org/show_bug.cgi?id=226744
+
+        Reviewed by Eric Carlson.
+
+        Test: http/tests/media/modern-media-controls/overflow-support/playback-speed-live-broadcast.html
+
+        * Modules/modern-media-controls/media/overflow-support.js:
+        (OverflowSupport.prototype.get mediaEvents):
+        (OverflowSupport.prototype.syncControl):
+        (OverflowSupport.prototype.get _includePlaybackRates): Added.
+        Rework existing logic that determines whether to include "Playback Speed" into a separate
+        function for clarity.
+
 2021-06-08  Antti Koivisto  <[email protected]>
 
         Factor MarkedText collection out of LegacyInlineTextBox

Modified: trunk/Source/WebCore/Modules/modern-media-controls/media/overflow-support.js (278621 => 278622)


--- trunk/Source/WebCore/Modules/modern-media-controls/media/overflow-support.js	2021-06-08 18:02:20 UTC (rev 278621)
+++ trunk/Source/WebCore/Modules/modern-media-controls/media/overflow-support.js	2021-06-08 18:39:39 UTC (rev 278622)
@@ -30,7 +30,21 @@
 
     get mediaEvents()
     {
-        return ["loadstart", "loadedmetadata"];
+        return [
+            "abort",
+            "canplay",
+            "canplaythrough",
+            "durationchange",
+            "emptied",
+            "error",
+            "loadeddata",
+            "loadedmetadata",
+            "loadstart",
+            "playing",
+            "stalled",
+            "suspend",
+            "waiting",
+        ];
     }
 
     get tracksToMonitor()
@@ -54,7 +68,7 @@
 
         let defaultContextMenuOptions = {};
 
-        if (!this.mediaController.hidePlaybackRates && (!window.MediaStream || !(this.mediaController.media.srcObject instanceof MediaStream)))
+        if (this._includePlaybackRates)
             defaultContextMenuOptions.includePlaybackRates = true;
 
         for (let textTrack of this.mediaController.media.textTracks) {
@@ -69,4 +83,27 @@
         this.control.defaultContextMenuOptions = defaultContextMenuOptions;
     }
 
+    // Private
+
+    get _includePlaybackRates()
+    {
+        if (this.mediaController.hidePlaybackRates)
+            return false;
+
+        let media = this.mediaController.media;
+
+        if (media.duration === Number.POSITIVE_INFINITY && media.readyState >= HTMLMediaElement.HAVE_CURRENT_DATA) {
+            // Do not allow adjustment of the playback rate for live broadcasts.
+            return false;
+        }
+
+        if (window.MediaStream && media.srcObject instanceof MediaStream) {
+            // http://w3c.github.io/mediacapture-main/#mediastreams-in-media-elements
+            // "playbackRate" - A MediaStream is not seekable.
+            return false;
+        }
+
+        return true;
+    }
+
 }
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to