Embed vid2context on your site
Any page can show what vid2context knows about a video: the transcript with timestamps, the chapters, a quoted passage with its time, or a small card. The widget is a page on this site, /embed/, made to live in an iframe. It reads its options from the address, fetches the video's context from the API, and renders it in your theme. Nothing to install and no key.
There are three ways to embed it:
- An iframe. Paste the HTML. Works anywhere that accepts an iframe: WordPress, Notion, Ghost, Webflow, plain HTML.
- The web component. Add
/embed.jsonce, then write<vid2context-embed url="...">. It sizes itself to its content, turns the widget's messages into DOM events, and hasseek(),search()andload()methods. - A link. Where iframes are not allowed (a GitHub README, an email), link to the widget address. It works as a page on its own.
Build an embed
Change any option and the preview, the widget address and the code update at once. The preview is the real widget, so clicking a line in it sends the events listed under it, and the buttons under Drive it from the page send the commands your page can send. Copy link to this setup gives you an address that reopens the builder with the same options.
Live preview
Open the widget aloneWidget URLhttps://vid2context.com/embed/?sample=zoo
Drive it from the page
These buttons send the same postMessage commands your page can send.
Events from the widget
Embed code
<iframe
src="https://vid2context.com/embed/?sample=zoo"
title="Video transcript by vid2context"
width="100%" height="480"
style="border:0;border-radius:12px;max-width:720px"
loading="lazy"
></iframe><script src="https://vid2context.com/embed.js" async></script>
<vid2context-embed
sample="zoo"
></vid2context-embed><div id="video-context"></div>
<script src="https://vid2context.com/embed.js"></script>
<script>
const widget = Vid2Context.embed('#video-context', {
sample: "zoo",
});
widget.addEventListener('vid2context:loaded', (e) => console.log(e.detail.title));
widget.addEventListener('vid2context:segment', (e) => console.log(e.detail.startSec, e.detail.text));
</script>export function VideoContext() {
return (
<iframe
src="https://vid2context.com/embed/?sample=zoo"
title="Video transcript by vid2context"
width="100%"
height={480}
style={{ border: 0, borderRadius: 12, maxWidth: 720 }}
loading="lazy"
/>
);
}[Transcript and chapters on vid2context](https://vid2context.com/embed/?sample=zoo)The builder starts from a recorded sample, so the preview works without calling the API. Switch the source to Video URL to try a real video: the widget then calls GET /api/v1/context on this site. YouTube sometimes blocks cloud servers; when a video fails here, the widget shows the error and a link to the app, and the same embed pointed at your own server (the api option) will usually work.
What each view looks like
These are live widgets, each one an iframe with the snippet under it.
<iframe
src="https://vid2context.com/embed/?sample=zoo"
title="Video transcript by vid2context"
width="100%" height="480"
style="border:0;border-radius:12px;max-width:720px"
loading="lazy"
></iframe><iframe
src="https://vid2context.com/embed/?sample=zoo&view=chapters&tools=0"
title="Video chapters by vid2context"
width="100%" height="360"
style="border:0;border-radius:12px;max-width:720px"
loading="lazy"
></iframe><iframe
src="https://vid2context.com/embed/?sample=zoo&view=quote&start=5&end=13"
title="Video quote by vid2context"
width="100%" height="240"
style="border:0;border-radius:12px;max-width:720px"
loading="lazy"
></iframe><iframe
src="https://vid2context.com/embed/?sample=zoo&view=card"
title="Video summary by vid2context"
width="100%" height="420"
style="border:0;border-radius:12px;max-width:720px"
loading="lazy"
></iframe><iframe
src="https://vid2context.com/embed/?view=input"
title="Get video context with vid2context"
width="100%" height="120"
style="border:0;border-radius:12px;max-width:720px"
loading="lazy"
></iframe>How it works
- The iframe loads
/embed/?url=<video>from this site (or from your own deployment). - The widget calls
GET /api/v1/contexton the same server, so no CORS setup is needed. Withsampleit reads a recorded file instead, and withsrcit reads a VideoContext JSON you host. - It renders the view with the text set as plain text, never as HTML, and posts
ready,loadedandresizemessages to your page. - Clicks post
segmentmessages. Withplayer=1on a YouTube video, the widget also follows playback and postsseekas the current line changes.
The widget makes no third-party request unless you ask for one: player=1 loads the YouTube player from youtube-nocookie.com, and the card view loads the video's thumbnail.
Next
- Embed parameters: Every option of the vid2context embed widget, as a query parameter of /embed/ or an attribute of vid2context-embed, with defaults, accepted values and examples.
- The web component and postMessage API: Use the vid2context-embed element and Vid2Context.embed(), listen for loaded, segment and seek events, and drive the widget with seek, search, theme and load commands over postMessage.
- Embed in WordPress, Notion, React and more: Step-by-step embedding of the vid2context widget in WordPress, Notion, Ghost, Webflow, Squarespace, React, Next.js, Vue, Svelte, Docusaurus and Markdown, plus serving the widget from your own deployment.