Camera capture (agent)
Mayros agent workflows के लिए camera capture का समर्थन करता है:
- iOS node (Gateway के माध्यम से paired):
node.invokeके माध्यम से photo (jpg) या short video clip (mp4, वैकल्पिक audio के साथ) capture करें। - Android node (Gateway के माध्यम से paired):
node.invokeके माध्यम से photo (jpg) या short video clip (mp4, वैकल्पिक audio के साथ) capture करें। - macOS app (Gateway के माध्यम से node):
node.invokeके माध्यम से photo (jpg) या short video clip (mp4, वैकल्पिक audio के साथ) capture करें।
सभी camera access user-controlled settings के पीछे gated है।
iOS node
User setting (डिफ़ॉल्ट on)
- iOS Settings tab → Camera → Allow Camera (
camera.enabled)- डिफ़ॉल्ट: on (missing key को enabled के रूप में treat किया जाता है)।
- जब off:
camera.*commandsCAMERA_DISABLEDreturn करते हैं।
Commands (Gateway node.invoke के माध्यम से)
-
camera.list- Response payload:
devices:{ id, name, position, deviceType }की array
- Response payload:
-
camera.snap- Params:
facing:front|back(डिफ़ॉल्ट:front)maxWidth: number (वैकल्पिक; iOS node पर डिफ़ॉल्ट1600)quality:0..1(वैकल्पिक; डिफ़ॉल्ट0.9)format: वर्तमान मेंjpgdelayMs: number (वैकल्पिक; डिफ़ॉल्ट0)deviceId: string (वैकल्पिक;camera.listसे)
- Response payload:
format: "jpg"base64: "<...>"width,height
- Payload guard: photos को recompressed किया जाता है ताकि base64 payload 5 MB से कम रहे।
- Params:
-
camera.clip- Params:
facing:front|back(डिफ़ॉल्ट:front)durationMs: number (डिफ़ॉल्ट3000, अधिकतम60000तक clamped)includeAudio: boolean (डिफ़ॉल्टtrue)format: वर्तमान मेंmp4deviceId: string (वैकल्पिक;camera.listसे)
- Response payload:
format: "mp4"base64: "<...>"durationMshasAudio
- Params:
Foreground requirement
canvas.* की तरह, iOS node केवल foreground में camera.* commands की अनुमति देता है। Background invocations NODE_BACKGROUND_UNAVAILABLE return करते हैं।
CLI helper (temp files + MEDIA)
Attachments प्राप्त करने का सबसे आसान तरीका CLI helper के माध्यम से है, जो decoded media को temp file में लिखता है और MEDIA:<path> print करता है।
उदाहरण:
bashmayros nodes camera snap --node <id> # डिफ़ॉल्ट: दोनों front + back (2 MEDIA lines) mayros nodes camera snap --node <id> --facing front mayros nodes camera clip --node <id> --duration 3000 mayros nodes camera clip --node <id> --no-audio
नोट्स:
nodes camera snapagent को दोनों views देने के लिए दोनों facings को default करता है।- Output files temporary हैं (OS temp directory में) जब तक आप अपना wrapper नहीं बनाते।
macOS app
User setting (डिफ़ॉल्ट off)
macOS companion app एक checkbox expose करता है:
- Settings → General → Allow Camera (
mayros.cameraEnabled)- डिफ़ॉल्ट: off
- जब off: camera requests "Camera disabled by user" return करते हैं।
CLI helper (node invoke)
macOS node पर camera commands invoke करने के लिए main mayros CLI का उपयोग करें।
उदाहरण:
bashmayros nodes camera list --node <id> # camera ids list करें mayros nodes camera snap --node <id> # MEDIA:<path> print करता है mayros nodes camera snap --node <id> --max-width 1280 mayros nodes camera snap --node <id> --delay-ms 2000 mayros nodes camera clip --node <id> --duration 10s # MEDIA:<path> print करता है mayros nodes camera clip --node <id> --no-audio
Safety + practical limits
- Camera और microphone access सामान्य OS permission prompts trigger करते हैं (और Info.plist में usage strings की आवश्यकता होती है)।
- Video clips capped हैं (वर्तमान में
<= 60s) oversized node payloads (base64 overhead + message limits) से बचने के लिए।