[webkit-changes] [WebKit/WebKit] 1c989c: [Cocoa] Fall back to playing the largest video in ...
Wenson Hsieh
noreply at github.com
Sat Jul 6 12:58:44 PDT 2024
Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: 1c989ca2a15285de8c1720fa2b1d0887e46b153f
https://github.com/WebKit/WebKit/commit/1c989ca2a15285de8c1720fa2b1d0887e46b153f
Author: Wenson Hsieh <wenson_hsieh at apple.com>
Date: 2024-07-06 (Sat, 06 Jul 2024)
Changed paths:
M Source/WebCore/dom/Document.h
M Source/WebCore/html/HTMLMediaElement.h
M Source/WebKit/UIProcess/Cocoa/WebPageProxyCocoa.mm
M Source/WebKit/WebProcess/WebPage/WebPage.cpp
M Source/WebKit/WebProcess/WebPage/WebPage.h
M Source/WebKit/WebProcess/WebPage/WebPage.messages.in
M Tools/TestWebKitAPI/Tests/WebKitCocoa/VideoControlsManager.mm
M Tools/TestWebKitAPI/Tests/WebKitCocoa/large-videos-with-audio.html
Log Message:
-----------
[Cocoa] Fall back to playing the largest video in the main frame if there's no actively controlled element
https://bugs.webkit.org/show_bug.cgi?id=276263
rdar://131185180
Reviewed by Tim Horton.
Augment `playPredominantOrNowPlayingMediaSession` so that it additionally detects and plays the
largest video element in the viewport, in the absence of any active Now Playing session.
* Source/WebCore/dom/Document.h:
* Source/WebCore/html/HTMLMediaElement.h:
* Source/WebKit/UIProcess/Cocoa/WebPageProxyCocoa.mm:
(WebKit::WebPageProxy::playPredominantOrNowPlayingMediaSession):
* Source/WebKit/WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::startPlayingPredominantVideo):
Begin playing the largest (by area) video in the main frame that isn't already playing. Use this as
a fallback, only when no other video is being controlled.
* Source/WebKit/WebProcess/WebPage/WebPage.h:
* Source/WebKit/WebProcess/WebPage/WebPage.messages.in:
* Tools/TestWebKitAPI/Tests/WebKitCocoa/VideoControlsManager.mm:
(-[VideoControlsManagerTestWebView waitForVideoToPlay]):
(-[VideoControlsManagerTestWebView waitForVideoToPlay:]):
(-[VideoControlsManagerTestWebView isVideoPaused:]):
(-[VideoControlsManagerTestWebView waitForVideoToPause]):
(TestWebKitAPI::TEST(VideoControlsManager, StartPlayingLargestVideoInViewport)):
* Tools/TestWebKitAPI/Tests/WebKitCocoa/large-videos-with-audio.html:
Add an API test to exercise the change — only the first video (out of the three in the page) should
begin playing, since it covers most of the visible viewport.
Canonical link: https://commits.webkit.org/280710@main
To unsubscribe from these emails, change your notification settings at https://github.com/WebKit/WebKit/settings/notifications
More information about the webkit-changes
mailing list