Embed

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.js once, then write <vid2context-embed url="...">. It sizes itself to its content, turns the widget's messages into DOM events, and has seek(), search() and load() 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.

Start from
Video

Any video link vid2context understands. The widget fetches its context from the API when it loads.

A recorded context served by the site (zoo or gwagon). Needs no API call; good for trying layouts.

A VideoContext JSON file you host (for example from vid2context get <url> --format json). The host must allow CORS.

Base URL of another vid2context server, for example your own deployment. Empty means the server that serves the widget.

BCP-47 code of the transcript to prefer, for example en or pt-BR.

auto: captions first, then speech-to-text. captions, stt and video force one path.

Look

transcript: searchable timed transcript. chapters: the chapter list. quote: the lines between start and end. card: title, thumbnail and chapters. input: a link box that opens the vid2context app.

auto follows the reader’s system setting.

Hex color for highlights and buttons, without the #, for example 3b82f6.

Tighter spacing and smaller text.

Show

Show the title, channel and length.

YouTube only: show the video (youtube-nocookie.com) above the transcript, keep the current line in sync and seek on click. Off by default because it loads YouTube.

Show a timestamp before each line.

Filter the transcript as the reader types.

Copy the transcript, download it as text, SRT or JSON, or open the video in the vid2context app.

A small "Context by vid2context" link in the footer.

Time range

Show only lines from this time on. Also the start of a quote. Accepts 75, 1:15 or 1m15s.

Show only lines up to this time.

Size

Empty: the snippet uses a height that fits the view, and the web component resizes to its content.

Widget URLhttps://vid2context.com/embed/?sample=zoo

Drive it from the page

These buttons send the same postMessage commands your page can send.

Theme

Events from the widget

    Embed code

    HTML iframe
    <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>

    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.

    Transcript Searchable, with chapters as a second tab. Click a line to get a segment event.
    HTML
    <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>
    Chapters Only the chapter list, each one a link to that moment.
    HTML
    <iframe
      src="https://vid2context.com/embed/?sample=zoo&amp;view=chapters&amp;tools=0"
      title="Video chapters by vid2context"
      width="100%" height="360"
      style="border:0;border-radius:12px;max-width:720px"
      loading="lazy"
    ></iframe>
    Quote The lines between start and end, with a timed citation.
    HTML
    <iframe
      src="https://vid2context.com/embed/?sample=zoo&amp;view=quote&amp;start=5&amp;end=13"
      title="Video quote by vid2context"
      width="100%" height="240"
      style="border:0;border-radius:12px;max-width:720px"
      loading="lazy"
    ></iframe>
    Card Title, thumbnail and chapters, with a button to the full transcript. Loads the thumbnail from YouTube.
    HTML
    <iframe
      src="https://vid2context.com/embed/?sample=zoo&amp;view=card"
      title="Video summary by vid2context"
      width="100%" height="420"
      style="border:0;border-radius:12px;max-width:720px"
      loading="lazy"
    ></iframe>
    Link box A small form that opens any video in the vid2context app. Needs no video.
    HTML
    <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

    1. The iframe loads /embed/?url=<video> from this site (or from your own deployment).
    2. The widget calls GET /api/v1/context on the same server, so no CORS setup is needed. With sample it reads a recorded file instead, and with src it reads a VideoContext JSON you host.
    3. It renders the view with the text set as plain text, never as HTML, and posts ready, loaded and resize messages to your page.
    4. Clicks post segment messages. With player=1 on a YouTube video, the widget also follows playback and posts seek as 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.