Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: 585df57b0a3e93036e3e3202c9296f4c9949a41f
https://github.com/WebKit/WebKit/commit/585df57b0a3e93036e3e3202c9296f4c9949a41f
Author: Andy Estes <[email protected]>
Date: 2026-07-23 (Thu, 23 Jul 2026)
Changed paths:
M Source/WTF/wtf/PlatformHave.h
M Source/WebCore/html/MediaElementSession.cpp
M Source/WebCore/platform/audio/MediaSessionManagerInterface.h
M Source/WebCore/platform/audio/ios/MediaSessionHelperIOS.h
M Source/WebCore/platform/audio/ios/MediaSessionHelperIOS.mm
M Source/WebCore/platform/audio/ios/MediaSessionManagerIOS.h
M Source/WebCore/platform/audio/ios/MediaSessionManagerIOS.mm
M Source/WebCore/platform/graphics/avfoundation/MediaPlaybackTargetCocoa.h
M Source/WebCore/platform/graphics/avfoundation/MediaPlaybackTargetCocoa.mm
M Source/WebKit/WebProcess/GPU/media/ios/RemoteMediaSessionHelper.cpp
M Source/WebKit/WebProcess/GPU/media/ios/RemoteMediaSessionHelper.h
Log Message:
-----------
[iOS] Media sometimes plays locally if a MediaDeviceRoute activates prior to
playback starting
https://bugs.webkit.org/show_bug.cgi?id=320027
rdar://182961557
Reviewed by Jer Noble.
Two bugs could result in media incorrectly playing locally if a
MediaDeviceRoute activates prior to
playback starting:
1. Due to a bug in AVAudioSession, the AVOutputContext representing the current
routing context may
claim to be the built-in speaker if queried prior to audio session
activation. When this happens,
MediaSessionHelper::activeRoutesDidChange returns early before propagating
the wireless route to
the WebContent process.
2. If a MediaDeviceRoute activates prior to MediaSessionHelper gaining a
client, the route will not
be propagated to the WebContent process.
In both cases, since the route is not propagated to the WebContent process, the
media element does
not know to reconfigure its media engine for wireless playback.
Resolved (1) by removing the code that interrogates AVOutputContext, since we
can now rely on not
being delivered AVSystemRoutes that do not support URL-based playback. Resolved
(2) by ensuring
that a RemoteMediaSessionHelperProxy is created and registered as a
MediaSessionHelper client
whenever a MediaElementSession is constructed.
No new tests since this bug was only observable on an iOS device. On iOS
Simulator we do not access
AVOutputContexts, and MediaSessionHelper activates mock MediaDeviceRoutes
directly in the
WebContent process.
* Source/WTF/wtf/PlatformHave.h:
* Source/WebCore/html/MediaElementSession.cpp:
(WebCore::MediaElementSession::MediaElementSession):
* Source/WebCore/platform/audio/MediaSessionManagerInterface.h:
* Source/WebCore/platform/audio/ios/MediaSessionHelperIOS.h:
* Source/WebCore/platform/audio/ios/MediaSessionHelperIOS.mm:
(MediaSessionHelper::addClient):
(MediaSessionHelper::activeRoutesDidChange):
* Source/WebCore/platform/audio/ios/MediaSessionManagerIOS.h:
* Source/WebCore/platform/audio/ios/MediaSessionManagerIOS.mm:
(WebCore::MediaSessionManageriOS::configureWirelessTargetMonitoring):
(WebCore::MediaSessionManageriOS::ensureMediaDeviceRouteControllerMonitoring):
* Source/WebCore/platform/graphics/avfoundation/MediaPlaybackTargetCocoa.h:
* Source/WebCore/platform/graphics/avfoundation/MediaPlaybackTargetCocoa.mm:
(WebCore::MediaPlaybackTargetCocoa::supportsCustomProtocolVideoPlayback const):
Deleted.
* Source/WebKit/WebProcess/GPU/media/ios/RemoteMediaSessionHelper.cpp:
(WebKit::RemoteMediaSessionHelper::ensureMediaDeviceRouteControllerMonitoring):
* Source/WebKit/WebProcess/GPU/media/ios/RemoteMediaSessionHelper.h:
Canonical link: https://commits.webkit.org/317764@main
To unsubscribe from these emails, change your notification settings at
https://github.com/WebKit/WebKit/settings/notifications