Skip to main content
Start and stop an MJPEG video stream from a USB camera attached to the box. A person or a vision tool can then watch the DUT while a test runs.

Handle

Methods

Types

Method Reference

start() -> Result<WebcamStream>

Start the MJPEG stream. Idempotent: called while a stream is already up, it reports the existing one with already_running: true rather than starting a second.
This call gets a 30-second budget, because starting the stream subprocess takes a few seconds.

stop() -> Result<bool>

Stop the stream. Returns: false if no stream was active.

status() -> Result<WebcamStatus> and url() -> Result<Option<String>>

Whether a stream is active and where, or just the URL.

snapshot() -> Result<Vec<u8>>

Capture one JPEG frame from the running stream, and return its bytes. Start the stream first: the box refuses a snapshot when no stream runs. It requires box software 0.47.0 or later.

start_as(source: &str, started_by: Option<&str>) -> Result<WebcamStream>

Like start(), and the box records which surface started the stream, and who. status() reports them in source and started_by.

Examples

Record the bench while a long test runs

Supported Hardware

Notes

  • The stream URL points at the box as the client reached it. A URL captured on one network does not always resolve from another, so do not persist it across environments.
  • To watch the stream, point an MJPEG consumer (a browser, VLC, OpenCV) at the URL. To keep one frame from a test, call snapshot().
  • Always stop() in teardown. A running stream holds the camera open. A start on the same net reports the running stream. A stream on a different net that uses the same camera is refused until this one stops.