Control a PTZ Camera
Control PTZ camera direction, zoom, presets, and wiper.
Endpoint Information
Section titled “Endpoint Information”- Name: PTZ camera control
- Description: Moves a robot-mounted PTZ camera or controls its lens.
- Method:
POST - Path:
remoteApi/cameraCtrl - Login required: No
- Permission required: Yes
Request Parameters
Section titled “Request Parameters”-
cameraCode·String· RequiredCamera code
Example:001 -
ctrlType·Integer· RequiredControl type:
3robot-mounted PTZ;4zoom and focus
Example:3 -
command·Integer· RequiredCommand
Example:4 -
value·Integer· OptionalCommand value
Example:0 -
channelNum·Integer· OptionalCamera channel number. Pass
1whenctrlTypeis4; this field may be omitted whenctrlTypeis3.
Example:1
Command values:
PTZ Direction Control
Section titled “PTZ Direction Control”Shared parameters: ctrlType = 3; channelNum may be omitted. For value, use 1 to start or 0 to stop.
command | Description |
|---|---|
1 | Up |
2 | Down |
3 | Left |
4 | Right |
5 | Up-left |
6 | Up-right |
7 | Down-left |
8 | Down-right |
Lens Control
Section titled “Lens Control”Shared parameters: ctrlType = 4, channelNum = 1. For autofocus (command = 5), value is not applicable.
command | Description |
|---|---|
1 | Zoom in |
2 | Zoom out |
3 | Increase focal length |
4 | Decrease focal length |
5 | Autofocus |
Request Example
Section titled “Request Example”{ "cameraCode": "001", "ctrlType": 3, "command": 4, "value": 0, "channelNum": 1}In this example, cameraCode identifies the camera; ctrlType = 3 selects PTZ control, command = 4 selects rightward
movement, and value = 0 stops that movement.
Response
Section titled “Response”| Field | Type | Example | Description |
|---|---|---|---|
| code | Integer | 200 | Status code |
| success | Boolean | true | Whether the request succeeded |
| msg | String | success | Response message |
Response Example
Section titled “Response Example”{ "success": true, "code": 200, "msg": "Operation succeeded", "data": null}Error Codes
Section titled “Error Codes”| Code | Description |
|---|---|
| 400 | Invalid parameters |
| 401 | Unauthorized |
| 403 | Access denied |
| 404 | Resource not found |
| 500 | Internal server error |