web: send origin referrer on YouTube embeds so playback isn't blocked (error 153) (#280)
YouTube now rejects embeds whose requests carry no Referer header, and the
app-wide Referrer-Policy is no-referrer — so every auto-embed failed with
error 153 ("Video player configuration error"). Override the policy on the
embed iframe only, with referrerpolicy=origin: YouTube sees which site is
embedding, but never the page path.
Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
2 files changed,
+5
−0
changelog/2026-07-07-youtube-embed-fix.md+1 −0web/static/apps/chat.js+4 −0
diff --git a/changelog/2026-07-07-youtube-embed-fix.md b/changelog/2026-07-07-youtube-embed-fix.md| new file mode 100644 |
| index 0000000..071461f |
| --- /dev/null |
| +++ b/changelog/2026-07-07-youtube-embed-fix.md |
| @@ -0,0 +1 @@ |
| +🤖 YouTube videos play in chat again — tapping a video no longer shows YouTube's "Video player configuration error". (YouTube started requiring embeds to say which site they're playing on; we now tell it just the site's address, nothing about your conversation.) |
diff --git a/web/static/apps/chat.js b/web/static/apps/chat.js| index 30364bc..25fb3ba 100644 |
| --- a/web/static/apps/chat.js |
| +++ b/web/static/apps/chat.js |
| @@ -2070,6 +2070,10 @@ function buildYouTubeCard(yt) { |
| frame.src = `https://www.youtube-nocookie.com/embed/${yt.id}?autoplay=1&rel=0` + (yt.start ? `&start=${yt.start}` : ""); |
| frame.allow = "autoplay; encrypted-media; fullscreen; picture-in-picture"; |
| frame.allowFullscreen = true; |
| + // The app-wide Referrer-Policy is no-referrer, but YouTube rejects |
| + // referrer-less embeds (error 153, "Video player configuration error"). |
| + // Send just the origin for this iframe -- never the page path. |
| + frame.referrerPolicy = "origin"; |
| frame.title = "YouTube video"; |
| btn.replaceWith(frame); |
| }; |