Recording WebRTC conferences using headless Chrome - navigator object missing

I’m building a video conferencing app using Node.js and Express. I want to record the conference sessions on my server automatically. My idea was to use headless Chrome (with puppeteer) to join each meeting and capture the media streams. However, when I try to access the navigator object in the headless browser, it shows as undefined. Has anyone dealt with this issue before? If this approach won’t work, what other methods can I use to record WebRTC conferences server-side? I’m planning to use an SFU architecture, probably with Kurento media server.

I encountered a similar navigator undefined issue when attempting headless Chrome recording for WebRTC sessions about six months ago. The core problem stems from Chrome’s security model deliberately restricting media access in headless mode. While you can work around it with various launch arguments, the solution becomes fragile and resource-intensive. For production WebRTC recording, I’d recommend abandoning the browser-based approach entirely. Since you’re already considering Kurento, leverage its built-in recording modules instead. The RecorderEndpoint in Kurento can capture individual participant streams or composite recordings directly from the media server pipeline. This eliminates the overhead of running browser instances and provides more reliable recording quality. Alternative approaches include using GStreamer pipelines or integrating with cloud recording services like Agora’s cloud recording API if you want to avoid managing the recording infrastructure yourself.

yep, headless chrome does block navigator for security reasons. you can try using --enable-media-stream and --use-fake-ui-for-media-stream with puppeteer. but honestly, since you’ve got kurento, just recording on the media server will be way easier and faster!

The navigator object issue in headless Chrome is actually a common problem when working with WebRTC recording setups. I ran into this exact situation last year when building a similar system. What worked for me was launching puppeteer with specific flags including --disable-web-security and --allow-running-insecure-content alongside the media stream flags. However, after wrestling with this approach for weeks, I eventually moved to server-side recording through the media server itself. Since you’re already planning to use Kurento, you should definitely look into its recording capabilities - it can capture composite streams directly without needing a browser instance. The performance difference is substantial, and you avoid all the browser permission headaches. Another option worth considering is using a dedicated recording service like Janus or implementing FFmpeg-based recording if you need more control over the output format.