← All scene elements
SCENE ELEMENT / 04

Video

Video, streams and camera feeds with lifecycle events.

LIVE WEB PLAYER

See it respond.

The same raylib runtime, compiled to WebAssembly. Load this example, inject MQTT messages and watch its published events.

Loading WebAssembly…
MQTT I/O
Waiting for runtime…

The browser requires a user action before the scene is loaded. Click Load demo scene first. MQTT is emulated and never leaves this page. Shaders are disabled in the web build; GPIO is hardware-only.

LibVLC-backed video, camera or stream rendered into a Raylib texture.

Configuration

FieldDescription
typevideo
fileAsset filename, URL, or /dev/video… device
pos, sizeOutput rectangle; omitted height can follow aspect ratio
loopRestart after end
audioEnable video audio
deviceTreat file as a capture device path
release_on_finishRelease player resources after one-shot playback
on_play, on_stop, on_finishAction chains

Copy-and-paste JSON

json
{
  "type": "video",
  "id": "intro_video",
  "pos": [0, 0],
  "size": [1920, 1080],
  "file": "intro.mp4",
  "loop": false,
  "audio": true,
  "release_on_finish": true,
  "on_finish": "home.switchto",
  "layer": 0
}

MQTT

text
ergs/rpi01/cmd/intro_video/play          ON
ergs/rpi01/cmd/intro_video/play          OFF
ergs/rpi01/cmd/intro_video/file          next_video.mp4
ergs/rpi01/cmd/intro_video/open          next_video.mp4
ergs/rpi01/cmd/intro_video               PLAY

Published:
ergs/rpi01/status/intro_video/event       on_finish
ergs/rpi01/status/intro_video/state       finished    (retained)
ergs/rpi01/event/intro_video/on_finish    ON