boundless-battery-65494
08/12/2025, 5:48 AMtall-airline-16756
08/12/2025, 5:48 AMtall-airline-16756
08/12/2025, 5:49 AMEgressClient
from the LiveKit SDK to manage the recording process.
2. Configure S3 Storage: Use EncodedFileOutput
along with an S3Upload
configuration to add your AWS credentials and bucket info.
3. Start the Room Composite Egress: Call startRoomCompositeEgress
on the Egress client with the right parameters to kick off the recording.
Here's a handy example code snippet to get you started:
const { EgressClient, EncodedFileOutput, S3Upload } = require('livekit-server-sdk');
// Initialize the EgressClient with your LiveKit host and API credentials
const liveKitHost = process.env.LIVEKIT_HOST; // Pop in your LiveKit host here
const liveKitApiKey = process.env.LIVEKIT_API_KEY; // Your API key goes here
const liveKitApiSecret = process.env.LIVEKIT_API_SECRET; // And your API secret here
const egressClient = new EgressClient(
liveKitHost,
liveKitApiKey,
liveKitApiSecret
);
// Set up your S3 configuration for saving the recording
const s3Config = new S3Upload({
accessKey: process.env.AWS_ACCESS_KEY, // Your AWS access key
secret: process.env.AWS_SECRET_KEY, // Your AWS secret key
region: process.env.AWS_REGION, // The AWS region you're using
bucket: process.env.S3_BUCKET_NAME, // Your S3 bucket name
});
// Define the file output, linking it to the S3 setup
const fileOutput = new EncodedFileOutput({
filepath: 'path/to/your-recording.mp4',
output: {
case: 's3',
value: s3Config,
},
});
// Start recording the specified room with the chosen layout
egressClient.startRoomCompositeEgress(
'your-room-name',
{ file: fileOutput },
{ layout: 'speaker' }
).then((result) => {
console.log('Recording started:', result);
}).catch((error) => {
console.error('Oops, something went wrong starting the recording:', error);
});
Just a few quick tips:
• Keep your AWS credentials safe and never expose them in client-side code.
• Feel free to customize the filepath
to keep your recordings nicely organized in your S3 bucket.
• Make sure the AWS region matches where your S3 bucket is located.
With this setup, you'll be able to record audio sessions and have them saved straight to your Amazon S3 bucket without any hassle. If you have any questions or run into issues, I'm here to help!boundless-battery-65494
08/12/2025, 5:50 AMtall-airline-16756
08/12/2025, 5:50 AMboundless-battery-65494
08/12/2025, 5:51 AMtall-airline-16756
08/12/2025, 5:52 AMboundless-battery-65494
08/12/2025, 5:54 AMtall-airline-16756
08/12/2025, 5:54 AMboundless-battery-65494
08/12/2025, 5:57 AMtall-airline-16756
08/12/2025, 5:58 AMboundless-battery-65494
08/12/2025, 6:43 AMboundless-battery-65494
08/12/2025, 6:43 AM