-
Notifications
You must be signed in to change notification settings - Fork 28
Classic API: Camera
Parent Document: ANT APIs
Camera API is the set of APIs for using and managing the camera on the device.
You need to load camera API module before you use its API as following.
var cameraApi = require(process.env.ANT_BIN_DIR + '/api/camera-api');
var camObj = new cameraApi.ANTRecording();
void recordingStart(Integer camera_id, String file_path, Integer seconds, Function callback);
recordingStart()
starts recording of the camera specified by camera_id
.
It records for the seconds
and stores recorded data in the file_path
.
After the recording is finished, the callback
function is called.
var cameraApi = require(process.env.ANT_BIN_DIR + '/api/camera-api');
var camObj = new cameraApi.ANTRecording();
camObj.recordingStart(0, process.env.ANT_DATA_DIR + "test.mp4”, 10, function() {
console.log(“Recording is finished”);
});
void recordingStop(Integer camera_id);
recordingStop()
stops all recording of the camera specified by camera_id
.
void snapshot(Integer camera_id, String file_path);
snapshot()
takes a snapshot of the current camera view specified by camera_id
.
It stores this snapshot in the file_path
.
void streamingStart(Integer camera_id, String ip_addr, Integer port);
streamingStart()
starts streaming of the camera specified by camera_id
.
It creates a tcp server with the ip_addr
and port
passed as parameters.
var cameraApi = require(process.env.ANT_BIN_DIR + '/api/camera-api');
var camObj = new cameraApi.ANTRecording();
camObj.streamingStart(0, “192.168.49.1”, 5000);
void streamingStop(Integer camera_id);
streamingStop()
stops streaming of the camera specified by camera_id
.
void sensorOverlayStart(Integer camera_id, String sensor_name);
sensorOverlayStart()
starts the sensor(sensor_name
) overlay on the camera video specified by camera_id
.
var cameraApi = require(process.env.ANT_BIN_DIR + '/api/camera-api');
var camObj = new cameraApi.ANTRecording();
camObj.sensorOverlayStart(0, “BUTTON”);
void sensorOverlayStop(Integer camera_id, String sensor_name);
sensorOverlayStop()
stops the sensor(sensor_name
) overlay on the camera video specified by camera_id
.
void delayStreamingStart(Integer camera_id, Integer delay_seconds);
delayStreamingStart()
starts delayed streaming of the camera specified by camera_id
for event recording.
It is similar to streamingStart()
, but does not require ip_addr
and port
.
Because it is set automatically by the camera manager.
Instead, you should set the delay_seconds
to how long the video will be delayed.
If delay
is 0, eventRecStart()
performs the same operation as recordingStart()
.
It must be called before using eventRecStart()
.
void delayStreamingStop(Integer camera_id);
delayStreamingStop()
stops delayed streaming of the camera specified by camera_id
.
It is similar to streamingStop()
.
void eventRecStart(Integer camera_id, String file_path, Integer seconds);
eventRecStart()
starts event recording of the camera specified by camera_id
.
To use it, delayStreamingStart()
must be called first.
Unlike recordingStart()
, it records from - delay_seconds
to seconds - delay_seconds
based on the current time.
It stores recorded data in file_path
.
var cameraApi = require(process.env.ANT_BIN_DIR + '/api/camera-api');
var camObj = new cameraApi.ANTRecording();
camObj.delayStreamingStart(0, 10);
setTimeout(function() {
console.log(“Event generation (after 15 seconds)”);
camObj.eventRecStart(0, process.env.ANT_DATA_DIR + "event_test.mp4”, 20);
console.log(“Stores recorded video from -10sec to 10sec”);
}, 15000);
void eventRecStop(Integer camera_id);
eventRecStop()
stops event recording of the camera specified by camera_id
.
- Home
- About
- Getting Started
-
ANT APIs
- ANT Classic API
- ANT Lite API
- Getting Involved