diff --git a/backend/src/services/recording.service.ts b/backend/src/services/recording.service.ts index 028c75a..bb12609 100644 --- a/backend/src/services/recording.service.ts +++ b/backend/src/services/recording.service.ts @@ -486,9 +486,15 @@ export class RecordingService { * and sends it to the OpenVidu Components in the given room. The payload * is adapted to match the expected format for OpenVidu Components. */ - sendRecordingSignalToOpenViduComponents(roomId: string, recordingInfo: MeetRecordingInfo) { + async sendRecordingSignalToOpenViduComponents(roomId: string, recordingInfo: MeetRecordingInfo) { + this.logger.debug(`Sending recording signal to OpenVidu Components for room '${roomId}'`); const { payload, options } = OpenViduComponentsAdapterHelper.generateRecordingSignal(recordingInfo); - return this.roomService.sendSignal(roomId, payload, options); + + try { + await this.roomService.sendSignal(roomId, payload, options); + } catch (error) { + this.logger.debug(`Error sending recording signal to OpenVidu Components for room '${roomId}': ${error}`); + } } /** diff --git a/backend/src/services/room.service.ts b/backend/src/services/room.service.ts index e2a9b55..f4dd59a 100644 --- a/backend/src/services/room.service.ts +++ b/backend/src/services/room.service.ts @@ -326,22 +326,28 @@ export class RoomService { } async sendRoomStatusSignalToOpenViduComponents(roomId: string, participantSid: string) { - // Check if recording is started in the room - const activeEgressArray = await this.livekitService.getActiveEgress(roomId); - const isRecordingStarted = activeEgressArray.length > 0; + this.logger.debug(`Sending room status signal for room ${roomId} to OpenVidu Components.`); - // Skip if recording is not started - if (!isRecordingStarted) { - return; + try { + // Check if recording is started in the room + const activeEgressArray = await this.livekitService.getActiveEgress(roomId); + const isRecordingStarted = activeEgressArray.length > 0; + + // Skip if recording is not started + if (!isRecordingStarted) { + return; + } + + // Construct the payload and signal options + const { payload, options } = OpenViduComponentsAdapterHelper.generateRoomStatusSignal( + isRecordingStarted, + participantSid + ); + + await this.sendSignal(roomId, payload, options); + } catch (error) { + this.logger.debug(`Error sending room status signal for room ${roomId}:`, error); } - - // Construct the payload and signal options - const { payload, options } = OpenViduComponentsAdapterHelper.generateRoomStatusSignal( - isRecordingStarted, - participantSid - ); - - await this.sendSignal(roomId, payload, options); } /** @@ -354,7 +360,7 @@ export class RoomService { */ async sendSignal(roomId: string, rawData: Record, options: SendDataOptions): Promise { this.logger.verbose(`Notifying participants in room ${roomId}: "${options.topic}".`); - this.livekitService.sendData(roomId, rawData, options); + await this.livekitService.sendData(roomId, rawData, options); } /**