Repository navigation
Record phone video into experiment directories - #58
Merged
Merged
Conversation
LinkHub optionally serves HTTPS with a persisted self-signed certificate so phone browsers can use the camera. Start Experiment shows a QR code for a phone recording page that uploads ordered MediaRecorder chunks into video-<stream>.<ext> in the experiment directory; stopping the experiment ends every phone recording.
mcroomp
force-pushed
the
experiment-video
branch
from
November 18, 2026 09:28
a422c47 to
83648a3
Compare
Phones enable the camera once and send heartbeats; the page starts recording whenever an experiment is active and finalizes it on stop, then waits for the next one. The UI camera button is always available and shows connected phones.
Disconnect finishes and uploads any recording, releases the camera, removes the registration via DELETE /v1/camera/{device}, and closes the page or shows a disconnected screen.
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.
Lets phones record video for experiments. Each recording is saved in the experiment's directory, next to
experiment.txtandmavlog.json.How it works
serve --https-portalso serves LinkHub over HTTPS. Phone browsers only allow camera access over HTTPS. The self-signed certificate is kept in<data-dir>/tls/and is only regenerated when the LAN address changes, so each phone accepts the certificate warning once.run_linkhub_ui.cmdnow listens on0.0.0.0with HTTPS on port 9443.https://<lan-ip>:9443/camera. On the phone, tap Enable camera once and leave the page open. After that, a reload reconnects without a tap.POST /v1/camera/{device}/heartbeatevery 1.5 s, and the reply says whether an experiment is running. The phone starts recording when an experiment starts and finishes the file when it stops. It then waits for the next experiment.DELETE /v1/camera/{device}. It then closes the page, or shows a Disconnected screen with Reconnect if the browser won't close it.POST /v1/experiment/{id}/video/{stream}?seq=N. Each recording gets its own file,video-<device>-<rand>.webmor.mp4, which grows as chunks arrive. Repeated chunks are acknowledged without being written again, so phones can retry; a gap in the sequence returns 409. The final chunk is accepted for up to 120 s after stop.Testing
cargo test --workspaceandcargo fmt --checkpass. Tests cover phone registration and heartbeat, the camera status endpoint, ordered chunk appends and TLS host detection.npm run buildpasses.video-*.webm. The header showed "📷 1 camera".