How to record web conferences using a headless browser in Node.js?

I’m building a web conference app using Node.js and Express. I need to record these conferences on the server. I thought about using a headless browser like Puppeteer to join each conference and capture the screen media streams. But I ran into a problem. The navigator object is undefined on my headless page. Does anyone know a way around this? If not, can someone with experience suggest another method for recording these conferences on the server? I’m planning to use WebRTC, probably with an SFU setup using Kurento. Any ideas or tips would be really helpful!

I’ve actually implemented something similar in my work. One approach that worked well for us was using MediaSoup as our WebRTC SFU. It has a built-in recording feature that can capture the conference without needing a headless browser.

If you really need to use a browser-based solution, I’d recommend looking into Playwright instead of Puppeteer. It has better support for handling media streams and provides more control over browser behavior.

Another option we explored was using ffmpeg to capture the RTMP stream from our media server. This method was more lightweight but required some additional setup.

Whatever route you choose, make sure to consider scalability and resource usage. Server-side recording can be quite demanding, especially with multiple concurrent sessions.

Recording web conferences server-side can be tricky. Have you considered using a WebRTC-compatible media server like Janus or mediasoup? These often have built-in recording capabilities that don’t require a headless browser. Alternatively, you could look into capturing the media streams directly in your Node.js app using a library like node-webrtc. This approach bypasses the need for a browser altogether. If you’re set on using a headless browser, you might need to inject a custom navigator object or use a more fully-featured solution like Playwright. Just be aware that server-side recording can be resource-intensive, so you’ll need to plan your infrastructure accordingly.

hey ethan, have u tried selenium? maybe it works better with the navigator obj. you could also mock it in puppeteer. if not, consider ffmpeg or gstreamer for server-side recording. good luck!