Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 0aac2890d97a1df4cdd532d02b415d4f7cadc7f6
      
https://github.com/WebKit/WebKit/commit/0aac2890d97a1df4cdd532d02b415d4f7cadc7f6
  Author: Jean-Yves Avenard <[email protected]>
  Date:   2026-07-14 (Tue, 14 Jul 2026)

  Changed paths:
    M Source/WebCore/dom/Document.cpp
    M Source/WebCore/dom/Document.h
    M Source/WebCore/html/MediaElementSession.cpp
    M Source/WebCore/page/Quirks.cpp
    M Source/WebCore/page/Quirks.h
    M Source/WebCore/page/QuirksData.h

  Log Message:
  -----------
  open.spotify.com: returning to Home auto-plays multiple song previews / 
overlapping audio in Safari
https://bugs.webkit.org/show_bug.cgi?id=319271
rdar://179910591

Reviewed by Jer Noble.

Spotify start several audio elements at once when navigating within the page
(e.g. returning to a landing view). Each play() is authorized by the transient
user activation produced by the navigation click: that
activation is
document-scoped and stays valid for several seconds, so every play() issued
during the window is permitted no matter how many elements are involved. The
result is several tracks playing on top of each other.

Add a site quirk, ShouldBlockAudiblePlaybackWhileAudioIsPlaying, that denies an
audible element from starting while another element in the same document is
already playing audio, unless a user gesture is being directly processed (so
deliberately choosing a track is unaffected). Enable it for open.spotify.com.

To distinguish a directly-processed gesture from transient activation, add
Document::mediaUserGestureReason(), reporting which branch of
processingUserGestureForMedia() authorized playback; the latter is refactored to
use it and is otherwise unchanged.

* Source/WebCore/dom/Document.cpp:
(WebCore::Document::processingUserGestureForMedia const):
(WebCore::Document::mediaUserGestureReason const):
* Source/WebCore/dom/Document.h:
*
Source/WebCore/html/MediaElementSession.cpp:
(WebCore::mediaGestureReasonString):
(WebCore::MediaElementSession::playbackStateChangePermitted const):
* Source/WebCore/page/Quirks.cpp:
(WebCore::Quirks::shouldBlockAudiblePlaybackWhileAudioIsPlaying const):
(WebCore::handleSpotifyQuirks):
* Source/WebCore/page/Quirks.h:
* Source/WebCore/page/QuirksData.h:

Canonical link: 
https://flagged.apple.com:443/proxy?t2=Dt8M4K9ud5&o=aHR0cHM6Ly9jb21taXRzLndlYmtpdC5vcmcvMzE3MTU5QG1haW4=&emid=d4074331-3668-4578-bb1d-171df0b15a40&c=11



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

Reply via email to