main
Colby Knox Publish 0.1.1 d849430 26d ago

name: mjpeg-stream-viewer description: >- Show a raw MJPEG camera stream (multipart/x-mixed-replace, bench cams, printer cams, camera boxes) in a Hydrogen pane that fits, proxied through the container so an http LAN camera shows inside https Hydrogen, with the frame rate capped and a snapshot button. Use when a camera stream URL opens at native size with scrollbars, will not load in Hydrogen because it is http, or floods the browser at 4K 30 fps. Trigger words: mjpeg, camera stream, stream does not fit, show my camera, bench cam, multipart x-mixed-replace, snapshot the camera, camera in a pane, mjpeg-stream-viewer.

MJPEG Stream Viewer

Paste a camera stream URL, get a pane that fits. The server proxies the stream through the container, keeps the aspect, caps the frame rate, and saves snapshots.

Show a camera

mjpeg-stream-viewer --ai-thread "<your thread name>" show --url http://192.168.0.34:3000/stream [--fps 5] [--name "Bench cam"]

show reuses this thread's running instance or starts one (--port auto), then opens the page in a Hydrogen webview tab in a work pane. The page takes ?url=, ?fps= and ?bare=1. --bare opens it with nothing but the picture (the header and bar hide; hover the corner button or press b to bring them back); use it when the user wants "just the raw image". Other verbs: serve [--port N|auto] [--url <cam>] [--print-url] [--ttl H] [--keep-alive], ls, state, stop. The global --ai-thread "<name>" flag comes first on every state-changing verb; without it the call is refused with caller_identity_required.

Displaying this app (REQUIRED — read before showing anything)

To SHOW this app, use mjpeg-stream-viewer show (it opens the proper Hydrogen webview tab itself). For manual display, FIRST load the webview skill (adom-workspace-control) and follow it.

  • NEVER open this app in VS Code's "Simple Browser" — not a webview in the Adom ecosystem: no live channel, no console read-back, no AI drivability. Using it is a bug.
  • Surfaces: wv — Hydrogen webview panel (webview skill; Hydrogen's pane tab inside Hydrogen), pup (pup skill), the user's real signed-in browser (Adom browser extension), and hdbw — Hydrogen's standalone Tauri browser window (only under Hydrogen). Simple Browser is NEVER one of them.

What to expect and how to read it

  • Status pills: source (grey no source, yellow connecting, green frames flowing, red error with the reason), frames (fps and KB/s after the cap), size (the JPEG's own dimensions; a hint when the source is bigger than the pane can use). GET /api/status returns the same for the dock.
  • Fit keeps the whole frame letterboxed; Fill crops to the pane. Snapshot saves ~/project/screenshots/mjpeg-<timestamp>.jpg and tells you the path; Read the file to see it.
  • Settings (gear): max fps (default 10), default view, idle shutdown hours, saved sources. They persist on the server for every tab.

Gotchas

  • The camera must be reachable from the container. A cloud container on another network shows a red source pill with the connection error; the desktop and an office container see the LAN.
  • Only http and https sources are proxied. The viewer refuses its own URL.
  • 4K at 30 fps is about 11 MB/s raw. Cap it (5 fps is fine for watching a print) and, if the box can, ask it for a 1080p stream.
  • Do not point a bare webview at the raw stream: that is the native-size-with-scrollbars problem this app exists for.

In a shared workspace or the dock

dockbar.json ships with the page, so the dock launches it and adom-cli hydrogen workspace apply can open a camera pane from a bench: { "panel": "app", "app": "adom/mjpeg-stream-viewer", "args": { "url": "<stream>", "fps": "5" } }.