node-cam

0.0.1 • Public • Published

node-cam

Node-cam is a node js library for controlling ip cameras. This library is still in development and should not be used in its current form.

Version

0.0.1 (pre-release)

Installation

$ npm install node-cam

Usage

Node-cam works with a wide variety of cameras and supports a limitless number of cameras.

To use Node-cam with a single camera, you can use the following code:

var nodecam = require("node-cam");
var camera_config = require('./path/to/camera/config/file');
var cam = nodecam.createCamera(camera_config);
cam.snapshot('./path/to/snapshot/directory');

To use Node-cam with a multiple cameras, you can use the following code:

var nodecam = require("node-cam");
var camera_config = require('./path/to/camera/config/file');
var cameras = [];
for(c in camera_config){
    cameras.push(nodecam.createCamera(camera_config[c]));
}
cam[0].snapshot('./path/to/snapshot/directory');
cam[1].snapshot('./path/to/snapshot/directory');

Example Config File

Single camera:

{
    "type":"foscam_hd",
    "name":"my_ip_camera",
    "host":"192.168.0.1",
    "port":"88",
    "user":"admin",
    "pass":"",
    "directories":{
        "images":"./my_ip_camera/image",
        "videos":"./my_ip_camera/video"
    }
}

Multiple cameras:

{
    "cameras": [
        {
            "type":"foscam_hd",
            "name":"camera1",
            "host":"192.168.0.1",
            "port":"88",
            "user":"admin",
            "pass":"",
            "directories":{
                "images":"./camera1/image",
                "videos":"./camera1/video"
            }
        },{
            "name":"camera2",
            "host":"192.168.0.2",
            "port":"88",
            "user":"admin",
            "pass":"",
            "directories":{
                "images":"./camera2/image",
                "videos":"./camera2/video"
            }
        }
    ]
}

Development

Node-cam is built to allow a wide assortment of ip cams. To add support for a new type of camera, you only need to create a new camera definition file (see ./cameras/example_camera.js).

Feel free to contribute to the overall project or submit your own camera definitions to be added to the project. All contributed code must fall under the MIT license.

Todo's

  • Finish initial codebase.
  • Finish foscam HD and MJPEG

License

MIT

Package Sidebar

Install

npm i node-cam

Weekly Downloads

2

Version

0.0.1

License

MIT

Last publish

Collaborators

  • khadaj