Overview
Local recording suits recording “the call view the current user sees” in the browser: for example a 3-tile or 9-tile grid, the current page after paging, or a layout that prioritizes screen sharing. The SDK draws the video tracks you pass in onto an internal canvas, mixes the audio tracks into the same recording stream, and finally outputs a webm file throughMediaRecorder. Your app decides which videos to record right now and where each one goes on the recording canvas.
LocalCompositeRecorder only handles media compositing and the recording lifecycle and has no built-in call layout algorithm—your app passes in the layout based on the current UI view.
Basic usage
blob, you can download or upload it:
Start options
LocalCompositeRecorderStartOptions for start(options):
LocalCompositeRecorderVideoItem (a single video item):
Input tracks
BothvideoItems[].track and audioTracks[] accept an SDK Track or a native browser MediaStreamTrack:
LocalVideoTrackRemoteVideoTrackLocalAudioTrackRemoteAudioTrackMediaStreamTrack
MediaStreamTrack, with no action needed from your app.
Layout responsibility
LocalCompositeRecorder has no built-in call layout algorithm. Your app should generate videoItems based on the current UI view:
- If only 3 users are shown right now, pass only those 3 video items.
- If it’s a 9-tile grid, compute
rectfor 9 slots. - After the user pages left or right, call
updateVideoItems(...)to switch to the new page. - Special layouts such as screen sharing or speaker mode also have their
rectcomputed by your app.
Audio recommendations
For call recording, we generally recommend passing in both the local microphone track and the remote mixed audio track:remoteAudioMixTrack; to record only the local microphone, pass only localMicTrack.
Upload while recording
Passtimeslice and onDataAvailable to get data in chunks in real time, for uploading or writing to disk while recording, so long recordings don’t take up a lot of memory:
Note: webm chunks are a streaming container; a single chunk usually can’t be played on its own, and the server needs to concatenate them in order into a complete file.
State and cleanup
Notes
- Must run over HTTPS (or localhost);
AudioContextmay need a user gesture before it can start. - The output format is webm; browsers support different codecs (vp9/vp8/opus), and the SDK falls back to an available format automatically.
pause/resumeapply to the same final file and don’t produce multiple files.- The higher the recording resolution and frame rate, the higher the CPU usage; choose
width/height/fpsto suit your scenario.