backend: update ov-components room status signal handling to use recording egress data
This commit is contained in:
parent
1ab0764ac4
commit
e1f60ab3c1
@ -1,5 +1,6 @@
|
|||||||
import { MeetRecordingInfo, MeetRecordingStatus } from '@typings-ce';
|
import { MeetRecordingInfo, MeetRecordingStatus } from '@typings-ce';
|
||||||
import { SendDataOptions } from 'livekit-server-sdk';
|
import { EgressInfo, EgressStatus, SendDataOptions } from 'livekit-server-sdk';
|
||||||
|
import { RecordingHelper } from './recording.helper.js';
|
||||||
|
|
||||||
const enum OpenViduComponentsDataTopic {
|
const enum OpenViduComponentsDataTopic {
|
||||||
CHAT = 'chat',
|
CHAT = 'chat',
|
||||||
@ -27,9 +28,14 @@ export class OpenViduComponentsAdapterHelper {
|
|||||||
return { payload, options };
|
return { payload, options };
|
||||||
}
|
}
|
||||||
|
|
||||||
static generateRoomStatusSignal(isRecordingStarted: boolean, participantSid?: string) {
|
static generateRoomStatusSignal(recordingEgress: EgressInfo[], participantSid?: string) {
|
||||||
|
const isRecordingActive = recordingEgress.some((egress) => egress.status === EgressStatus.EGRESS_ACTIVE);
|
||||||
const payload = {
|
const payload = {
|
||||||
isRecordingStarted
|
isRecordingStarted: isRecordingActive,
|
||||||
|
recordingList: recordingEgress.map((egress) => {
|
||||||
|
const recInfo = RecordingHelper.toRecordingInfo(egress);
|
||||||
|
return OpenViduComponentsAdapterHelper.parseRecordingInfoToOpenViduComponents(recInfo);
|
||||||
|
})
|
||||||
};
|
};
|
||||||
|
|
||||||
const options = {
|
const options = {
|
||||||
|
|||||||
@ -45,18 +45,11 @@ export class FrontendEventService {
|
|||||||
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 {
|
||||||
// Check if recording is started in the room
|
const recordingEgress = await this.livekitService.getRecordingsEgress(roomId);
|
||||||
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
|
// Construct the payload and signal options
|
||||||
const { payload, options } = OpenViduComponentsAdapterHelper.generateRoomStatusSignal(
|
const { payload, options } = OpenViduComponentsAdapterHelper.generateRoomStatusSignal(
|
||||||
isRecordingStarted,
|
recordingEgress,
|
||||||
participantSid
|
participantSid
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user