Media sources
Manage one-based source slots that publish assigned media over RTSP or HTTP MJPEG. A normal workflow is list videos โ assign a slot โ start it โ inspect state โ stop it before changing or deleting media.
List assignable media files
Returns a flat, sorted list of media-library paths whose extensions are supported by the source streamer. Use these exact relative paths in the assignment endpoint; the broader media tree can contain files that are inspectable but not streamable.
Get source assignments and playback state
Returns every configured one-based source slot with its assigned file, persisted playback state, detected codec, selected transport, compatible transports, and ready-to-use stream URLs. Read this endpoint before mutating sources so automation can avoid unnecessary restarts and choose a compatible transport.
Assign or clear one source slot
Assigns a media-library path to one one-based source slot. Send an empty `file` value to clear the slot. Insight probes the media, normalizes the requested transport to one supported by the detected codec, persists the assignment, and automatically restarts the source when it was already playing. Obtain valid paths from `/api/mediasrc/videos`.
Assign available videos to source slots
Convenience operation for test setup. Insight stops every active source, walks the sorted assignable-video list, assigns unique files to source slots in index order, persists the result, and leaves all slots stopped. Call the bulk-start endpoint afterward when playback should begin.
Start one source
Starts streaming the file assigned to one one-based source slot and persists its state as `playing`. The slot must exist and have a valid assignment. Repeated calls are safe for normal control flows, but callers should inspect `/api/mediasrc` when they need to distinguish newly started from already-running sources.
Start multiple assigned sources
Targets the first `count` assigned source slots in index order and starts each one independently. The result separates newly started slots, slots that were already running, and per-slot failures, allowing test automation to continue with partial success while preserving detailed diagnostics.
Stop one source
Stops the process backing one source slot and persists its state as `stopped` without clearing the assigned file. The same slot can subsequently be started again without reassignment.
Stop every source
Stops all running source processes while preserving their file assignments and transport choices. Use this before deleting media, changing a group of assignments, or shutting down a test; the response reports how many sources were previously playing.
Reset all source assignments
Returns source management to its initial state by stopping every source and rewriting the persisted slot configuration with empty assignments. This is destructive configuration cleanup; use `stop-all` instead when assignments should be retained.
Stream an active HTTP MJPEG source
Relays the live multipart MJPEG output for a source slot configured with HTTP transport. The source must be assigned, started, and actively producing frames; RTSP sources are not converted by this route. The response remains open until the client disconnects or the source stops.
Get one frame from an active HTTP MJPEG source
Waits for and returns a single JPEG frame from an active HTTP MJPEG source. This is useful for thumbnails, readiness checks, and test assertions without maintaining a streaming connection. A stopped or non-HTTP source returns a conflict, and a frame acquisition timeout returns `504`.