我在我的 NodeJS 应用程序中使用 Fluent FFMpeg,并尝试在输入不存在的情况下添加一些错误处理。目前它只是因为这条消息而崩溃:
events.js:72
throw er; // Unhandled 'error' event
^
Error: ffmpeg exited with code 1: http://localhost:9001: Connection refused
当输入源不存在时,我想等待一段时间(比如 1 秒)然后重试。这是目前我的代码:
var command = FFmpeg("http://localhost:9001")
// set options here
;
var stream = command.pipe();
stream.on('data', function(chunk) {
// do something with the data
});
当输入(尚)不存在时,如何正确处理错误?