Assign or clear one source slot
POST/api/mediasrc/assign
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.
Assigning a file to a webcam slot converts it back to a file source, so Insight first asks MediaMTX to close the browser publishing to it. If MediaMTX cannot be reached the call answers 502 and leaves the slot unchanged, because converting it would erase the only record that a camera may still be publishing. A caller that already closed its own publisher may send publisher_released: true.
Request
Responses
- 200
- 400
- 404
- 409
- 500
- 502
Operation completed.
Missing or invalid request data.
The requested resource was not found.
Nothing was changed, for one of two reasons: the released session no longer publishes to this slot and a different session does; or the slot changed kind (file to webcam or back) while this request was waiting on MediaMTX. Reload the source list and retry.
A local operation failed.
Insight could not reach MediaMTX to verify the slot's publisher, so nothing was changed. If the camera has in fact stopped, the slot updates on its own once MediaMTX is reachable.