Repository navigation
Ariadne: video:/audio: in the browser pages through <video>/<audio> (media M6, stacked on #935) - #936
Merged
Merged
Conversation
added 30 commits
October 30, 2026 22:24
An image: whose src (or bound value, or computed expression) is a URI now
loads that picture: http(s) through the host's network policy, with
auth: NAME sending the host's credential on the http verbs' terms; file://
relative to the document. The media cache (media.h) fetches, decodes,
downscales and fits off the frame on the app's background pool (a step per
drain in a browser build without threads), shares one fetch between boxes,
evicts idle pictures and retries failures. Widgets draw a placeholder of
their box until the picture arrives and a darker one on failure, with the
reason in the tooltip and at an optional status: key.
- cvc::decode_image: PNG/JPEG/GIF/BMP via stb, WebP via libwebp (now linked
directly, optional), TIFF/AVIF/HEIC via ImageMagick with the coder named
from the magic bytes; size caps checked before decoding.
- fit: contain|cover|fill and shape: circle, made by the core so every
backend draws the raster unchanged; size: [w, h] is a box.
- FTXUI half-blocks honour alpha (a transparent half keeps the terminal's
background); Backend::drop_image frees an evicted picture (ImGui deletes
its texture).
- host_get + net_host_access: a host-side GET on the verbs' terms.
- ari/arigl snapshot (and ari test) wait for the pictures a frame drew.
- Tests: ariadne_media_test (decode, fit, cache, widget over a local server
with a credential and a token scan), ari_media_test (the ari binary),
ari_run_media_images_{ftxui,tvision} (tmux), cvcgl_imgui_media.
A window, overlay or group may take background: {src|bind, auth, fit,
opacity, terminal, banner_rows, status} (or a bare URL): a picture by URI
through the media cache, or a published image name, drawn behind the
content. The core brackets the content with the new Backend::begin_backdrop
/ end_backdrop; each backend fits the picture to the area the content takes.
- ImGui: the content goes on a draw-list channel above the picture, which is
drawn (cover/contain/fill UVs, opacity as tint alpha) once the area is
known: a window's inner rect, a group's rect, full width unless size: says
otherwise and at least size:'s height.
- FTXUI and tvision: terminal: behind draws dimmed half-blocks under the
content and turns each cell the content wrote text into readable (the
picture's colour as background, dimmed to <= 40%, the terminal's own
foreground); terminal: banner draws the picture as a row above the
content, in Kitty/Sixel/iTerm pixels once its width is known; none draws
nothing. No background in mono.
- Tests: loader, core bracketing (ariadne_media_test), FTXUI behind/banner
layout, ImGui split/merge and the authored height (cvcgl_imgui_media), and
the tmux test now checks a window background on both terminal backends.
card.ari in the component library: a bordered card (a one-column grid with
an outer border) with an avatar / title / subtitle / timestamp header, a
body text, a media slot and an action row. Its args are state keys, so a
repeat: includes one per item of a feed; a part whose key is empty is not
drawn. Generic: a post, a message, a search hit.
Args only take strings, so units gain slots: a '- slot: NAME' item in a
unit's widget list is replaced by the include site's slots: {NAME: [...]}
widgets (a single widget map works too; an unfilled slot is dropped; the
unit's args are not substituted into the include site's own widgets).
Tests: AriadneModularity.SlotsTakeTheIncludeSitesWidgets; the shipped
components test checks card.ari (an embeddable unit, not a window);
AriMedia card snapshot over a local server (avatar, a 404 attachment's
failed box, the action row); ari_run_media_card_{ftxui,tvision} in tmux;
the card's avatar in ImGui (cvcgl_imgui_media).
…media M4) cvcMedia (src/cvcMedia) is libcvc's GL-free media library, its own package like cvcGL (find_package(cvcMedia), cvc::cvcMedia), so the cvc package's single-target contract and the lean libcvc are untouched. It holds the SDL3 audio output and the auto-pumped stream player that were cvcGL's, now cvc::media::playback (cvc/media/playback/*.h); SDL3 is optional and only its audio subsystem is used. cvcGL links it and keeps the cvc::gl::playback names as aliases, so the conference app and media verbs are unchanged; a standalone cvcGL build (the cvcgl recipe) builds and installs it beside itself, and the recipe ships it. ari-media is the same ari with cvcMedia linked: sound with no window, display, GL, VTK or ImGui (ari-media info lists the playback devices). It is built with cvcGL or -DCVC_BUILD_ARI_MEDIA=ON in-tree, and by the new ari-media recipe from src/ari with -DARI_WITH_MEDIA=ON, which links cvcMedia statically, so the package is bin/ari-media alone (deps: libcvc, sdl3). The lean ari links libcvc only, as before. Test: cvcmedia_audio_output plays through SDL's dummy driver with the video subsystem never initialized and no GL/VTK/ImGui/cvcGL loaded.
…media M5)
video: / audio: take src (a URI or a computed expression), auth, poster,
size/fit, bind (the player's state keys), autoplay, loop and muted. The core
(media_player.h) owns the widget: a picture box (the newest frame, else the
poster, else a placeholder; at most 8 frames/s in a terminal), controls
drawn with every backend's widgets (Play/Pause, a seek slider whose value is
'm:ss / m:ss', Mute, Open), and state keys: state, playing (writable),
position, duration, seek (writable, consumed), muted (writable), error.
A host registers the player behind media::Player. cvcMedia's FFmpeg player
(cvc/media/player.h) fetches the source whole through fetch_bytes (policy,
auth:, file/cvc/state), decodes on its own thread (libavformat/libavcodec),
scales frames to the box (libswscale), resamples to 48 kHz stereo f32
(libswresample) and plays through SDL3 audio, which is the clock (the wall
clock without sound); SDL's device is opened and closed on the frame thread.
FFmpeg is optional and linked shared (ffmpeg-lgpl). ari-media and arigl
register it; the lean ari has none, so its players say unsupported.
Over SSH (SSH_CONNECTION/SSH_CLIENT/SSH_TTY) players say remote and open
nothing; Open runs (open-url URL) where the host has it. --media-play
auto|always|never sets it. Capability tokens media and media.player; ari
info shows the player. A player whose widget a walk did not draw pauses at
once and closes after 5 s; snapshots wait while a player loads.
Tests: MediaPlayer.* (the controller with a fake player: unsupported,
remote, controls, state keys, autoplay, failure, hidden pauses);
cvcmedia_player (FFmpeg on a 2 s VP8/Opus clip and an Opus tone: ready with
a first frame, play, seek, pause, end, replay, failures); AriMedia.* with
ari-media (frames' colours, SSH default, --media-play);
ari_run_media_player_{ftxui,tvision} (tmux); the ImGui frames
(cvcgl_imgui_media).
X11 headers define None, so x11_macro_headers_test failed to compile widget.h. The YAML value stays terminal: none.
…media M6) In a wasm build (ari.html, arigl-web) the player is the page's own media element, never FFmpeg compiled to wasm (media_browser.cpp, register_browser_player). Each player is a hidden element the page keeps; it plays the sound itself, and a video's new frames (requestVideoFrameCallback or a moved currentTime) are drawn into a canvas the size of the box and copied into the widget's picture with getImageData, so both pages and every widget path (windows, menus, clipping) show them alike. The policy and credentials are decided in C++ before the element sees anything: an allowed http(s) URL without auth: is the element's src (it streams and seeks); with auth: the page fetches it with the bearer token only (credentials omit, redirect error, no-store) into a blob; file://, cvc:// and state:// are read from the page's files into a blob. A refused origin or a missing credential is a failed player saying why. A picture from another origin without CORS can't be read back (the error says so; the sound plays), and a browser that blocks sound until a click says to press Play. ari and arigl register it in their wasm builds. Checked in Chrome (the built-in pane) on a local single-threaded ari.html build: a picture by URL ready, a preloaded file:// video and an http video both played to the end with frames captured (96x54, testsrc's colours), an Opus tone ready.
…k tests without FFmpeg A cross build's pkg-config could find the host's FFmpeg for cvcGL's wasm build; the pages use the browser's own media elements instead. On a runner whose cvcMedia has no FFmpeg, ari-media's players say unsupported, so the tmux playback test is not registered and the SSH test skips.
…a reply names image.url holds in every host that loads a picture by URI, so a document for older hosts gates its pictures on (has? "image.url") and keeps its own placeholder elsewhere (an older host prints an unknown URI as text). A picture whose URL a reply puts in state was drawn as its loading placeholder by ari snapshot / arigl --terminal snapshot: no frame had asked for it while the request was out, so the settle loop never waited for it. AppRuntime::settle_and_render settles, draws, and while that frame drew a picture still loading, settles and draws again (within the same 10 s). Test: AriMedia.SnapshotWaitsForAPictureWhoseUrlComesFromAReply.
… the image.background token A text: with color: wraps its row in a colour decorator, which recoloured the backdrop's half-blocks after the text (solid bars in the text's colour). BackdropText now gives a cell that is still the backdrop's own (its character and background) the picture's foreground back. Test: MediaBackground.ColouredTextDoesNotPaintTheBackdropBesideIt. image.background holds where background: draws.
import: entries may be {uri: URI, optional: true}: a library the host may
not have, whose absence is no warning (so ari test passes on older hosts).
A document's own unit with fallback: true stands in only where no import
defines the name, so a document adopts cvc://components/card.ari and keeps
its own card for hosts without it. card.ari gains slots note (above the
header), extra (under the byline) and body (after the body text).
Test: AriadneModularity.OptionalImportsAndFallbackUnits.
…rge had interleaved them)
… and audio: The cvcgl package builds cvcMedia beside cvcGL; with ffmpeg-lgpl (shared) in its prefix, cvcMedia has its FFmpeg player. Scoped to linux, macos and windows; the wasm pages use the browser's media elements.
The three MediaBackground cases shared temp/ariadne_media_test_backdrop, and each removed it when done. ctest runs the cases as separate processes at the same time, so one case removed (or rewrote) bg.png while another was still loading it; that picture never reached ready and the case timed out at 5 s. Seen on recipe/ubuntu Debug and Release and on macOS Debug once the stack above added cases and changed which ones run together. The directory now carries the running test's name.
… release bumped them before this one landed)
…dne-media-background
#931's changes are already here from its branch, so this keeps this tree and makes the squash an ancestor, so the branch merges into master.
…t/ariadne-media-card
#932's changes are already here from its branch, so this keeps this tree and makes the squash an ancestor, so the branch merges into master.
…-media-video Their changes are already here from their branches, so this keeps this tree and makes the squashes ancestors, so the branch merges into master.
#935's changes are already here from its branch, so this keeps this tree and makes the squash an ancestor, so the branch merges into master.
transfix
added a commit
that referenced
this pull request
Nov 2, 2026
#936's changes are already here from its branch, so this keeps this tree and makes the squash an ancestor, so the branch merges into master.
transfix
added a commit
that referenced
this pull request
Nov 2, 2026
…tacked on #936) (#938) Media M7: animated GIF/WebP pictures on the clock (frames counted before decoding, capped at 512 frames / 128 MiB), `video: controls: false`, and video URLs (.mp4/.webm/.mov/.m4v) in `image:` and `background:` played as silent decorative video, with no sound device, so they play over SSH too. As in the TX.WTF web app, avatars, banners and backgrounds can be animated.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Media M6 from the design (#929). Stacked on #935 (and so on #931–#934). Review only 55a3c16. It targets master so the full CI runs, including the ari-wasm and arigl-web jobs that compile it.
In a wasm build (ari.html, arigl-web),
video:andaudio:play through the page's own media elements. FFmpeg is never compiled to wasm. Code:src/cvc/ariadne/media_browser.cpp,register_browser_player(), which ari and arigl call in their wasm builds.<video>/<audio>element the page keeps. The element plays the sound itself. A video's new frames (requestVideoFrameCallback, or a movedcurrentTime) are drawn into a canvas the size of the box, andgetImageDatacopies them into the widget's picture. They are then drawn as any picture: xterm cells in ari.html, an ImGui texture in arigl-web.<video>laid over the canvas is cheaper and sharper, but it only works in arigl-web, breaks ImGui's z-order, and must track layout. Copying costs one copy per frame shown, in exchange for one path that works everywhere.auth:becomes the element'ssrc(it streams and seeks with range requests);auth:, the page fetches it with the bearer token only (credentials: 'omit',redirect: 'error',no-store) into a blob, so the token is in that request and nowhere else;file://,cvc://andstate://sources are read from the page's files (configpreload) into a blob;media-src 'self' blob:. ARIADNE.md §5.13 documents all of this.===/!==(the preprocessor/clang-format hazard net_policy.cpp notes), strings returned via_malloc+stringToUTF8, andsetValuefor out-params.Verified
--net, args--base {origin}, a preloaded clip and tone):ready(the image cache over http in wasm);file://video (blob) and anhttp://video (streamed by the element) both autoplayed muted and played toended, with frames captured (96x54 canvases, testsrc's 81 colours);ready, and the Mute checkbox followsmuted: true.register_browser_player() == false).Not checked: the
auth:fetch path in a browser (no credentialed media server locally), arigl-web (its wasm deps aren't local; CI's arigl-web job compiles it), and Play after a real click (the pane was hidden, so rVFC was throttled).Since opening — checked in Chrome on arigl-web too, built from cvcpkg's wasm deps (
cvcpkg install-deps cvcpkg/recipes/arigl-web --platform wasm):auth:video was fetched with the captured bearer token. The test server loggedBearer <token>OK, and the video played through with frames.