Video
<video> plays a local file or a remote URL through the platform’s own media stack: AVPlayerView
and AVPlayer on macOS, GtkVideo on GTK. No engine is bundled, same as <webview> and the
Audio API.
const [src, setSrc] = useState("/Users/me/clip.mp4");
<video src={src} controls loop style={{ vexpand: true }} />;| Prop | Type | Applied | Notes |
|---|---|---|---|
src |
string | createAndUpdate | A local path or a remote URL. |
autoplay |
bool | create | Default false. |
loop |
bool | createAndUpdate | Default false. |
controls |
bool | create | Default true. Takes effect on macOS only, see below. |
There are no events yet (onEnded, onTimeUpdate, onError). For playback state, track it
against the Audio API’s richer event set.
Platform notes
Section titled “Platform notes”controlstakes effect on macOS only.AVPlayerViewtoggles its overlaid transport controls from the prop;GtkVideo’s overlaid controls have no such toggle and always show. The prop is accepted and typed on both backends.- GTK needs a media backend installed.
GtkVideorenders through GTK’s pluggable media-file backend, for examplegtk4-media-gstreamer, which some distros package separately from GTK. With none installed,<video>shows a placeholder label reading “Video unavailable (GTK media module not installed)” and logsND_WARN Video unavailable, the same degrade path<webview>takes whenwebkitgtkis missing. - macOS has no such dependency.
AVPlayerViewis a system framework.
See examples/gallery/main.tsx’s Video tab, which swaps src between a bundled sample clip and
whatever file openFile() (see Dialogs) returns.