Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 7fa5ab54bb881f1ea530ff0e36e1a35e1c55f6ad
      
https://github.com/WebKit/WebKit/commit/7fa5ab54bb881f1ea530ff0e36e1a35e1c55f6ad
  Author: Jean-Yves Avenard <[email protected]>
  Date:   2026-08-18 (Tue, 18 Aug 2026)

  Changed paths:
    M 
LayoutTests/fast/harness/internals-object-property-access-on-window-without-frame-crash.html
    A 
LayoutTests/media/audio-session-not-activated-for-denied-audible-element-expected.txt
    A 
LayoutTests/media/audio-session-not-activated-for-denied-audible-element.html
    A 
LayoutTests/media/audio-session-not-activated-when-unmuting-denied-element-expected.txt
    A 
LayoutTests/media/audio-session-not-activated-when-unmuting-denied-element.html
    M LayoutTests/platform/glib/TestExpectations
    M Source/WebCore/html/MediaElementSession.h
    M Source/WebCore/platform/audio/AudioSession.cpp
    M Source/WebCore/platform/audio/AudioSession.h
    M Source/WebCore/platform/audio/MediaSessionManagerInterface.cpp
    M Source/WebCore/platform/audio/MediaSessionManagerInterface.h
    M Source/WebCore/platform/audio/PlatformMediaSessionInterface.h
    M Source/WebCore/testing/Internals.cpp
    M Source/WebCore/testing/Internals.h
    M Source/WebCore/testing/Internals.idl
    M Source/WebKit/GPUProcess/media/RemoteAudioSessionProxy.cpp
    M Source/WebKit/GPUProcess/media/RemoteAudioSessionProxy.h
    M Source/WebKit/GPUProcess/media/RemoteAudioSessionProxy.messages.in
    M Source/WebKit/WebProcess/GPU/media/RemoteAudioSession.cpp
    M Source/WebKit/WebProcess/GPU/media/RemoteAudioSession.h

  Log Message:
  -----------
  REGRESSION(317782@main) An audible video element that will not be allowed to 
play can interrupt play in another app
https://bugs.webkit.org/show_bug.cgi?id=322011
rdar://184545492

Reviewed by Eric Carlson.

Playing a trailer in the TV app on visionOS and then opening a page carrying an
autoplaying video paused the trailer, and it did not resume.

Following 317782@main, void 
MediaSessionManagerInterface::sessionCanProduceAudioChanged() unconditionally 
called maybeActivateAudioSession() synchronously;
When the element was first loaded, and not yet known to have audible content,
it was allowed to play and the MediaSession state became Playing,
shortly after when the metadata was loaded and readyState moved to HAVE_METADATA
(having canProduceAudio() now returning true but not yet actually audible
having not loaded any content to render), maybeActivateAudioSession() activated
the AudioSession only to then immediately deny playback and pause the video.
This caused any other application currently playing audio on visionOS or iPadOS 
to be paused.

The audio session is now activated only for a session whose client would be
allowed to begin playing. PlatformMediaSessionInterface gains 
playbackPermitted(),
defaulting to true so that AudioContext, MediaSession and MediaStream sessions 
are
unaffected, and MediaElementSession answers it with
playbackStateChangePermitted(MediaPlaybackState::Playing).
MediaSessionManagerInterface::audioSessionActivationRequired() is
activeAudioSessionRequired() plus that condition and is consulted only by
maybeActivateAudioSession(). maybeDeactivateAudioSession() keeps using
activeAudioSessionRequired(): the permission is state-dependent and can be false
for a session that is legitimately playing, and deactivation must stay
conservative.

Asserting that no activation happened needs the GPU process's view, as a web
process's own AudioSession reports the state it asked for and reports it
optimistically. AudioSession counts transitions from inactive to active, and the
count is readable through internals.systemAudioSessionActivationCount(), plumbed
the way systemAudioSessionCategory() already is.

* 
LayoutTests/fast/harness/internals-object-property-access-on-window-without-frame-crash.html:
Skip the new internals function, which sends IPC behind AllowTestOnlyIPC that 
this test does not set.
* 
LayoutTests/media/audio-session-not-activated-for-denied-audible-element-expected.txt:
 Added.
* 
LayoutTests/media/audio-session-not-activated-for-denied-audible-element.html: 
Added.
* 
LayoutTests/media/audio-session-not-activated-when-unmuting-denied-element-expected.txt:
 Added.
* 
LayoutTests/media/audio-session-not-activated-when-unmuting-denied-element.html:
 Added.
* LayoutTests/platform/glib/TestExpectations: Skip both, no USE(AUDIO_SESSION) 
support.
* Source/WebCore/html/MediaElementSession.h:
* Source/WebCore/platform/audio/AudioSession.cpp:
(WebCore::AudioSession::tryToSetActive): Count activations.
* Source/WebCore/platform/audio/AudioSession.h:
* Source/WebCore/platform/audio/MediaSessionManagerInterface.cpp:
(WebCore::MediaSessionManagerInterface::audioSessionActivationRequired const): 
Added.
(WebCore::MediaSessionManagerInterface::maybeActivateAudioSession): Use it.
* Source/WebCore/platform/audio/MediaSessionManagerInterface.h:
* Source/WebCore/platform/audio/PlatformMediaSessionInterface.h:
* Source/WebCore/testing/Internals.cpp:
(WebCore::Internals::systemAudioSessionActivationCount): Added.
* Source/WebCore/testing/Internals.h:
* Source/WebCore/testing/Internals.idl:
* Source/WebKit/GPUProcess/media/RemoteAudioSessionProxy.cpp:
(WebKit::RemoteAudioSessionProxy::systemActivationCountForTesting): Added.
* Source/WebKit/GPUProcess/media/RemoteAudioSessionProxy.h:
* Source/WebKit/GPUProcess/media/RemoteAudioSessionProxy.messages.in:
* Source/WebKit/WebProcess/GPU/media/RemoteAudioSession.cpp:
(WebKit::RemoteAudioSession::systemActivationCountForTesting): Added.
* Source/WebKit/WebProcess/GPU/media/RemoteAudioSession.h:

Canonical link: https://commits.webkit.org/319413@main



To unsubscribe from these emails, change your notification settings at 
https://github.com/WebKit/WebKit/settings/notifications

Reply via email to