Camera capture
OpenClaw 支持 agent 工作流的 camera capture:
- iOS node(通过 Gateway(网关) 配对):通过
node.invoke拍摄 photo(jpg)或 short video clip(mp4,可选音频)。 - Android node(通过 Gateway(网关) 配对):通过
node.invoke拍摄 photo(jpg)或 short video clip(mp4,可选音频)。 - macOS app(通过 Gateway(网关) 的节点):通过
node.invoke拍摄 photo(jpg)或 short video clip(mp4,可选音频)。
所有相机访问都受 user-controlled settings 限制。
iOS node
Section titled “iOS node”User setting (default on)
Section titled “User setting (default on)”- iOS 设置选项卡 → Camera → Allow Camera (
camera.enabled)- 默认值:on(缺少的键将被视为已启用)。
- 关闭时:
camera.*命令返回CAMERA_DISABLED。
Commands (via Gateway(网关) node.invoke)
Section titled “Commands (via Gateway(网关) node.invoke)”-
camera.list- Response payload:
devices: array of{ id, name, position, deviceType }
- Response payload:
-
camera.snap- Params:
facing:front|back(default:front)maxWidth: number (optional; default1600on the iOS node)quality:0..1(optional; default0.9)format: currentlyjpgdelayMs: number (optional; default0)deviceId: string (optional; fromcamera.list)
- Response payload:
format: "jpg"base64: "<...>"width,height
- Payload guard:照片会被重新压缩,以将 base64 负载保持在 5 MB 以下。
- Params:
-
camera.clip- Params:
facing:front|back(默认:front)durationMs: number (默认3000, 限制最大为60000)includeAudio: boolean (默认true)format: 当前为mp4deviceId: string (可选; 来自camera.list)
- 响应负载:
format: "mp4"base64: "<...>"durationMshasAudio
- Params:
与 canvas.* 类似,iOS 节点只允许在 前台 执行 camera.* 命令。后台调用返回 NODE_BACKGROUND_UNAVAILABLE。
CLI helper
Section titled “CLI helper”The easiest way to get media files is via the CLI helper, which writes decoded media to a temp file and prints the saved path.
示例:
openclaw nodes camera snap --node <id> # default: both front + back (2 MEDIA lines)openclaw nodes camera snap --node <id> --facing frontopenclaw nodes camera clip --node <id> --duration 3000openclaw nodes camera clip --node <id> --no-audio注意:
nodes camera snap默认为 both(两者),以便为代理提供两个视图。- 除非您构建自己的包装器,否则输出文件是临时的(位于操作系统临时目录中)。
Android 节点
Section titled “Android 节点”Android 用户设置 (默认开启)
Section titled “Android 用户设置 (默认开启)”- Android 设置表单 → Camera → Allow Camera (
camera.enabled)- 默认: on (缺少的键将被视为已启用)。
- When off:
camera.*commands returnCAMERA_DISABLED.
- Android 需要运行时权限:
CAMERAfor bothcamera.snapandcamera.clip.RECORD_AUDIOforcamera.clipwhenincludeAudio=true.
If permissions are missing, the app will prompt when possible; if denied, camera.* requests fail with a
*_PERMISSION_REQUIRED error.
Android 前台要求
Section titled “Android 前台要求”Like canvas.*, the Android node only allows camera.* commands in the foreground. Background invocations return NODE_BACKGROUND_UNAVAILABLE.
Android commands (via Gateway(网关) node.invoke)
Section titled “Android commands (via Gateway(网关) node.invoke)”camera.list- 响应负载:
devices: array of{ id, name, position, deviceType }
- 响应负载:
照片会被重新压缩,以将 base64 负载保持在 5 MB 以下。
macOS 应用
Section titled “macOS 应用”用户设置(默认关闭)
Section titled “用户设置(默认关闭)”macOS 配套应用提供了一个复选框:
- Settings → General → Allow Camera (
openclaw.cameraEnabled)- 默认:关闭
- 关闭时:相机请求将返回“Camera disabled by user”。
CLI 帮助程序(节点调用)
Section titled “CLI 帮助程序(节点调用)”Use the main openclaw CLI to invoke camera commands on the macOS node.
示例:
openclaw nodes camera list --node <id> # list camera idsopenclaw nodes camera snap --node <id> # prints saved pathopenclaw nodes camera snap --node <id> --max-width 1280openclaw nodes camera snap --node <id> --delay-ms 2000openclaw nodes camera snap --node <id> --device-id <id>openclaw nodes camera clip --node <id> --duration 10s # prints saved pathopenclaw nodes camera clip --node <id> --duration-ms 3000 # prints saved path (legacy flag)openclaw nodes camera clip --node <id> --device-id <id>openclaw nodes camera clip --node <id> --no-audio注意:
openclaw nodes camera snapdefaults tomaxWidth=1600unless overridden.- On macOS,
camera.snapwaitsdelayMs(default 2000ms) after warm-up/exposure settle before capturing. - 照片负载会被重新压缩,以将 base64 大小保持在 5 MB 以下。
安全性与实际限制
Section titled “安全性与实际限制”- 相机和麦克风访问会触发常规的操作系统权限提示(并且需要在 Info.plist 中包含使用说明字符串)。
- Video clips are capped (currently
<= 60s) to avoid oversized node payloads (base64 overhead + message limits).
macOS 屏幕视频(操作系统级别)
Section titled “macOS 屏幕视频(操作系统级别)”对于屏幕视频(而非相机),请使用 macOS 配套应用:
openclaw nodes screen record --node <id> --duration 10s --fps 15 # prints saved path注意:
- 需要 macOS 屏幕录制权限 (TCC)。