diff --git a/backend/src/helpers/ov-components-adapter.helper.ts b/backend/src/helpers/ov-components-adapter.helper.ts index 1986dad..339f5b8 100644 --- a/backend/src/helpers/ov-components-adapter.helper.ts +++ b/backend/src/helpers/ov-components-adapter.helper.ts @@ -28,14 +28,13 @@ export class OpenViduComponentsAdapterHelper { return { payload, options }; } - static generateRoomStatusSignal(recordingEgress: EgressInfo[], participantSid?: string) { - const isRecordingActive = recordingEgress.some((egress) => egress.status === EgressStatus.EGRESS_ACTIVE); + static generateRoomStatusSignal(recordingInfo: MeetRecordingInfo[], participantSid?: string) { + const isRecordingActive = recordingInfo.some((rec) => rec.status === MeetRecordingStatus.ACTIVE); const payload = { isRecordingStarted: isRecordingActive, - recordingList: recordingEgress.map((egress) => { - const recInfo = RecordingHelper.toRecordingInfo(egress); - return OpenViduComponentsAdapterHelper.parseRecordingInfoToOpenViduComponents(recInfo); - }) + recordingList: recordingInfo.map((rec) => + OpenViduComponentsAdapterHelper.parseRecordingInfoToOpenViduComponents(rec) + ) }; const options = { @@ -61,7 +60,7 @@ export class OpenViduComponentsAdapterHelper { duration: info.duration, size: info.size, location: undefined, - error: info.error, + error: info.error }; } diff --git a/backend/src/services/frontend-event.service.ts b/backend/src/services/frontend-event.service.ts index 9dd906e..70a5809 100644 --- a/backend/src/services/frontend-event.service.ts +++ b/backend/src/services/frontend-event.service.ts @@ -41,15 +41,17 @@ export class FrontendEventService { * with the room status to OpenVidu Components. If recording is not started, * it skips sending the signal. */ - async sendRoomStatusSignalToOpenViduComponents(roomId: string, participantSid: string) { + async sendRoomStatusSignalToOpenViduComponents( + roomId: string, + participantSid: string, + recordingInfo: MeetRecordingInfo[] + ) { this.logger.debug(`Sending room status signal for room ${roomId} to OpenVidu Components.`); try { - const recordingEgress = await this.livekitService.getRecordingsEgress(roomId); - // Construct the payload and signal options const { payload, options } = OpenViduComponentsAdapterHelper.generateRoomStatusSignal( - recordingEgress, + recordingInfo, participantSid ); diff --git a/backend/src/services/livekit-webhook.service.ts b/backend/src/services/livekit-webhook.service.ts index 7287fe5..15828b8 100644 --- a/backend/src/services/livekit-webhook.service.ts +++ b/backend/src/services/livekit-webhook.service.ts @@ -147,7 +147,12 @@ export class LivekitWebhookService { if (this.livekitService.isEgressParticipant(participant)) return; try { - await this.frontendEventService.sendRoomStatusSignalToOpenViduComponents(room.name, participant.sid); + const { recordings } = await this.recordingService.getAllRecordings({ roomId: room.name }); + await this.frontendEventService.sendRoomStatusSignalToOpenViduComponents( + room.name, + participant.sid, + recordings + ); } catch (error) { this.logger.error('Error sending room status signal on participant join:', error); }