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 };
|
return { payload, options };
|
||||||
}
|
}
|
||||||
|
|
||||||
static generateRoomStatusSignal(recordingEgress: EgressInfo[], participantSid?: string) {
|
static generateRoomStatusSignal(recordingInfo: MeetRecordingInfo[], participantSid?: string) {
|
||||||
const isRecordingActive = recordingEgress.some((egress) => egress.status === EgressStatus.EGRESS_ACTIVE);
|
const isRecordingActive = recordingInfo.some((rec) => rec.status === MeetRecordingStatus.ACTIVE);
|
||||||
const payload = {
|
const payload = {
|
||||||
isRecordingStarted: isRecordingActive,
|
isRecordingStarted: isRecordingActive,
|
||||||
recordingList: recordingEgress.map((egress) => {
|
recordingList: recordingInfo.map((rec) =>
|
||||||
const recInfo = RecordingHelper.toRecordingInfo(egress);
|
OpenViduComponentsAdapterHelper.parseRecordingInfoToOpenViduComponents(rec)
|
||||||
return OpenViduComponentsAdapterHelper.parseRecordingInfoToOpenViduComponents(recInfo);
|
)
|
||||||
})
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const options = {
|
const options = {
|
||||||
@ -61,7 +60,7 @@ export class OpenViduComponentsAdapterHelper {
|
|||||||
duration: info.duration,
|
duration: info.duration,
|
||||||
size: info.size,
|
size: info.size,
|
||||||
location: undefined,
|
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,
|
* with the room status to OpenVidu Components. If recording is not started,
|
||||||
* it skips sending the signal.
|
* 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.`);
|
this.logger.debug(`Sending room status signal for room ${roomId} to OpenVidu Components.`);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const recordingEgress = await this.livekitService.getRecordingsEgress(roomId);
|
|
||||||
|
|
||||||
// Construct the payload and signal options
|
// Construct the payload and signal options
|
||||||
const { payload, options } = OpenViduComponentsAdapterHelper.generateRoomStatusSignal(
|
const { payload, options } = OpenViduComponentsAdapterHelper.generateRoomStatusSignal(
|
||||||
recordingEgress,
|
recordingInfo,
|
||||||
participantSid
|
participantSid
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|||||||
@ -147,7 +147,12 @@ export class LivekitWebhookService {
|
|||||||
if (this.livekitService.isEgressParticipant(participant)) return;
|
if (this.livekitService.isEgressParticipant(participant)) return;
|
||||||
|
|
||||||
try {
|
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) {
|
} catch (error) {
|
||||||
this.logger.error('Error sending room status signal on participant join:', error);
|
this.logger.error('Error sending room status signal on participant join:', error);
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user