feat: add room egress functionality to LiveKitRoomService
- Introduced RoomEgress to enable recording of meeting rooms with S3 storage configuration. - Updated createServiceMeetingRoom method to include egress settings for room recording. - Enhanced integration with LiveKit by allowing dynamic file path generation for recordings.
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
import { Injectable } from '@nestjs/common'
|
||||
// @ts-expect-error
|
||||
import { Room, RoomServiceClient } from 'livekit-server-sdk'
|
||||
import { Room, RoomServiceClient, RoomEgress } from 'livekit-server-sdk'
|
||||
import { LiveKitEgressService } from './livekit.egress'
|
||||
|
||||
@Injectable()
|
||||
@@ -10,15 +10,28 @@ export class LiveKitRoomService {
|
||||
process.env.LIVEKIT_API_KEY as string,
|
||||
process.env.LIVEKIT_API_SECRET as string,
|
||||
)
|
||||
private readonly roomEgress = new RoomEgress({
|
||||
tracks: {
|
||||
output: {
|
||||
case: 's3',
|
||||
value: {
|
||||
bucket: process.env.RECORDING_BUCKET_NAME as string,
|
||||
accessKey: process.env.MINIO_ACCESS_KEY as string,
|
||||
secret: process.env.MINIO_SECRET_KEY as string,
|
||||
endpoint: process.env.MINIO_ENDPOINT as string,
|
||||
},
|
||||
},
|
||||
filepath: '${roomName}/${roomName}-${start_time}',
|
||||
},
|
||||
})
|
||||
constructor(private readonly egressService: LiveKitEgressService) {}
|
||||
|
||||
async createServiceMeetingRoom(roomId: string) {
|
||||
const room = await this.roomServiceClient.createRoom({
|
||||
name: roomId,
|
||||
maxParticipants: 2,
|
||||
egress: this.roomEgress,
|
||||
})
|
||||
// start recording
|
||||
await this.egressService.startRecording(roomId)
|
||||
return room
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user