fix(docs-infra): load cross-origin video embeds under COEP credential…#69205
Conversation
…less adev is cross-origin isolated (COOP same-origin + COEP require-corp) so the embedded WebContainer editor can use SharedArrayBuffer. Under require-corp the cross-origin YouTube iframe in `<docs-video>` only loaded in Chromium, leaving the player blank in Safari. Switch COEP from `require-corp` to `credentialless`. The page stays cross-origin isolated, so the editor keeps working, but cross-origin frames are now allowed to load, which restores the inline player in Safari as well.
|
Thanks for the pointer in #55310 (comment) this was exactly it @JeanMeche Relaxing the embedder policy to One gap remains: Firefox still blocks the embed, since it has no What do you think of this approach? I know it's a bit ugly but better than firefox error screen. Happy to adjust if you'd rather handle it differently. Screen.Recording.2026-06-06.at.11.27.41.mov |
|
Deployed adev-preview for f5ef068 to: https://ng-dev-previews-fw--pr-angular-angular-69205-adev-prev-3qr4dw1w.web.app Note: As new commits are pushed to this pull request, this link is updated after the preview is rebuilt. |
The fix works on my machine :) but didn't make it to the preview link. I think it might just be a stale deploy: |
|
It might be possible that the firebase config is not based on the content of the PR but from main directly (for security reasons), cc @josephperrott |
|
Indeed. |
|
Looks like this change didn't fix the issue. COEP is now credentialless but the iframe still doesn't load on firefox |
Yeah, as I mentioned here there's nothing we can do to make the YouTube embed work in Firefox directly. The facade-based fallback can handle that (a bit ugly, but better than nothing), I can open it as a separate follow-up if we're agreed on the approach. |
|
We can at least have a look at what you suggest :) |
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.
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.


adev is cross-origin isolated (COOP same-origin + COEP require-corp) so the embedded WebContainer editor can use SharedArrayBuffer. Under require-corp the cross-origin YouTube iframe in
<docs-video>only loaded in Chromium, leaving the player blank in Safari.Switch COEP from
require-corptocredentialless. The page stays cross-origin isolated, so the editor keeps working, but cross-origin frames are now allowed to load, which restores the inline player in Safari as well.PR Checklist
Please check to confirm your PR fulfills the following requirements:
PR Type
What kind of change does this PR introduce?
What is the current behavior?
adev sets
COOP: same-origin+COEP: require-corpon every response so theembedded WebContainer editor can use
SharedArrayBuffer. Underrequire-corp,the cross-origin YouTube iframe in
<docs-video>only loads in Chromium (viathe
credentiallessiframe attribute). In Safari the player is blank.What is the new behavior?
Switches COEP from
require-corptocredentiallessinadev/angular.jsonandadev/firebase.json. The page stays cross-origin isolated (the editor keepsworking), but cross-origin frames are now allowed to load, which fixes the
inline player in Safari as well as Chromium.
Does this PR introduce a breaking change?