Skip to content

Block 24 of 297

Video Embed

Paste a YouTube or Vimeo link for a lazy-loaded, privacy-friendly player with caption and transcript link.

Puck key
VideoEmbedBlock
Export
videoEmbedBlock
React component
<VideoEmbed />
Path
components/puck/video-embed-block.tsx
Dependencies
None
License
MIT

About this block

When to use it, how to write for it, and what to change in the code.

What it's for

Paste a YouTube or Vimeo link and the block builds a privacy-friendly player: YouTube plays from youtube-nocookie.com and Vimeo with do-not-track on. The iframe lazy-loads, can start at a set time, and sits in a figure with an optional caption and transcript link. Pick from four shapes, including vertical for phone video, which renders narrower and centered.

  • A project story or time-lapse on a capital project page
  • A short explainer video on a program or donate page
  • Recorded public meetings or event highlights
Writing the content
  • Paste the link from the browser bar or the Share button. Watch, share, Shorts and embed URLs all work; other hosts show a placeholder instead.
  • Always fill in Video title (required) with a description of the video, not just "Video".
  • Set Shape to match the source so there are no black bars, and use Start at with values like 1:30 or 90.
  • Add a transcript page and fill in Transcript link text; it helps anyone who can't play audio.
Accessibility
  • The iframe gets its title from the Video title field, falling back to the heading, so screen readers can name the player (WCAG 4.1.2).
  • The caption and transcript link sit in a figcaption tied to the player. A transcript link supports text alternatives for media, but captions themselves must come from the video host (WCAG 1.2.2).
  • Nothing autoplays from the block, and the transcript link has a visible focus outline at 44px minimum height.
Customizing the code
  • Shapes map to classes in aspectClass; vertical video is limited to max-w-sm.
  • URL parsing lives in toEmbed; add another host there if you need one, keeping the privacy parameters rel=0 and dnt=1.

Editor fields

What content editors see in the P1 sidebar when they select this block.

  • Headingtext
  • Heading levelselect
  • Introtextarea
  • YouTube or Vimeo linktext
  • Video title (required)text
  • Shapeselect
  • Start attext
  • Captiontextarea
  • Transcript link texttext
  • Transcript linktext