Thanks — I’m replying to your clarification about launching a browser on the server (a remote/browser-in-the-cloud) to live stream into LiveKit.
Short answer: LiveKit Agents cannot themselves launch or control a browser instance on a remote machine. Agents run server-side and connect to LiveKit via WebRTC or SDKs, but they don’t include an embedded browser automation feature.
That said, you can accomplish your goal by running a headless browser or a browser automation container on your server (or in the cloud) and having that browser act as the LiveKit client. In other words, instead of asking the LiveKit agent to open a browser, you run a separate server-side browser process that publishes to LiveKit. Typical approaches:
• Headless browser + WebRTC client in Node
◦ Run a headless Chromium (Puppeteer) or Playwright process on a server.
◦ Inside that browser context use the LiveKit JavaScript client to capture/stream media (e.g., via getUserMedia replacement or by streaming generated video frames / audio).
◦ The headless browser joins the LiveKit room with a normal access token and publishes the stream.
• Media pipeline / WebRTC gateway
◦ Use a server-side WebRTC client library (for example a Node, Python, or native WebRTC client) that can publish media programmatically without a real browser. The agent can run such a client to publish pre-recorded or generated media to LiveKit.
◦ This avoids needing an actual browser UI; you push audio/video frames through the WebRTC stack directly.
• Browser-in-container services
◦ Run browser instances in containers (Kubernetes pods, serverless containers, or a managed headless-browser service). Each container runs the LiveKit JS client to join rooms and publish streams.
Important considerations
• Capturing media: Headless browsers don’t have physical cameras/microphones. You’ll need to:
◦ Inject synthetic media (canvas/video frames, prerecorded files) into the browser MediaStream, or
◦ Use virtual devices or media-emulation libraries that feed audio/video into getUserMedia.
• Resource and scaling: Headless browser instances are CPU/memory intensive. Plan for scaling, orchestration, and monitoring.
• Audio/video latency and encoding: Ensure your headless/browser environment can produce suitably encoded frames and maintain real-time constraints for WebRTC.
• Security & tokens: Each server-side browser client still needs a valid LiveKit access token to join rooms. Manage token issuance and permissions securely.
If you’d like, I can help with any of the following next steps:
• A short architecture outline for either a headless-browser approach or a server-side WebRTC client approach.
• Example code snippets for running LiveKit in a headless Chromium via Puppeteer (how to inject a MediaStream) or for a server-side WebRTC publisher.
• Guidance on token management and scaling options.
Which approach are you leaning toward — a headless browser (Puppeteer/Playwright), a pure server-side WebRTC client, or containers/orchestration for many instances?