Skip to content

Commit f1dfb34

Browse files
Phinehas FuachiePhinehas Fuachie
authored andcommitted
[visionOS][Quirk] Duplicate YouTube captions after undocking from system environment fullscreen
https://bugs.webkit.org/show_bug.cgi?id=316035 rdar://178235422 Reviewed by Jer Noble. YouTubeCaptionQuirk.js has a strict-mode syntax error (cue.positionAlign = = 'center';) that prevents the script from loading, so the in-page caption mirror has been inactive in native fullscreen and PIP on every platform. On visionOS the script is further hobbled because VideoPresentationModeAPIEnabled is off by default, so video.webkitPresentationMode reads as undefined. The script never sees the transition back to inline on undock, leaves the mirror text track showing with stale cues, and those cues overlap YouTube's restored in-page captions. Rather than enable VideoPresentationModeAPIEnabled on visionOS (which would also expose webkitSetPresentationMode and let pages programmatically request PIP on a platform that doesn't support it), feature-detect the property and fall back to the always-exposed read-only video.webkitDisplayingFullscreen on visionOS. * Source/WebCore/Modules/modern-media-controls/media/YouTubeCaptionQuirk.js: (CaptionMirror.prototype._syncCues): (CaptionMirror.prototype._getIsInline): (CaptionMirror.prototype._handlePresentationModeChanged): Canonical link: https://commits.webkit.org/314345@main
1 parent d06ccb1 commit f1dfb34

1 file changed

Lines changed: 8 additions & 2 deletions

File tree

Source/WebCore/Modules/modern-media-controls/media/YouTubeCaptionQuirk.js

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@
110110
break;
111111
default:
112112
cue.align = 'center';
113-
cue.positionAlign = = 'center';
113+
cue.positionAlign = 'center';
114114
}
115115
var topPercent = parseFloat(captionWindow.style.top);
116116
var bottomPercent = parseFloat(captionWindow.style.bottom);
@@ -162,8 +162,14 @@
162162
});
163163
}
164164

165+
_getIsInline() {
166+
if (typeof this._video.webkitPresentationMode === 'undefined')
167+
return !this._video.webkitDisplayingFullscreen;
168+
return this._video.webkitPresentationMode == 'inline';
169+
}
170+
165171
_handlePresentationModeChanged() {
166-
if (this._video.webkitPresentationMode == 'inline') {
172+
if (this._getIsInline()) {
167173
this._mirrorTrack.mode = 'hidden';
168174
return;
169175
}

0 commit comments

Comments
 (0)