Skip to content

Device Access

Device access is determined by the API key deviceScope and the local SDK runtime device provider.

Device Scope

deviceScope is the API key device allowlist:

json
[
  { "vid": 4660, "pid": 22136 }
]

If deviceScope is not configured, or is an empty array, device access is unrestricted; the runtime does not filter devices by VID/PID.

When deviceScope is non-empty, the local runtime filters device.list and device.get by the current session auth_context.device_scope. If a device is outside the scope, the runtime returns 1105 DEVICE_NOT_IN_AUTH_SCOPE.

Local Access Flow

  1. Start the SDK runtime.
  2. Connect Command WS.
  3. Call auth.create_session with the API key.
  4. Call device.list to see authorized devices.
  5. Call device.get to read resolutions.
  6. Call device.open to open the device.
  7. Call video.start to create a preview stream, or capture.take to capture a still image.
  8. Call device.close when done; it also stops the active video stream for that device on the current connection.

Resolution and Pixel Format

device.get returns resolutions, each with width, height, real_width, real_height, fps, pixel_format, and is_default. Current Video WS binary frames use pixel_format=mjpeg; clients should pair each binary frame with the preceding stream.frame_meta text event, decode the binary payload as a JPEG/MJPEG image, and draw the decoded image to Canvas.

Troubleshooting

ProblemAction
device.list is emptyCheck device connection and provider readiness; if deviceScope is configured, confirm that it includes the device VID/PID.
device.open says device is outside auth scopeReissue or rotate an API key with the correct VID/PID in the console.
Resolution switch failsStop the video stream first, or use video.set_format to update the current stream format.
Device remains busy after page exitCall device.close or disconnect Command WS; the runtime cleans devices opened by the connection when it closes.

CZUR Open Platform Documentation