diff --git a/src/LiveKit/livekit.room.service.ts b/src/LiveKit/livekit.room.service.ts index 348ffde..1e312b1 100644 --- a/src/LiveKit/livekit.room.service.ts +++ b/src/LiveKit/livekit.room.service.ts @@ -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 }