0
我试图从相机模块中连续传输相机图片。你知道一旦前一次产卵完成后如何发射另一颗卵子? 目前我收到一个错误,“startCamera”函数在子进程执行“exit”事件后没有找到。如何在出口循环中运行nodejs产卵
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) {
this.startCamera(); //start the next spawn once the previous finished
}
};