video

block

Embeds a video — a local file or a YouTube/Vimeo/other URL — as a click-to-play facade that loads the real player on click.

video embeds a video on a page. The source is either a local file (typically .mp4, copied into _wdoc/ like an image) or a web URL — YouTube, Vimeo, or any other embeddable address. To keep a page light, a video first renders as a click-to-play facade (a poster thumbnail plus a play button); the real player loads only on click.

A local file

Give video a doc-relative path and an optional poster thumbnail. Set width to size it and title for an accessible label. wdoc never decodes a local video, so it can't auto-generate a thumbnail — supply a poster, or a plain play-button placeholder shows.

page about { sites = [:demo]
  video "assets/intro.mp4" {
    poster = "assets/intro-thumb.jpg"
    title  = "Product intro"
    width  = 640.0
  }
}

YouTube, Vimeo, and other embeds

A YouTube or Vimeo URL is recognised automatically and embedded as a privacy-respecting click-to-play iframe (YouTube derives its poster from the video id). Any other http(s) URL is embedded verbatim in an iframe; a URL ending in a video extension (.mp4, .webm) plays natively in a <video> element.

video "https://www.youtube.com/watch?v=aqz-KE-bpKQ" { title = "Trailer" }
video "https://vimeo.com/76979871" {
  poster = "assets/vimeo-thumb.jpg"   // Vimeo has no auto-thumbnail
  title  = "Our talk"
}

PDF output

A PDF can't play video, so wcl wdoc pdf renders the poster thumbnail and, for an online video only, a link to it.

Related

- image