/wansview

[UNMAINTAINED] Wansview webcam controller for direction and taking pictures

Primary LanguageJavaScriptMIT LicenseMIT

Wansview

Wansview webcam controller for direction and taking pictures

Only tested with Wansview NC541W

Install

npm install wansview

Usage

var Webcam = require('wansview')
var webcam = new Webcam('192.168.1.178', 'admin', '123456')

webcam.left()

setTimeout(function(){
  webcam.stop()
  webcam.snapshot('leftUp.png')
}, 5000)

Commands

Movement:

webcam.up()
webcam.down()
webcam.left()
webcam.right()
webcam.rightUp()
webcam.rightDown()
webcam.leftUp()
webcam.leftDown()

Panning:

webcam.panHorizontal()
webcam.panVertical()

Take picture:

webcam.snapshot() // returns a stream

Stream multiple images:

webcam.jpegStream() // returns a stream

Example

Control the webcam movement from an xbox controller:

var XboxController = require('xbox-controller'),
    fs = require('fs');
var xbox = new XboxController

var Webcam = require('wansview')
var webcam = new Webcam('192.168.1.178', 'admin', '123456')

var arrows = ["dup","ddown", "dleft", "dright"]

arrows.forEach(function(element, index, array) {
  xbox.on(element + ':press', function (key) {
    webcam[element.slice(1)]()
  });

  xbox.on(element + ':release', function (key) {
    webcam.stop()
  });
})

xbox.on('a:press', function (key) {
  webcam.snapshot.pipe(fs.createWriteStream((new Date).toString() + '.png'));
});

Rabbit tracking webcam

Copyright

Copyright (c) 2013 Andrew Nesbitt. See LICENSE for details.