胡斌

close app 5s later after closing pipe ,to let the ffmpeg flush mp4 moov

正在显示 1 个修改的文件 包含 11 行增加3 行删除
... ... @@ -23,9 +23,15 @@ ipc.on('close-main-window', function () {
var lastRenderTime = 0;
ipc.on('to-main-timer', function () {
if(Date.now() - lastRenderTime >= 10000){
if (Date.now() - lastRenderTime >= 10000) {
if (streamIn) {
streamIn.end();
streamIn = null;
}
if (Date.now() - lastRenderTime >= 15000) {
quit();
}
}
}
});
var subarg = require('subarg');
... ... @@ -113,7 +119,9 @@ win.webContents.executeJavaScript('const ipcToMain = require("electron").ipcRend
streamIn = null;
}
console.log("done")
win.webContents.executeJavaScript('require("electron").ipcRenderer.send("close-main-window")');
if(elapsed > duration + 5000){//delay 5s after closing pipe ,then close
win.webContents.executeJavaScript('require("electron").ipcRenderer.send("close-main-window")');
}
}
else {
streamIn.write(image.getBitmap());
... ...