Reference

Video

Video player. Without captions it draws an A09 warning: a video nobody can hear is a video nobody can follow.

Video(src: String, controls: Bool, autoplay: Bool, …)

Before 5.0

controls

autoplay

muted

loop

No preview for this one: the example below shows how it is written.

Example

wf

Video(src: "/media/launch.mp4", poster: "/og.png", captions: "/media/launch.en.vtt", width: 1280, height: 720).controls.playsinline

A silent loop in place of a GIF

wf

Video(src: "/media/editor-demo.mp4", captions: "/media/editor-demo.en.vtt").autoplay.muted.loop.playsinline.controls

Props

Props of Video
PropTypeUnsetMeaning

src:

String

none

The video's address

controls:

Bool

false

The browser's playback controls; without them, A09. Written as a flag, .controls, or controls: true.

autoplay:

Bool

false

Start playing when shown; browsers allow it only for a .muted video. Written as a flag, .autoplay, or autoplay: true.

poster:

String

none: its first frame

The picture shown before it plays

muted:

Bool

false

Start with the sound off. Written as a flag, .muted, or muted: true.

loop:

Bool

false

Start again when it ends. Written as a flag, .loop, or loop: true.

playsinline:

Bool

false

Play where it sits on a phone, rather than full screen. Written as a flag, .playsinline, or playsinline: true.

captions:

String

none

A WebVTT file of captions, which becomes a default <track kind="captions">; without it, A09

width:

Number

none: the video's own

The player's width in px

height:

Number

none: the video's own

The player's height in px

Attribute families: global, aria, data, media. Plus the 22 universal props every element takes: animate:, exit:, speed:, duration:, delay:, easing:, stagger:, on:, count:, shared:, class:, ref:, drag:, dragGroup:, dropValue:, dropAxis:, dropInside:, roving:, trapFocus:, mount:, update:, cleanup:.

Flags and cases

A flag is written after the parentheses with a dot: a Bool prop, or a case of one of the element's enum props. A case the enum lacks is an error with a hint.

.controls

.autoplay

.muted

.loop

.playsinline

Events

The DOM events it is drawn to answer. Any other DOM event works too, in an on … { } handler.

DOM events Video answers
EventSendsMeaning
on playDOMA video or audio started playing
on pauseDOMA video or audio paused
on endedDOMA video or audio reached its end
on timeupdateDOMA playing video or audio moved on

Every element also takes the props, the events and the attribute families listed on every element.

Slots

It takes no slots.

Renders with the class wf-video, stable across releases, so a stylesheet may target it.

These controls list the props' cases; the example below shows them written.