backend: update room status signal handling to use recordingInfo instead of EgressInfo
This commit is contained in:
parent
72b89da9c5
commit
14e40e1ccc
@ -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
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@ -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
|
||||
);
|
||||
|
||||
|
||||
@ -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);
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user