[webkit-changes] [WebKit/WebKit] e9ca87: Add a WKWebView SPI to tell clients when a Now Pla...
aestes
noreply at github.com
Mon Jun 24 20:06:32 PDT 2024
Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: e9ca870925506eabe4eb1434e3eac47c30da6e9c
https://github.com/WebKit/WebKit/commit/e9ca870925506eabe4eb1434e3eac47c30da6e9c
Author: Andy Estes <aestes at apple.com>
Date: 2024-06-24 (Mon, 24 Jun 2024)
Changed paths:
M Source/WebCore/Modules/webaudio/AudioContext.cpp
M Source/WebCore/Modules/webaudio/AudioContext.h
M Source/WebCore/html/HTMLMediaElement.cpp
M Source/WebCore/html/HTMLMediaElement.h
M Source/WebCore/page/ChromeClient.h
M Source/WebCore/page/Page.cpp
M Source/WebCore/page/Page.h
M Source/WebCore/platform/audio/PlatformMediaSession.cpp
M Source/WebCore/platform/audio/PlatformMediaSession.h
M Source/WebCore/platform/audio/PlatformMediaSessionManager.cpp
M Source/WebCore/platform/audio/PlatformMediaSessionManager.h
M Source/WebCore/platform/audio/cocoa/MediaSessionManagerCocoa.h
M Source/WebCore/platform/audio/cocoa/MediaSessionManagerCocoa.mm
M Source/WebCore/platform/audio/ios/MediaSessionManagerIOS.mm
M Source/WebKit/UIProcess/API/Cocoa/WKWebViewInternal.h
M Source/WebKit/UIProcess/API/Cocoa/WKWebViewPrivate.h
M Source/WebKit/UIProcess/Cocoa/PageClientImplCocoa.h
M Source/WebKit/UIProcess/Cocoa/PageClientImplCocoa.mm
M Source/WebKit/UIProcess/PageClient.h
M Source/WebKit/UIProcess/WebPageProxy.cpp
M Source/WebKit/UIProcess/WebPageProxy.h
M Source/WebKit/UIProcess/WebPageProxy.messages.in
M Source/WebKit/WebProcess/WebCoreSupport/WebChromeClient.cpp
M Source/WebKit/WebProcess/WebCoreSupport/WebChromeClient.h
M Source/WebKit/WebProcess/WebPage/WebPage.cpp
M Source/WebKit/WebProcess/WebPage/WebPage.h
M Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj
A Tools/TestWebKitAPI/Tests/WebKitCocoa/NowPlayingSession.mm
Log Message:
-----------
Add a WKWebView SPI to tell clients when a Now Playing session is active
https://bugs.webkit.org/show_bug.cgi?id=275814
rdar://129366857
Reviewed by Eric Carlson.
Added a boolean -_hasActiveNowPlayingSession property to WKWebView that indicates when the web view
has an active Now Playing session. The property is key-value observable. This is achieved by teching
MediaSessionManagerCocoa to set a isActiveNowPlayingSession boolean on each PlatformMediaSession
when updating Now Playing information. PlatformMediaSession notifies its client when this value
changes, ultimately telling Page to set a 0-delay timer to check whether the Page has an active
Now Playing session (the timer coalesces updates in the case where one PlatformMediaSession becomes
inactive and another becomes active). When the timer fires, Page asks PlatformMediaSessionManager if
any media session in the page's media session group identifier has an active Now Playing session. If
this computed value changes then a message is sent to WebPageProxy that ultimately changes the value
of -_hasActiveNowPlayingSession.
Added API tests.
* Source/WebCore/Modules/webaudio/AudioContext.cpp:
(WebCore::AudioContext::isActiveNowPlayingSessionChanged):
* Source/WebCore/Modules/webaudio/AudioContext.h:
* Source/WebCore/html/HTMLMediaElement.cpp:
(WebCore::HTMLMediaElement::isActiveNowPlayingSessionChanged):
* Source/WebCore/html/HTMLMediaElement.h:
* Source/WebCore/page/ChromeClient.h:
(WebCore::ChromeClient::hasActiveNowPlayingSessionChanged):
* Source/WebCore/page/Page.cpp:
(WebCore::m_activeNowPlayingSessionUpdateTimer):
(WebCore::Page::hasActiveNowPlayingSessionChanged):
(WebCore::Page::activeNowPlayingSessionUpdateTimerFired):
(WebCore::m_writingToolsController): Deleted.
* Source/WebCore/page/Page.h:
(WebCore::Page::hasActiveNowPlayingSession const):
* Source/WebCore/platform/audio/PlatformMediaSession.cpp:
(WebCore::PlatformMediaSession::setActiveNowPlayingSession):
* Source/WebCore/platform/audio/PlatformMediaSession.h:
(WebCore::PlatformMediaSession::isActiveNowPlayingSession const):
* Source/WebCore/platform/audio/PlatformMediaSessionManager.cpp:
(WebCore::PlatformMediaSessionManager::hasActiveNowPlayingSessionInGroup):
* Source/WebCore/platform/audio/PlatformMediaSessionManager.h:
* Source/WebCore/platform/audio/cocoa/MediaSessionManagerCocoa.h:
* Source/WebCore/platform/audio/cocoa/MediaSessionManagerCocoa.mm:
(WebCore::MediaSessionManagerCocoa::updateActiveNowPlayingSession):
(WebCore::MediaSessionManagerCocoa::updateNowPlayingInfo):
* Source/WebCore/platform/audio/ios/MediaSessionManagerIOS.mm:
(WebCore::MediaSessionManageriOS::activeVideoRouteDidChange):
* Source/WebKit/UIProcess/API/Cocoa/WKWebViewInternal.h:
* Source/WebKit/UIProcess/API/Cocoa/WKWebViewPrivate.h:
* Source/WebKit/UIProcess/Cocoa/PageClientImplCocoa.h:
* Source/WebKit/UIProcess/Cocoa/PageClientImplCocoa.mm:
(WebKit::PageClientImplCocoa::hasActiveNowPlayingSessionChanged):
* Source/WebKit/UIProcess/PageClient.h:
(WebKit::PageClient::hasActiveNowPlayingSessionChanged):
* Source/WebKit/UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::didCommitLoadForFrame):
(WebKit::WebPageProxy::resetState):
(WebKit::WebPageProxy::hasActiveNowPlayingSessionChanged):
* Source/WebKit/UIProcess/WebPageProxy.h:
* Source/WebKit/UIProcess/WebPageProxy.messages.in:
* Source/WebKit/WebProcess/WebCoreSupport/WebChromeClient.cpp:
(WebKit::WebChromeClient::hasActiveNowPlayingSessionChanged):
* Source/WebKit/WebProcess/WebCoreSupport/WebChromeClient.h:
* Source/WebKit/WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::hasActiveNowPlayingSessionChanged):
* Source/WebKit/WebProcess/WebPage/WebPage.h:
* Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
* Tools/TestWebKitAPI/Tests/WebKitCocoa/NowPlayingSession.mm: Added.
(-[NowPlayingSessionObserver observeValueForKeyPath:ofObject:change:context:]):
(TEST(NowPlayingSession, NoSession)):
(TEST(NowPlayingSession, HasSession)):
(TEST(NowPlayingSession, NavigateAfterHasSession)):
Canonical link: https://commits.webkit.org/280318@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