From a live audio stream to a shareable recording
A live call and a saved recording need different handling. The call captures microphone audio, sends it over Socket.IO, and plays incoming PCM audio through the Web Audio API. Exporting that conversation adds encoding work to a browser already handling audio.
I used FFmpeg.wasm for the export. Its runtime loads when an export is requested and can be reused for later downloads. The conversion takes the recorded samples, encodes the audio, and combines it with the agent’s portrait to produce an MP4.
The portrait is scaled and padded to fit the output without stretching, and the video runs for the recording’s duration. After a successful export, the implementation removes the temporary files from FFmpeg’s in-memory filesystem. People can save or share the resulting video directly from the application.
