Commit c3ffeba
authored
[bugfix] Restore video playback after view-transition navigation on comfy.org (#15010)
## Summary
A recent Chrome update broke every `<video>`/`<audio>` on comfy.org when
the page is reached via Astro `<ClientRouter />` soft navigation (e.g.
/learning → a tutorial watch page): the router parses the incoming page
with DOMParser into an inert document where the media stack is never
initialised, so swapped-in media reports `MEDIA_ERR_SRC_NOT_SUPPORTED`
("no supported sources") despite a valid `src`. Hard refresh works; any
client-side navigation does not.
## Changes
- **What**: Add `reifyMediaElements()` (mirrors unreleased upstream fix
withastro/astro#17603) that replaces swapped-in media elements with
fresh `document.createElement()` copies, run on `astro:after-swap` in
`BaseLayout.astro` — synchronously before Vue island hydration, so
`VideoPlayer.vue` hydrates onto the live elements. Also copies the
`muted` property across (`setAttribute('muted')` only sets
`defaultMuted`), without which muted autoplay loops stay blocked;
upstream's fix has this gap. Unit tests cover attribute/child/muted
copying and element position.
- **Removal path**: Delete once Astro ships a release containing
withastro/astro#17603 (not in 7.2.0; no 6.x backport).
## Review Focus
- Timing: `astro:after-swap` fires synchronously after the swap, before
island hydration microtasks run, so Vue never binds to the stale
elements. Verified in Chromium: watch-page autoplay + custom controls,
and home-page scroll-triggered loops all behave identically to a hard
load after soft navigation.1 parent 36aec4a commit c3ffeba
3 files changed
Lines changed: 89 additions & 0 deletions
File tree
- apps/website/src
- layouts
- scripts
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
198 | 198 | | |
199 | 199 | | |
200 | 200 | | |
| 201 | + | |
201 | 202 | | |
202 | 203 | | |
203 | 204 | | |
| |||
213 | 214 | | |
214 | 215 | | |
215 | 216 | | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
216 | 222 | | |
217 | 223 | | |
218 | 224 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
0 commit comments