Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: d6d0989dd597c8d1aa6efac8f774e1354797425b
https://github.com/WebKit/WebKit/commit/d6d0989dd597c8d1aa6efac8f774e1354797425b
Author: Andy Estes <[email protected]>
Date: 2026-09-09 (Wed, 09 Sep 2026)
Changed paths:
A
LayoutTests/media/wireless-playback-media-player/route-activates-before-session-is-now-playing-eligible-expected.txt
A
LayoutTests/media/wireless-playback-media-player/route-activates-before-session-is-now-playing-eligible.html
A
LayoutTests/platform/ios/media/media-element-does-not-eagerly-create-media-session-helper-expected.txt
A
LayoutTests/platform/ios/media/media-element-does-not-eagerly-create-media-session-helper.html
M Source/WebCore/html/HTMLMediaElement.cpp
M Source/WebCore/html/MediaElementSession.cpp
M Source/WebCore/platform/audio/cocoa/MediaSessionManagerCocoa.h
M Source/WebCore/platform/audio/cocoa/MediaSessionManagerCocoa.mm
M Source/WebCore/platform/audio/ios/MediaSessionManagerIOS.h
M Source/WebCore/platform/audio/ios/MediaSessionManagerIOS.mm
Log Message:
-----------
[iOS] Wireless playback causes a RemoteMediaSessionHelperProxy to be created
too eagerly
https://bugs.webkit.org/show_bug.cgi?id=323389
rdar://184536781
Reviewed by Jer Noble.
317764@main made it so a RemoteMediaSessionHelperProxy is created as soon as
the first
MediaElementSession is instantiated, but this was too eager, since it
unnecessarily creates a
MediaSessionHelper in cases where a media element never loads a resource or
never plays audibly.
This is unnecessary since wireless playback is not possible prior to the
element playing audibly.
Fixed by moving the ensureMediaDeviceRouteControllerMonitoring call to
HTMLMediaElement::canProduceAudioChanged, but this exposed a bug where the lazy
creation of
MediaSessionHelper may cause a wireless route to be delivered after
MediaSessionManager::sessionDidCompleteAdmission is called. If that happens the
media element is
never notified of the route and playback continues locally.
Resolved this second issue by moving the route delivery code in
MediaSessionManageriOS::sessionDidCompleteAdmission to a new function
(applyActiveVideoRouteToSession) and calling that in
MediaSessionManagerCocoa::updateActiveNowPlayingSession when the Now Playing
session changes.
Test:
platform/ios/media/media-element-does-not-eagerly-create-media-session-helper.html
*
LayoutTests/media/wireless-playback-media-player/route-activates-before-session-is-now-playing-eligible-expected.txt:
Added.
*
LayoutTests/media/wireless-playback-media-player/route-activates-before-session-is-now-playing-eligible.html:
Added.
*
LayoutTests/platform/ios/media/media-element-does-not-eagerly-create-media-session-helper-expected.txt:
Added.
*
LayoutTests/platform/ios/media/media-element-does-not-eagerly-create-media-session-helper.html:
Added.
* Source/WebCore/html/HTMLMediaElement.cpp:
(WebCore::HTMLMediaElement::canProduceAudioChanged):
* Source/WebCore/html/MediaElementSession.cpp:
(WebCore::MediaElementSession::MediaElementSession):
* Source/WebCore/platform/audio/cocoa/MediaSessionManagerCocoa.h:
* Source/WebCore/platform/audio/cocoa/MediaSessionManagerCocoa.mm:
(WebCore::MediaSessionManagerCocoa::updateActiveNowPlayingSession):
(WebCore::MediaSessionManagerCocoa::activeNowPlayingSessionChanged):
* Source/WebCore/platform/audio/ios/MediaSessionManagerIOS.h:
* Source/WebCore/platform/audio/ios/MediaSessionManagerIOS.mm:
(WebCore::MediaSessionManageriOS::configureWirelessTargetMonitoring):
(WebCore::MediaSessionManageriOS::ensureMediaDeviceRouteControllerMonitoring):
(WebCore::MediaSessionManageriOS::applyActiveVideoRouteToSession):
(WebCore::MediaSessionManageriOS::sessionDidCompleteAdmission):
(WebCore::MediaSessionManageriOS::activeNowPlayingSessionChanged):
Canonical link: https://commits.webkit.org/320748@main
To unsubscribe from these emails, change your notification settings at
https://github.com/WebKit/WebKit/settings/notifications