Перейти до основного вмісту

Start a camera preview

POST 

/api/peripherals/cameras/preview

Starts an explicit, temporary capture: over the board connection Insight runs a GStreamer pipeline (gst-launch-1.0; libcamerasrc for a MIPI camera, v4l2src on the camera's /dev/v4l/by-id path for a USB camera, or on its /dev/videoN node once a SiMa Sentinel rescan still reports the scanned camera there) that scales the mode to at most 640 pixels wide at up to 15 fps and writes JPEG frames to its stdout. Insight answers once the first frame arrived (within 10 s, or two frame periods for a mode slower than 0.2 fps, at most 60 s) and relays the frames at stream_url. Discovery never starts capture; only this call does. The mode defaults to the camera's default_selection and must be one the last scan listed: for a MIPI camera an available or unverified mode in NV12, for a USB camera any listed mode in MJPG or a raw format (YUYV, UYVY, YVYU, NV12, NV21, YU12, YV12, GREY, RGB3, BGR3). The rate is the scan's exact fraction (framerate_num/framerate_den). A camera listed from SiMa Sentinel's last successful scan, because its provider failed during the refresh (modes_source: previous-scan), is refused with 503 peripheral_unavailable: its device may have changed since. A USB camera without a /dev/v4l/by-id link whose /dev/videoN node Sentinel no longer reports for the scanned camera (same id, vendor, product and serial), because it was replugged or replaced, is refused with 409 stale_snapshot. Insight refuses a camera the scan or a check just before the start finds in use, or one the pipeline cannot acquire (409 camera_in_use); a board without gst-launch-1.0, or without a GStreamer element the pipeline needs (named in tool), returns 502 tool_missing with the packages to install; a pipeline that fails or sends no frame returns 502 command_failed with its output in detail. While a preview runs the camera cannot be opened by an application. Capture stops on stop, when its stream response ends, when nobody opens the stream within 15 s, when a refresh starts, or when the selected board changes.

Request​

Responses​

The preview session.