Closed RobertoUa closed 10 months ago
this is required, because some packets might be delayed and take some time to get delivered, the timeout ensures that these packets arrive and the full length of the video is recorded.
at least make the timeout configurable
and you can also check if socket is already closed before creating timeout
Done in puppeteer-stream@3.0.7
:
const stream = getStream(page, {
streamConfig: {
closeTimeout: 5000
}
})
btw, since we're talking about script closing, I sometimes get (Runtime.callFunctionOn): Target closed
when extension.evaluate((index) => STOP_RECORDING(index), index)
is run.
I belive you can a catch there.
this is great! thank you so much! Especially for the fastest response ever! The requirement of my app is to shutdown as fast as possible when everything is processed (ffmpeg was already closed at that point and video produced)
can you please catch errors in extension.evaluate((index) => STOP_RECORDING(index), index)
I get this most of the time
uncaughtException: Protocol error (Runtime.callFunctionOn): Target closed
TargetCloseError: Protocol error (Runtime.callFunctionOn): Target closed
The issue is with this setTimeout. Please add
.unref()
so that exit is not delayed. Browser and ffmpeg is already closed so there no need to wait for this https://github.com/SamuelScheit/puppeteer-stream/blob/main/src/PuppeteerStream.ts#L186