Apps

Video

# Video Player — FFmpeg Video Playback A panelized video player app powered by the `deft/ffmpeg` stdext package. Launch it from the app launcher (or `[tui/launch <panel> "video" "packages/video/src/video.dft"]`). The current frame renders over the panel's content area while playing — a refreshed GL texture on retro, half-block cells on retra — with the panel title bar (and the menu labels) visible above it and the app underneath keeping keyboard focus. The panel body shows a status line when idle (before first play / after stop). Playback loops from the start when the file ends. Files with an audio track play their soundtrack too (retro / hydra — retra has no audio): the decode worker resamples to S16 stereo and the player feeds an `audio/stream-*` sink, with the same pause / stop keys and file picking driving both tracks. ## Using the app | Action | Menu | Shortcut | |--------|------|----------| | Open a video (file picker) | File → Open… | `Ctrl+O` or `o` | | Start / resume playback | Playback → Start | `p` | | Pause / resume | Playback → Pause/Resume | `p` | | Stop | Playback → Stop | `Esc` | `p` is the universal play key — it starts the loaded file from idle, pauses while playing, and resumes while paused. Picking a file starts playback immediately. Stopping keeps the loaded file — `p` replays it. ## Build Requirement Build with FFI support (decoding dlopens the system libav* libraries at runtime — no build-time FFmpeg linking): ``` mk video # = zig build tui -Dtarget=native -Dnanosvg=true -Dffi=true ```` plus the FFmpeg runtime libraries installed (Fedora: `libavformat-free`; Debian/Ubuntu: `libavformat61` etc.). Without FFI or libav the app still runs and shows an error status line. ## Programmatic playback The player is the `deft/ffmpeg` package API — usable from any panel or the workspace console (F12):
import "deft/ffmpeg" as ffmpeg
set p [ffmpeg/play "/path/clip.mp4"]
[ffmpeg/pause $p]  [ffmpeg/resume $p]  [ffmpeg/seek $p 30]
echo [ffmpeg/position $p]  # seconds
[ffmpeg/stop $p]
See `stdext/src/ffmpeg/help.md` for the full API and architecture.