Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: 6cb190d2d3d880bbca43f0e839e9fa46aeeae914
https://github.com/WebKit/WebKit/commit/6cb190d2d3d880bbca43f0e839e9fa46aeeae914
Author: Jean-Yves Avenard <[email protected]>
Date: 2026-07-30 (Thu, 30 Jul 2026)
Changed paths:
M Source/WTF/wtf/cocoa/RuntimeApplicationChecksCocoa.h
M Source/WTF/wtf/cocoa/RuntimeApplicationChecksCocoa.mm
M Source/WebCore/html/HTMLMediaElement.cpp
M Source/WebCore/html/HTMLVideoElement.cpp
M Source/WebCore/page/Quirks.cpp
M Source/WebCore/page/Quirks.h
M Source/WebCore/page/QuirksData.h
M Source/WebCore/platform/graphics/MediaPlayer.h
M
Source/WebCore/platform/graphics/avfoundation/MediaPlayerPrivateAVFoundation.cpp
M
Source/WebCore/platform/graphics/avfoundation/MediaPlayerPrivateAVFoundation.h
M
Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm
M
Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.h
M
Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.mm
M Source/WebKit/Shared/WebCoreArgumentCodersMedia.serialization.in
Log Message:
-----------
(311380@main) [Moon Player: AI-Enhanced 3D] Video playback goes black but
audio continues when playing YouTube videos in full screen
https://bugs.webkit.org/show_bug.cgi?id=320547
rdar://183071272
Reviewed by Andy Estes.
311380@main made a media player release its video renderer once the element was
no
longer visible, either because it had been scrolled far away from the viewport
(fixing window server jetsams on infinite scrolling video websites) or because
the
page hosting it had become non-visible.
Some clients keep displaying the video layer they host after hiding their web
view.
For those, neither the page's visibility nor the element's position in the
viewport
indicate whether the video is on screen: the renderer is released while the
client
is still showing it, and the video turns black while audio keeps playing.
Add a MediaPlayerLoadOptions member, set from a new site-specific quirk, that
selectively restores the pre-311380@main behaviour when set. Each of the three
places where 311380@main made visibility release the renderer is reverted
individually:
- HTMLVideoElement::computeAcceleratedRenderingStateAndUpdateMediaPlayer()
ignores
the viewport intersection term that commit added to `canBeAccelerated`.
- MediaPlayerPrivateMediaSourceAVFObjC::updateRendererVisibility() no longer
calls
acceleratedRenderingStateChanged(), which that commit added, and
acceleratedRenderingStateChanged() forwards
MediaPlayer::renderingCanBeAccelerated()
unchanged rather than combining it with the page's and the viewport's
visibility.
- MediaPlayerPrivateAVFoundationObjC::shouldAttachLayerToPlayer(), added by that
commit, keeps the video layer attached to the AVPlayer as it was before.
The quirk is bound to
SDKAlignedBehavior::NoMediaLayerTeardownOnPageVisibilityChangeQuirk so that it
stops
applying once the application is rebuilt against a newer SDK, giving it a
chance to
adopt a supported presentation mode in the meantime. The default behaviour, and
therefore the memory optimisation 311380@main introduced, is unchanged for every
other client.
* Source/WTF/wtf/cocoa/RuntimeApplicationChecksCocoa.h:
* Source/WTF/wtf/cocoa/RuntimeApplicationChecksCocoa.mm:
(WTF::IOSApplication::isMoonPlayer):
* Source/WebCore/html/HTMLMediaElement.cpp:
(WebCore::HTMLMediaElement::loadResource): Set the new load option.
* Source/WebCore/html/HTMLVideoElement.cpp:
(WebCore::HTMLVideoElement::computeAcceleratedRenderingStateAndUpdateMediaPlayer):
* Source/WebCore/page/Quirks.cpp:
(WebCore::Quirks::shouldDisableMediaLayerTeardownOnPageVisibilityChangeQuirk
const):
(WebCore::Quirks::determineRelevantQuirks):
* Source/WebCore/page/Quirks.h:
* Source/WebCore/page/QuirksData.h:
* Source/WebCore/platform/graphics/MediaPlayer.h:
*
Source/WebCore/platform/graphics/avfoundation/MediaPlayerPrivateAVFoundation.cpp:
(WebCore::MediaPlayerPrivateAVFoundation::load): Keep the load option, the base
class
otherwise discards it.
*
Source/WebCore/platform/graphics/avfoundation/MediaPlayerPrivateAVFoundation.h:
*
Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
(WebCore::MediaPlayerPrivateAVFoundationObjC::shouldAttachLayerToPlayer):
*
Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.h:
*
Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.mm:
(WebCore::MediaPlayerPrivateMediaSourceAVFObjC::shouldTeardownOnVisibilityChange
const):
(WebCore::MediaPlayerPrivateMediaSourceAVFObjC::updateRendererVisibility):
(WebCore::MediaPlayerPrivateMediaSourceAVFObjC::acceleratedRenderingStateChanged):
* Source/WebKit/Shared/WebCoreArgumentCodersMedia.serialization.in:
Canonical link: https://commits.webkit.org/318230@main
To unsubscribe from these emails, change your notification settings at
https://github.com/WebKit/WebKit/settings/notifications