Is there a way to use livekit's egress along with ...
# ask-ai
b
Is there a way to use livekit's egress along with hyperbeam to record the session?
✅ 1
t
Thanks for reaching out, Roni. I'm an AI assistant and I'm here to help. Give me a moment while I research this topic.
Thanks — I’m responding to your question about using LiveKit’s egress together with Hyperbeam to record a session. I don’t have a ready-made integration to point to, so a couple quick clarifying questions to help me recommend the best approach: • Do you want LiveKit to record the LiveKit audio/video tracks and Hyperbeam to render a remote web session (or vice versa)? • Is the Hyperbeam session running inside a LiveKit room (i.e., a Hyperbeam client published as a participant), or is Hyperbeam separate and you want to combine its output with LiveKit’s streams? • Do you need a single merged recording (mixed video+audio) or separate recordings per source? Based on your answers I can outline concrete options (for example: publishing Hyperbeam’s rendered output into LiveKit as a participant so LiveKit egress can record/mix it, or using Hyperbeam’s own output stream and sending that to an egress webhook/RTMP target). Which direction should I plan for? , with interactive elements
b
I want to publish hyperbeams rendered output into livekit.
t
Great — you're looking to publish Hyperbeam's rendered output into a LiveKit room so LiveKit egress can record it. That’s doable. Below are concise options and a recommended approach; tell me which fits your setup and I’ll give code snippets. Recommended approach (most straightforward) 1. Render Hyperbeam into a DOM element or canvas in the browser. 2. Use canvas.captureStream() (or capture the element’s media stream) to get a MediaStream. 3. Publish the stream’s video track to LiveKit as a participant video track: ◦ Example: get the canvas element, call
canvas.captureStream(fps)
, take
stream.getVideoTracks()[0]
, then
localParticipant.publishTrack(videoTrack, { source: Track.Source.ScreenShare })
. 1. Start LiveKit Universal Egress (Room Composite or Track Composite) to record the room or the published track. Notes and alternatives • If Hyperbeam provides a MediaStream directly (instead of canvas), publish that stream’s track the same way. • Use Room Composite if you want a single merged recording (headless Chrome renders the room). Use Track Egress/Track Composite for per-track exports. • Send control/metadata over LiveKit data channels if you need synchronized events or captions. Questions to finalize guidance • Are you rendering Hyperbeam to a canvas element or receiving a MediaStream from Hyperbeam? • Do you want a single merged recording (one video of the room) or separate recordings per participant/track? Tell me which option you want and whether you need code for a web SDK example; I’ll provide a targeted snippet. Sources: Streaming video from a canvas with WebRTC and React | LiveKit | Streaming video from a canvas with WebRTC and React | LiveKit | Real-time audio and video in the metaverse | LiveKit | Real-time audio and video in the metaverse | LiveKit | Universal Egress | LiveKit, with interactive elements
b
I am using the hyperbeam/web sdk that uses iframe to stream the remote chromium browser session
t
Thanks — since Hyperbeam renders the remote browser inside an iframe, here are practical ways to publish that output into LiveKit so egress can record it. Which one fits depends on whether you can access the iframe's content/frame. Option A — iframe content is same-origin or Hyperbeam provides a MediaStream • If you can get a MediaStream directly from Hyperbeam (preferred) or access the iframe’s rendered canvas: a. Obtain the MediaStream or capture a canvas:
const stream = canvas.captureStream(30)
or use the provided stream. b. Get the video track:
const videoTrack = stream.getVideoTracks()[0]
. c. Publish to LiveKit:
await localParticipant.publishTrack(videoTrack, { source: Track.Source.ScreenShare })
. d. Start LiveKit Egress (Room Composite for a merged recording or Track Egress for per-track files). Option B — iframe is cross-origin (no direct access) • If you cannot capture the iframe (cross-origin) and Hyperbeam cannot provide a stream, you can: ◦ Run a headless capture in a secure renderer (a small headless Chromium instance or a server-side renderer) that loads the Hyperbeam session and forwards its output as a MediaStream/RTMP to LiveKit egress or publishes into the room as a participant. ◦ Or ask Hyperbeam for a direct output API (MediaStream/track) you can consume client-side. Notes • Room Composite records what’s published in the room (uses headless Chrome to layout/record). Track Egress exports individual tracks. • Use data channels for metadata or sync signals if needed. • Aim for hardware-accelerated encoding and match capture FPS/bitrate to reduce latency. Quick question to finalize a concrete snippet: • Can you access the iframe DOM or does Hyperbeam provide a MediaStream from the SDK? If yes, I’ll provide a Web SDK code example., with interactive elements