You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Node doesn't exit after renderMedia()/renderFrames() unless closeBrowser() is called #21
When I use the renderer API from a script, the process keeps running after the render and stitch are finished:
importpathfrom'node:path';import{bundle}from'@rendiv/bundler';import{selectComposition,renderMedia}from'@rendiv/renderer';constserveUrl=awaitbundle({entryPoint: path.resolve('src/index.tsx')});constcomposition=awaitselectComposition(serveUrl,'MyComp');awaitrenderMedia({ serveUrl, composition,outputLocation: 'out/out.mp4'});console.log('done');// prints, but the process never exits
It's the shared Chromium from openBrowser(). It stays open after the render, and its child processes keep the event loop alive. process.getActiveResourcesInfo() after done shows two ProcessWrap and six PipeWrap handles, and the process was still running 45 s later (master 6d6aca2, Windows 11, Node 24). Adding await closeBrowser() at the end fixes it, and the process exits right away. I first suspected Vite's esbuild from bundle() as well, but it isn't holding anything open.
I see the CLI already calls closeBrowser() in a finally, and I guess the browser is kept open on purpose so later renders are faster. So I think the simplest fix is to mention it in the docs, which don't cover closeBrowser() right now. I opened #28 for that. While I was there I also fixed the usage example: it imports bundle from @rendiv/renderer and passes compositionId, which renderMedia doesn't take.
If you'd rather handle it in code, something like a closeBrowserWhenDone option would work too.
Activity