Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: 7223f04262f101f416e31198f62ca743ea803cdc
https://github.com/WebKit/WebKit/commit/7223f04262f101f416e31198f62ca743ea803cdc
Author: Andy Estes <[email protected]>
Date: 2024-02-02 (Fri, 02 Feb 2024)
Changed paths:
M Source/WebKit/SourcesCocoa.txt
M Source/WebKit/UIProcess/Cocoa/VideoPresentationManagerProxy.mm
M Source/WebKit/UIProcess/PageClient.h
M Source/WebKit/UIProcess/ios/PageClientImplIOS.h
M Source/WebKit/UIProcess/ios/PageClientImplIOS.mm
M Source/WebKit/UIProcess/ios/WKContentView.h
M Source/WebKit/UIProcess/ios/WKContentView.mm
A Source/WebKit/UIProcess/ios/WKVisibilityPropagationView.h
A Source/WebKit/UIProcess/ios/WKVisibilityPropagationView.mm
M Source/WebKit/UIProcess/mac/WebViewImpl.mm
M Source/WebKit/WebKit.xcodeproj/project.pbxproj
Log Message:
-----------
REGRESSION(ExtensionKit): Video stops playing on mlb.com when entering PiP
https://bugs.webkit.org/show_bug.cgi?id=268532
rdar://121120961
Reviewed by Per Arne Vollan.
Prior to managing WebKit auxiliary processes as extensions and enabling media
capability grants,
the iOS media system tracked the visibility of the WebKit host process by
observing the foreground
status of the app whose PID WebKit provided to AVSystemController via the
AVSystemController_PIDToInheritAppStateFrom SPI. When a PiP window is visible
on screen then the
associated app and its WebContent and GPU processes are considered in the
foreground and media
playback is allowed by the system.
Once WebKit started managing auxiliary processes as extensions we stopped using
AVSystemController
SPIs and relied instead on BrowserEngineKit visibility propagation interactions
to propagate
visibility from the host app to the WebContent and GPU extensions. Visibility
propagation
interactions were installed on the WKContentView, and so long as the content
view was in a visible
scene then the WebContent and GPU extensions would be considered visible by the
media system.
However, the PiP window is in a different scene and may be visible at times
when the
WKContentView's scene isn't. In these cases the WebContent and GPU extensions
would not be
considered visible, preventing media playback from continuing in the PiP window
while the host app
is in the backround.
Resolved this by encapsulating the logic for creating visibility propagation
interactions into a
new UIView subclass (WKVisibilityPropagationView) that is added as a subview of
WKContentViews and
WKLayerHostViews (the latter only when in a fullscreen or PiP presentation
mode). This ensures that
WebContent and GPU extensions are considered visible whenever either of these
views are in a visible
scene. WKContentView keeps a weak set of all WKVisibilityPropagationViews and
is responsible for
creating and removing visibility propagation interactions as auxiliary
processes launch and exit.
* Source/WebKit/SourcesCocoa.txt:
* Source/WebKit/UIProcess/Cocoa/VideoPresentationManagerProxy.mm:
(-[WKLayerHostView visibilityPropagationView]):
(-[WKLayerHostView setVisibilityPropagationView:]):
(WebKit::VideoPresentationManagerProxy::setupFullscreenWithID):
(WebKit::VideoPresentationManagerProxy::didCleanupFullscreen):
(WebKit::VideoPresentationManagerProxy::setVideoLayerFrame):
* Source/WebKit/UIProcess/PageClient.h:
(WebKit::PageClient::createVisibilityPropagationView):
* Source/WebKit/UIProcess/ios/PageClientImplIOS.h:
* Source/WebKit/UIProcess/ios/PageClientImplIOS.mm:
(WebKit::PageClientImpl::createVisibilityPropagationView):
* Source/WebKit/UIProcess/ios/WKContentView.h:
* Source/WebKit/UIProcess/ios/WKContentView.mm:
(-[WKContentView _commonInitializationWithProcessPool:configuration:]):
(-[WKContentView _installVisibilityPropagationViews]):
(-[WKContentView _setupVisibilityPropagationForWebProcess]):
(-[WKContentView _setupVisibilityPropagationForGPUProcess]):
(-[WKContentView _removeVisibilityPropagationViewForWebProcess]):
(-[WKContentView _removeVisibilityPropagationViewForGPUProcess]):
(-[WKContentView _didRelaunchProcess]):
(-[WKContentView _webProcessDidCreateContextForVisibilityPropagation]):
(-[WKContentView _gpuProcessDidCreateContextForVisibilityPropagation]):
(-[WKContentView _createVisibilityPropagationView]):
(-[WKContentView _setupVisibilityPropagationViewForWebProcess]): Deleted.
(-[WKContentView _setupVisibilityPropagationViewForGPUProcess]): Deleted.
* Source/WebKit/UIProcess/ios/WKVisibilityPropagationView.h: Added.
* Source/WebKit/UIProcess/ios/WKVisibilityPropagationView.mm: Added.
(-[WKVisibilityPropagationView propagateVisibilityToProcess:]):
(-[WKVisibilityPropagationView stopPropagatingVisibilityToProcess:]):
(-[WKVisibilityPropagationView _containsInteractionForProcess:]):
* Source/WebKit/UIProcess/mac/WebViewImpl.mm:
* Source/WebKit/WebKit.xcodeproj/project.pbxproj:
Canonical link: https://commits.webkit.org/274037@main
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes