frontend: Send meeting_ended event when participante left with room deleted reason

This commit is contained in:
Carlos Santos 2025-05-13 12:43:25 +02:00
parent e45420ac0f
commit d71111e415

View File

@ -8,7 +8,8 @@ import {
ApiDirectiveModule,
ParticipantLeftEvent,
ParticipantModel,
OpenViduComponentsUiModule
OpenViduComponentsUiModule,
ParticipantLeftReason
} from 'openvidu-components-angular';
import {
@ -129,15 +130,28 @@ export class VideoRoomComponent implements OnInit, OnDestroy {
console.warn('Participant left the room. Redirecting to:');
const redirectURL = this.ctxService.getLeaveRedirectURL() || '/disconnected';
const isExternalURL = /^https?:\/\//.test(redirectURL);
const isRoomDeleted = event.reason === ParticipantLeftReason.ROOM_DELETED;
let message: OutboundEventMessage<WebComponentEvent.MEETING_ENDED | WebComponentEvent.LEFT>;
if (isRoomDeleted) {
message = {
event: WebComponentEvent.MEETING_ENDED,
payload: {
roomId: event.roomName
}
} as OutboundEventMessage<WebComponentEvent.MEETING_ENDED>;
} else {
message = {
event: WebComponentEvent.LEFT,
payload: {
roomId: event.roomName,
participantName: event.participantName,
reason: event.reason
}
} as OutboundEventMessage<WebComponentEvent.LEFT>;
}
const message: OutboundEventMessage = {
event: WebComponentEvent.LEFT,
payload: {
roomId: event.roomName,
participantName: event.participantName,
reason: event.reason
}
};
this.wcManagerService.sendMessageToParent(message);
this.sessionStorageService.removeModeratorSecret(event.roomName);