lively-terabyte-73999
08/05/2025, 10:07 AMtall-airline-16756
08/05/2025, 10:07 AMtall-airline-16756
08/05/2025, 10:08 AMstartRoomCompositeEgress method from LiveKit's EgressClient. Here's an example:
const { EgressClient, SegmentedFileOutput, EncodingOptionsPreset, SegmentedFileProtocol } = require('@livekit/protocol');
// Initialize the Egress client with your LiveKit host and credentials
const egressClient = new EgressClient(
'<http://your-livekit-server.io|your-livekit-server.io>',
'your-api-key',
'your-api-secret'
);
// Define the output configuration (e.g., for HLS segments)
const segmentedOutput = new SegmentedFileOutput({
filenamePrefix: 'livekit-demo/room-composite-test-',
playlistName: 'room-composite-test.m3u8',
segmentDuration: 6,
protocol: SegmentedFileProtocol.HLS_PROTOCOL,
preset: EncodingOptionsPreset.PORTRAIT_H264_720P_30,
});
// Start the room composite egress
const info = await egressClient.startRoomCompositeEgress('my-room', {
segments: segmentedOutput
});
// Get the egress ID for further operations
const egressId = info.egressId;
Key Points:
• roomName: Specify the name of the room to record.
• Output Configuration: Use SegmentedFileOutput for HLS or other formats like EncodedFileOutput or StreamOutput.
• Options: Configure layout, audio-only, video-only, or custom base URLs as needed.
Ensure your Egress client has the necessary permissions, such as roomRecord. Let me know if you need further assistance!