Skip to content

fix(docs-infra): use a facade for docs-video to fix Firefox embeds#69298

Open
erkamyaman wants to merge 1 commit into
angular:mainfrom
erkamyaman:docs-video-facade-fallback
Open

fix(docs-infra): use a facade for docs-video to fix Firefox embeds#69298
erkamyaman wants to merge 1 commit into
angular:mainfrom
erkamyaman:docs-video-facade-fallback

Conversation

@erkamyaman

@erkamyaman erkamyaman commented Jun 10, 2026

Copy link
Copy Markdown
Contributor

Follow-up to #69205. After switching adev's COEP to credentialless, the
cross-origin YouTube iframe in <docs-video> loads in Chromium and Safari but
not Firefox, whose credentialless policy does not extend to nested frames. The
result was a COEP error screen instead of the player.

Render <docs-video> as a lightweight thumbnail facade instead of embedding the
iframe directly. The thumbnail is a cross-origin subresource, so it loads under
credentialless in every browser. DocViewer then upgrades the facade to the
inline player on hydration in browsers that can load the embed (Chromium,
Safari), preserving the previous behavior there. On Firefox the facade stays a
plain link that opens the video on YouTube (with autoplay), which replaces the
error screen.

The thumbnail uses maxresdefault and falls back to hqdefault when a video
has no max-resolution image.

PR Checklist

Please check to confirm your PR fulfills the following requirements:

PR Type

What kind of change does this PR introduce?

  • Bugfix
  • Feature
  • Code style update (formatting, local variables)
  • Refactoring (no functional changes, no api changes)
  • Build related changes
  • CI related changes
  • Documentation content changes
  • angular.io application / infrastructure changes
  • Other... Please describe:

What is the current behavior?

Follow-up to #69205 (see also #55310). adev is cross-origin isolated with
COEP: credentialless. The cross-origin YouTube iframe in <docs-video> loads
in Chromium and Safari, but Firefox's credentialless policy does not cover
nested frames, so the embed is blocked and the reader sees a COEP error screen
instead of the video.

What is the new behavior?

<docs-video> now renders a lightweight thumbnail facade (a YouTube poster
image plus a play button) rather than embedding the iframe directly:

  • The thumbnail is a cross-origin subresource, so it loads under
    credentialless in every browser, including Firefox.
  • On hydration, DocViewer swaps the facade for the inline iframe in browsers
    that can load the embed (Chromium, Safari), using the same iframe attributes
    as before, so their behavior is unchanged.
  • On Firefox the facade remains a link that opens the video on YouTube (with
    autoplay=1), replacing the error screen.
  • The thumbnail requests maxresdefault and falls back to hqdefault when a
    video lacks a max-resolution image.

Does this PR introduce a breaking change?

  • Yes
  • No

Follow-up to angular#69205. After switching adev's COEP to `credentialless`, the
cross-origin YouTube iframe in `<docs-video>` loads in Chromium and Safari but
not Firefox, whose `credentialless` policy does not extend to nested frames. The
result was a COEP error screen instead of the player.

Render `<docs-video>` as a lightweight thumbnail facade instead of embedding the
iframe directly. The thumbnail is a cross-origin subresource, so it loads under
`credentialless` in every browser. `DocViewer` then upgrades the facade to the
inline player on hydration in browsers that can load the embed (Chromium,
Safari), preserving the previous behavior there. On Firefox the facade stays a
plain link that opens the video on YouTube (with autoplay), which replaces the
error screen.

The thumbnail uses `maxresdefault` and falls back to `hqdefault` when a video
has no max-resolution image.
@pullapprove pullapprove Bot requested a review from MarkTechson June 10, 2026 20:49
@angular-robot angular-robot Bot added the area: docs-infra Angular.dev application and infrastructure label Jun 10, 2026
@ngbot ngbot Bot added this to the Backlog milestone Jun 10, 2026
@erkamyaman

Copy link
Copy Markdown
Contributor Author

could you please run the preview tests? @JeanMeche

@github-actions

Copy link
Copy Markdown

Deployed adev-preview for 1eb3fc1 to: https://ng-dev-previews-fw--pr-angular-angular-69298-adev-prev-twsgdov0.web.app

Note: As new commits are pushed to this pull request, this link is updated after the preview is rebuilt.

}

private setupVideoFacades(element: HTMLElement): void {
const isFirefox = /firefox/i.test(this.document.defaultView?.navigator.userAgent ?? '');

@SkyZeroZx SkyZeroZx Jun 11, 2026

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

NIT:
We can use isFirefox from

export const isFirefox =
typeof window !== 'undefined' && window.navigator.userAgent.includes('Firefox/');

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

adev: preview area: docs-infra Angular.dev application and infrastructure

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants