Import
Methods
| Method | Description |
|---|---|
start(dut_ip) | Start a webcam stream |
stop() | Stop the webcam stream |
get_info(dut_ip) | Get info about the stream |
get_url(dut_ip) | Get just the URL for the stream |
is_active() | Check if stream is currently active |
Method Reference
Net.get(name, type=NetType.Webcam)
Get a webcam net by name.
| Parameter | Type | Description |
|---|---|---|
name | str | Name of the webcam net |
type | NetType | Must be NetType.Webcam |
start(dut_ip)
Start a webcam video stream.
| Parameter | Type | Description |
|---|---|---|
dut_ip | str | Lager Box IP address for URL generation |
dict with keys:
url- Full stream URL (e.g.,http://100.91.127.26:8081/)port- Port number for the streamalready_running- Boolean indicating if stream was already active
RuntimeError if device is already in use or not found
stop()
Stop the webcam stream.
bool - True if stopped successfully, False if not running
get_info(dut_ip)
Get information about the stream.
| Parameter | Type | Description |
|---|---|---|
dut_ip | str | Lager Box IP address |
dict or None - Stream info dict or None if not running
get_url(dut_ip)
Get just the URL for the stream.
| Parameter | Type | Description |
|---|---|---|
dut_ip | str | Lager Box IP address |
str or None - Stream URL or None if not running
is_active()
Check if the stream is currently active.
bool - True if stream is running, False otherwise
Examples
Start Multiple Cameras
Stream Management
Visual Inspection Test
Camera Discovery and Testing
Already Running Detection
Web Interface
Each stream provides a web interface at its URL with:- Live MJPEG video stream
- Zoom controls (+, -, Reset)
- FPS display
- Sidebar with links to other active streams
API Endpoints
| Endpoint | Method | Description |
|---|---|---|
/ | GET | HTML page with video viewer |
/stream | GET | Raw MJPEG video stream |
/api/zoom | GET | Get current zoom level |
/api/zoom/in | POST | Increase zoom |
/api/zoom/out | POST | Decrease zoom |
/api/zoom/reset | POST | Reset zoom to 1.0x |
/api/fps | GET | Get current FPS |
/api/streams | GET | List all active streams |
/test | GET | Health check endpoint |
Hardware Requirements
| Requirement | Description |
|---|---|
| USB Webcams | UVC-compatible cameras |
| Video Devices | /dev/video* device files |
| OpenCV | Required for video capture |
Notes
- Webcam nets must be configured on the Lager Box with video device path
- Streams run on ports starting from 8081
- Each stream uses a separate port, automatically allocated
- Streams persist until explicitly stopped or the process dies
- Dead stream processes are automatically cleaned up
- Only one stream can use a video device at a time
- Default resolution is 640x480 at 30 FPS
- JPEG quality is set to 80 for bandwidth/quality balance
- Streams are accessible via HTTP from any network the Lager Box is on
- Zoom is digital (crop and scale), not optical

