axiscam
v0.1.1
Published
Axis (VAPIX) camera control in Node
Downloads
2
Readme
AxisCam
Axis (VAPIX) camera control in Node
Run
To run, make a settings.json file in the root folder:
{
"url": "https://<user>:<passwd>@<addr>",
"name": "Name for the camera",
"motion": false
}
This provides the address and credentials for the camera, an optional name and whether to emit any detected motion events (defaults to False).
Test
To run the tests, create a settings.json file in the test folder to point to a test camera.
Motion Detection
If motion detection is activted, a motion stream is automatically started and any motion messages where the motion value exceeds the threshold value is emitted.
var axis = require('lib/axis'),
util = require('util')
var axisCam = axis.createClient({url: 'https://<user>:<passwd>@<addr>'})
axis.on('motion', function(data) {
util.inspect(data)
})
API
###createImageStream
Streams an image from the camera:
var axis = require('lib/axis'),
fs = require('fs')
var axisCam = axis.createClient({url: 'https://<user>:<passwd>@<addr>'})
axisCam.createImageStream().pipe(fs.createWriteStream('./image.jpg'))
###createVideoStream
Streams MJPEG
###createMotionStream
Creates a stream of javascript objects that represent a snapshot of the Axis camera's motion detection:
{group: 0, level: 2, threshold: 10}
var axis = require('lib/axis'),
es = require('event-stream')
var axisCam = axis.createClient({url: 'https://<user>:<passwd>@<addr>'})
axisCam.createMotionStream().pipe(es.stringify()).pipe(process.stdout)