I am trying to stream a camera pictures continuously from a camera module. Do you know how o launch another spawn once the previous spawn finished? Currently I am getting an error that "startCamera" function is not found once on "exit" event is executed by the child process.
var spawn = require('child_process').spawn;
module.exports = {
cameraProcess: null,
startCamera: function () {
var isWin = /^win/.test(process.platform);
var path = require('path');
if (isWin) {
this.cameraProcess = spawn(path.join(__dirname, 'vfwgrab', 'VFWGrab.exe'));
} else {
var args = ["-w", "640", "-h", "480", "-o", "./public/stream/stream.jpg", "-t", "999999999", "-tl", "2000"];
this.cameraProcess = spawn('raspistill', args);
}
this.cameraProcess.on('exit', this.loopCamera);
},
loopCamera: function (code) {
startCamera(); //loop the camera
}
};
via peterdk
No comments:
Post a Comment