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
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
Video(src: "/media/editor-demo.mp4", captions: "/media/editor-demo.en.vtt").autoplay.muted.loop.playsinline.controls
Props
| Prop | Type | Unset | Meaning |
|---|---|---|---|
src: | String | none | The video's address |
controls: | Bool | false | The browser's playback controls; without them, |
autoplay: | Bool | false | Start playing when shown; browsers allow it only for a |
poster: | String | none: its first frame | The picture shown before it plays |
muted: | Bool | false | Start with the sound off. Written as a flag, |
loop: | Bool | false | Start again when it ends. Written as a flag, |
playsinline: | Bool | false | Play where it sits on a phone, rather than full screen. Written as a flag, |
captions: | String | none | A WebVTT file of captions, which becomes a default |
width: | Number | none: the video's own | The player's |
height: | Number | none: the video's own | The player's |
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.
| Event | Sends | Meaning |
|---|---|---|
on play | DOM | A video or audio started playing |
on pause | DOM | A video or audio paused |
on ended | DOM | A video or audio reached its end |
on timeupdate | DOM | A 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.
Codes this can raise
These controls list the props' cases; the example below shows them written.