Title: [293684] trunk
- Revision
- 293684
- Author
- drou...@apple.com
- Date
- 2022-05-02 14:52:11 -0700 (Mon, 02 May 2022)
Log Message
[Modern Media Controls] REGRESSION(?) tapping a video to start playing for the first time doesn't start playing
https://bugs.webkit.org/show_bug.cgi?id=239918
<rdar://problem/91329117>
Reviewed by Jer Noble.
Source/WebCore:
This happens on iOS because the `<video>` has a `GestureRecognizer` that will attempt to
`play()`, and then the `PlayPauseButton` (which also has a `GestureRecognizer`) will attempt
to `togglePlayback()` (via `PlaybackSupport`), which will `pause()` because the `<video>` is
not `paused`.
When a `<video>` is `play()` for the first time, it may not actually start playing for a
moment (e.g. buffering) even though it will say it's `paused`.
Test: media/modern-media-controls/ios-inline-media-controls/touch/ios-inline-media-controls-shows-start-button.html
* Modules/modern-media-controls/media/media-controller.js:
(MediaController.prototype.togglePlayback):
Also check `hasPlayed` to decide whether to `play()` or `pause()`, as it's set when the first
`"play"` event is handled, as until then we're still not playing yet and should `play()`.
This could also be fixed in `PlaybackSupport` (and/or `StartSupport`), but doing it in
`togglePlayback` is a more general solution that fixes all present (and future) callsites.
LayoutTests:
* media/modern-media-controls/ios-inline-media-controls/touch/ios-inline-media-controls-shows-start-button.html: Added.
* media/modern-media-controls/ios-inline-media-controls/touch/ios-inline-media-controls-shows-start-button-expected.txt: Added.
* TestExpectations:
Modified Paths
Added Paths
Diff
Modified: trunk/LayoutTests/ChangeLog (293683 => 293684)
--- trunk/LayoutTests/ChangeLog 2022-05-02 21:18:31 UTC (rev 293683)
+++ trunk/LayoutTests/ChangeLog 2022-05-02 21:52:11 UTC (rev 293684)
@@ -1,3 +1,16 @@
+2022-05-02 Devin Rousso <drou...@apple.com>
+
+ [Modern Media Controls] REGRESSION(?) tapping a video to start playing for the first time doesn't start playing
+ https://bugs.webkit.org/show_bug.cgi?id=239918
+ <rdar://problem/91329117>
+
+ Reviewed by Jer Noble.
+
+ * media/modern-media-controls/ios-inline-media-controls/touch/ios-inline-media-controls-shows-start-button.html: Added.
+ * media/modern-media-controls/ios-inline-media-controls/touch/ios-inline-media-controls-shows-start-button-expected.txt: Added.
+
+ * TestExpectations:
+
2022-05-02 Fujii Hironori <hironori.fu...@sony.com>
HTML Parser: Wrong column number in CR-LF line ending style (DOS EOL style) HTML files
Modified: trunk/LayoutTests/TestExpectations (293683 => 293684)
--- trunk/LayoutTests/TestExpectations 2022-05-02 21:18:31 UTC (rev 293683)
+++ trunk/LayoutTests/TestExpectations 2022-05-02 21:52:11 UTC (rev 293684)
@@ -69,6 +69,7 @@
scrollingcoordinator [ Skip ]
media/media-vp8-hiddenframes.html [ Skip ] # Requires MediaFormatReader and VP8 decoder
media/ios [ Skip ]
+media/modern-media-controls/ios-inline-media-controls/touch [ Skip ]
media/modern-media-controls/overflow-support [ Skip ]
http/tests/media/modern-media-controls/overflow-support [ Skip ]
media/modern-media-controls/tracks-support [ Skip ]
Added: trunk/LayoutTests/media/modern-media-controls/ios-inline-media-controls/touch/ios-inline-media-controls-shows-start-button-expected.txt (0 => 293684)
--- trunk/LayoutTests/media/modern-media-controls/ios-inline-media-controls/touch/ios-inline-media-controls-shows-start-button-expected.txt (rev 0)
+++ trunk/LayoutTests/media/modern-media-controls/ios-inline-media-controls/touch/ios-inline-media-controls-shows-start-button-expected.txt 2022-05-02 21:52:11 UTC (rev 293684)
@@ -0,0 +1,16 @@
+Check that tapping the start button actually plays the video.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS shadowRoot.querySelector('button.play-pause') became different from null
+PASS shadowRoot.querySelector('button.play-pause').getBoundingClientRect().width became different from 0
+Tapping start button...
+Waiting for playback...
+PASS media.paused became false
+Checking again...
+PASS media.paused is false
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
Added: trunk/LayoutTests/media/modern-media-controls/ios-inline-media-controls/touch/ios-inline-media-controls-shows-start-button.html (0 => 293684)
--- trunk/LayoutTests/media/modern-media-controls/ios-inline-media-controls/touch/ios-inline-media-controls-shows-start-button.html (rev 0)
+++ trunk/LayoutTests/media/modern-media-controls/ios-inline-media-controls/touch/ios-inline-media-controls-shows-start-button.html 2022-05-02 21:52:11 UTC (rev 293684)
@@ -0,0 +1,40 @@
+<script src=""
+<script src=""
+<body>
+<video src="" style="position: absolute; left: 0; top: 0; width: 400px;" controls muted playsinline></video>
+<script type="text/_javascript_">
+
+window.jsTestIsAsync = true;
+
+description("Check that tapping the start button actually plays the video.");
+
+const media = document.querySelector("video");
+const shadowRoot = window.internals.shadowRoot(media);
+
+media.addEventListener("canplay", async () => {
+ await shouldBecomeDifferent("shadowRoot.querySelector('button.play-pause')", "null");
+ await shouldBecomeDifferent("shadowRoot.querySelector('button.play-pause').getBoundingClientRect().width", "0");
+
+ debug("Tapping start button...");
+ pressOnElement(shadowRoot.querySelector("button.play-pause"));
+
+ debug("Waiting for playback...");
+ await shouldBecomeEqual("media.paused", "false");
+
+ // Wait to see if the video is still playing.
+ debug("Checking again...");
+ setTimeout(() => {
+ shouldBeFalse("media.paused");
+
+ media.remove();
+ finishJSTest();
+ });
+});
+
+media.addEventListener("paused", () => {
+ debug("'paused' event");
+});
+
+</script>
+<script src=""
+</body>
Modified: trunk/Source/WebCore/ChangeLog (293683 => 293684)
--- trunk/Source/WebCore/ChangeLog 2022-05-02 21:18:31 UTC (rev 293683)
+++ trunk/Source/WebCore/ChangeLog 2022-05-02 21:52:11 UTC (rev 293684)
@@ -1,3 +1,29 @@
+2022-05-02 Devin Rousso <drou...@apple.com>
+
+ [Modern Media Controls] REGRESSION(?) tapping a video to start playing for the first time doesn't start playing
+ https://bugs.webkit.org/show_bug.cgi?id=239918
+ <rdar://problem/91329117>
+
+ Reviewed by Jer Noble.
+
+ This happens on iOS because the `<video>` has a `GestureRecognizer` that will attempt to
+ `play()`, and then the `PlayPauseButton` (which also has a `GestureRecognizer`) will attempt
+ to `togglePlayback()` (via `PlaybackSupport`), which will `pause()` because the `<video>` is
+ not `paused`.
+
+ When a `<video>` is `play()` for the first time, it may not actually start playing for a
+ moment (e.g. buffering) even though it will say it's `paused`.
+
+ Test: media/modern-media-controls/ios-inline-media-controls/touch/ios-inline-media-controls-shows-start-button.html
+
+ * Modules/modern-media-controls/media/media-controller.js:
+ (MediaController.prototype.togglePlayback):
+ Also check `hasPlayed` to decide whether to `play()` or `pause()`, as it's set when the first
+ `"play"` event is handled, as until then we're still not playing yet and should `play()`.
+
+ This could also be fixed in `PlaybackSupport` (and/or `StartSupport`), but doing it in
+ `togglePlayback` is a more general solution that fixes all present (and future) callsites.
+
2022-05-02 Youenn Fablet <you...@apple.com>
Cancel response stream if load is being cancelled by the web page
Modified: trunk/Source/WebCore/Modules/modern-media-controls/media/media-controller.js (293683 => 293684)
--- trunk/Source/WebCore/Modules/modern-media-controls/media/media-controller.js 2022-05-02 21:18:31 UTC (rev 293683)
+++ trunk/Source/WebCore/Modules/modern-media-controls/media/media-controller.js 2022-05-02 21:52:11 UTC (rev 293684)
@@ -110,7 +110,7 @@
togglePlayback()
{
- if (this.media.paused)
+ if (this.media.paused || !this.hasPlayed)
this.media.play().catch(e => {});
else
this.media.pause();
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes