Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: f98aa5dda9080082a0bcaa04f99b6f26c6065627
      
https://github.com/WebKit/WebKit/commit/f98aa5dda9080082a0bcaa04f99b6f26c6065627
  Author: Jer Noble <[email protected]>
  Date:   2026-05-09 (Sat, 09 May 2026)

  Changed paths:
    M Source/WebCore/Modules/mediasession/MediaSession.cpp
    M Source/WebCore/Modules/mediasession/MediaSession.h
    M Source/WebCore/Modules/modern-media-controls/media/YouTubeCaptionQuirk.js

  Log Message:
  -----------
  [Cocoa] YouTube caption button flickers and spins main thread at 100%
rdar://175983249
https://bugs.webkit.org/show_bug.cgi?id=314464

Reviewed by Eric Carlson.

The YouTube Captions quirk set up a bi-directional communications channel
between the MediaAccessibility framework and YouTube: when MA settings enabled
captions, WebKit would send a command to YouTube to enable their captions, and
when YouTube enabled their own captions, it would notify WebKit which would set
the MA setting to enable captions. Unfortunately in certain degenerate cases 
this
would set up a neverending storm of enable and disable commands between MA
(mediated by WebKit) and YouTube.

In order to break this cycle, WebKit will tell YouTube to enable captions 
whenever
MA caption settings change, but enabling or disabling YouTube captions will not
update MA settings. However, to ensure that the caption menu reflects current
MA settings when in native fullscreen modes, WebKit will enable YouTube captions
when entering Fullscreen or PiP, if MA is set to prefer captions. This has the
effect of enabling captions when entering fullscreen modes even if those 
captions
were not enabled by YouTube during inline modes, if the user prefers "always on"
captions.

* Source/WebCore/Modules/mediasession/MediaSession.cpp:
(WebCore::m_coordinator):
(WebCore::MediaSession::captionPreferencesChanged):
(WebCore::MediaSession::setCaptionTracks):
(WebCore::MediaSession::setCaptionsEnabled):
(WebCore::MediaSession::presentationModeChanged):
* Source/WebCore/Modules/mediasession/MediaSession.h:
* Source/WebCore/Modules/modern-media-controls/media/YouTubeCaptionQuirk.js:
(CaptionMirror.prototype._handlePresentationModeChanged):

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



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

Reply via email to