Skip to content

fix(embed): rewrite video-host watch URLs to embeddable form#173

Merged
inkeep-oss-sync[bot] merged 1 commit into
mainfrom
copybara/sync
Jun 17, 2026
Merged

fix(embed): rewrite video-host watch URLs to embeddable form#173
inkeep-oss-sync[bot] merged 1 commit into
mainfrom
copybara/sync

Conversation

@inkeep-oss-sync

Copy link
Copy Markdown
Contributor

No description provided.

* fix(embed): rewrite video-host watch URLs to embeddable form

The `<Embed>` iframe failed for YouTube / Vimeo / Loom because the
user-facing URLs (`youtube.com/watch?v=…`, `vimeo.com/<id>`,
`loom.com/share/<id>`) all refuse to be framed via `X-Frame-Options:
SAMEORIGIN`. Agents picked `<Embed>` over `<video>` (the canonical
shape) and shipped blank panes; authors who pasted the URL bar's
copy hit the same wall.

Three coordinated changes:

1. `rewriteEmbedUrl` helper in core — maps watch/share URLs to their
   frame-embeddable counterparts (YouTube `/watch?v=ID` → `/embed/ID`,
   Vimeo `/ID` → `player.vimeo.com/video/ID`, Loom `/share/ID` →
   `/embed/ID`). Preserves timestamps + nocookie host; returns input
   unchanged for everything else (non-video URLs, malformed input,
   non-http(s) schemes — the existing scheme gate still owns those).
   20 unit tests covering every recognized shape + passthrough.

2. `<Embed>` calls the rewriter before the iframe `src`. The
   descriptor's `src` prop still holds the original URL; only the
   in-flight iframe `src` changes, so markdown round-trip is
   untouched. When the rewriter changed the URL we also switch
   `referrerPolicy` from `no-referrer` to `strict-origin-when-cross-origin`
   so YouTube's embed allowlist accepts the iframe (otherwise it
   returns "Error 153 — Video player configuration error"). The
   hash-routed editor path is still stripped from `Referer` by spec
   so the doc path doesn't leak. Mirrors what `react-lite-youtube-embed`
   does inside the `<video>` block.

3. `Embed` descriptor `description` now steers agents toward
   `<video src="…">` for YouTube / Vimeo / Loom URLs (it routes
   through the lite-embed facade, handles autoplay heuristics, and
   exposes player props). `<Embed>` still works for video URLs via
   the auto-rewrite; the steering nudges the canonical shape without
   leaving the non-canonical path broken.

* chore(inventory-footer): bump budget to 3.5KB for the Embed→video steer

The PRD-7069 fix added Embed→video-block routing guidance to the
`Embed` descriptor's description so agents prefer `<video>` over
`<Embed>` for YouTube/Vimeo/Loom URLs. The widening pushed the
projected inventory footer from ~3K to ~3.2K — over the 3072-byte
test budget. Raise to 3584 (matches the existing comment shape
that allowed the fenced-code-block guidance).

The inventory footer is unbounded read-once data the agent ingests
when authoring; an extra ~400 bytes for the new routing rule is
in proportion to the user-facing payoff.

GitOrigin-RevId: 285bcd2a4f0f8ce58479a9de87b0a4294d43211a

@inkeep-internal-ci inkeep-internal-ci Bot left a comment

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.

Automated approval from agents-private public-mirror-sync (run: https://github.com/inkeep/agents-private/actions/runs/27656159287). Source of truth is the monorepo; direct edits on inkeep/open-knowledge are overwritten on next sync.

@inkeep-oss-sync inkeep-oss-sync Bot merged commit 5812bfa into main Jun 17, 2026
2 checks passed
@inkeep-oss-sync inkeep-oss-sync Bot deleted the copybara/sync branch June 17, 2026 00:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant