Register one source slot for a browser webcam
POST/api/mediasrc/assign-webcam
Marks one one-based source slot as a browser-published webcam and returns the WHIP URL the browser posts its WebRTC offer to. Unlike /api/mediasrc/assign, Insight does not start a publisher itself: the browser publishes the camera over WHIP to an internal ingest path, MediaMTX normalizes it to baseline H.264 with regular keyframes and republishes it on the urls.rtsp path (the same shape a file source produces, so detection apps and hardware decoders can consume it directly), and /api/mediasrc/start only confirms that the stream arrived. Any file assignment on the slot is cleared, and a playing file source is stopped first. The returned urls.whip host and port already account for SDK port remapping, so use it exactly as returned.
On a slot that is already a webcam this switches cameras, 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, so the previous camera stays stoppable. A caller that already closed its own publisher may send publisher_released: true.
Request
Responses
- 200
- 400
- 404
- 409
- 500
- 502
The slot is registered as a webcam source.
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.