Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: d508119d994616594fe47743ef05b3d3f642b51d
      
https://github.com/WebKit/WebKit/commit/d508119d994616594fe47743ef05b3d3f642b51d
  Author: Phinehas Fuachie <[email protected]>
  Date:   2026-06-26 (Fri, 26 Jun 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/HTMLMediaElement.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:
  -----------
  Lens: video.play() injected from a 'pause' handler bypasses user-gesture 
pause in fullscreen
https://bugs.webkit.org/show_bug.cgi?id=317617
rdar://178769976

Reviewed by Jer Noble.

Some third-party WKWebView hosts (e.g. visionOS Lens) inject a user Script that 
listens for the
'pause' event on <video> and synchronously re-calls video.play() to keep media 
going while the
host's "in focus" flag is true. Because the pause event fires inside the user's 
click on YouTube's
pause control, the synthetic play() inherits the same transient activation 
token — so existing
user-gesture gates do not reject it. The result: tapping pause in YouTube 
fullscreen on Lens does
nothing, audio keeps playing after the app is closed, and Control Center pause 
is overridden on the
next event tick.

Add a YouTube-only fullscreen quirk that denies HTMLMediaElement::play() when 
the page is in element
fullscreen and either no user gesture is active, or a JS-driven pause() ran 
within the last 500ms —
i.e. the play() is the rebound from the user's pause and not a fresh user 
intent. HTMLMediaElement
records the timestamp of each scripted pause() so MediaElementSession can 
consult it from the
playback-state gate.

* Source/WebCore/html/HTMLMediaElement.cpp:
(WebCore::HTMLMediaElement::pause):
* Source/WebCore/html/HTMLMediaElement.h:
(WebCore::HTMLMediaElement::lastUserPauseTime const):
* Source/WebCore/html/MediaElementSession.cpp:
(WebCore::MediaElementSession::playbackStateChangePermitted const):
* Source/WebCore/page/Quirks.cpp:
* Source/WebCore/page/Quirks.h:
* Source/WebCore/page/QuirksData.h:

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



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

Reply via email to