跳转到内容

Camera capture

OpenClaw 支持 agent 工作流的 camera capture

  • iOS node(通过 Gateway(网关) 配对):通过 node.invoke 拍摄 photojpg)或 short video clipmp4,可选音频)。
  • Android node(通过 Gateway(网关) 配对):通过 node.invoke 拍摄 photojpg)或 short video clipmp4,可选音频)。
  • macOS app(通过 Gateway(网关) 的节点):通过 node.invoke 拍摄 photojpg)或 short video clipmp4,可选音频)。

所有相机访问都受 user-controlled settings 限制。

  • iOS 设置选项卡 → CameraAllow 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 }
  • camera.snap

    • Params:
      • facing: front|back (default: front)
      • maxWidth: number (optional; default 1600 on the iOS node)
      • quality: 0..1 (optional; default 0.9)
      • format: currently jpg
      • delayMs: number (optional; default 0)
      • deviceId: string (optional; from camera.list)
    • Response payload:
      • format: "jpg"
      • base64: "<...>"
      • width, height
    • Payload guard:照片会被重新压缩,以将 base64 负载保持在 5 MB 以下。
  • camera.clip

    • Params:
      • facing: front|back (默认: front)
      • durationMs: number (默认 3000, 限制最大为 60000)
      • includeAudio: boolean (默认 true)
      • format: 当前为 mp4
      • deviceId: string (可选; 来自 camera.list)
    • 响应负载:
      • format: "mp4"
      • base64: "<...>"
      • durationMs
      • hasAudio

canvas.* 类似,iOS 节点只允许在 前台 执行 camera.* 命令。后台调用返回 NODE_BACKGROUND_UNAVAILABLE

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.

示例:

Terminal window
openclaw nodes camera snap --node <id> # default: both front + back (2 MEDIA lines)
openclaw nodes camera snap --node <id> --facing front
openclaw nodes camera clip --node <id> --duration 3000
openclaw nodes camera clip --node <id> --no-audio

注意:

  • nodes camera snap 默认为 both(两者),以便为代理提供两个视图。
  • 除非您构建自己的包装器,否则输出文件是临时的(位于操作系统临时目录中)。
  • Android 设置表单 → CameraAllow Camera (camera.enabled)
    • 默认: on (缺少的键将被视为已启用)。
    • When off: camera.* commands return CAMERA_DISABLED.
  • Android 需要运行时权限:
    • CAMERA for both camera.snap and camera.clip.
    • RECORD_AUDIO for camera.clip when includeAudio=true.

If permissions are missing, the app will prompt when possible; if denied, camera.* requests fail with a *_PERMISSION_REQUIRED error.

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 配套应用提供了一个复选框:

  • Settings → General → Allow Camera (openclaw.cameraEnabled)
    • 默认:关闭
    • 关闭时:相机请求将返回“Camera disabled by user”。

Use the main openclaw CLI to invoke camera commands on the macOS node.

示例:

Terminal window
openclaw nodes camera list --node <id> # list camera ids
openclaw nodes camera snap --node <id> # prints saved path
openclaw nodes camera snap --node <id> --max-width 1280
openclaw nodes camera snap --node <id> --delay-ms 2000
openclaw nodes camera snap --node <id> --device-id <id>
openclaw nodes camera clip --node <id> --duration 10s # prints saved path
openclaw 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 snap defaults to maxWidth=1600 unless overridden.
  • On macOS, camera.snap waits delayMs (default 2000ms) after warm-up/exposure settle before capturing.
  • 照片负载会被重新压缩,以将 base64 大小保持在 5 MB 以下。
  • 相机和麦克风访问会触发常规的操作系统权限提示(并且需要在 Info.plist 中包含使用说明字符串)。
  • Video clips are capped (currently <= 60s) to avoid oversized node payloads (base64 overhead + message limits).

macOS 屏幕视频(操作系统级别)

Section titled “macOS 屏幕视频(操作系统级别)”

对于屏幕视频(而非相机),请使用 macOS 配套应用:

Terminal window
openclaw nodes screen record --node <id> --duration 10s --fps 15 # prints saved path

注意:

  • 需要 macOS 屏幕录制权限 (TCC)。