fix(embed): rewrite video-host watch URLs to embeddable form#173
Merged
Conversation
* 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
Contributor
There was a problem hiding this comment.
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.