Remove MEETING_ENDED event and always send LEFT event with proper reason

This commit is contained in:
juancarmore 2025-07-19 20:00:07 +02:00
parent 200225a948
commit a0e23cd4a7
4 changed files with 14 additions and 41 deletions

View File

@ -332,29 +332,18 @@ export class VideoRoomComponent implements OnInit {
leftReason = LeftEventReason.MEETING_ENDED_BY_SELF;
}
// Send LEFT or MEETING_ENDED event to the parent component
let message: WebComponentOutboundEventMessage<WebComponentEvent.MEETING_ENDED | WebComponentEvent.LEFT>;
if (event.reason === ParticipantLeftReason.ROOM_DELETED) {
message = {
event: WebComponentEvent.MEETING_ENDED,
payload: {
roomId: event.roomName,
endedByMe: this.meetingEndedByMe
}
} as WebComponentOutboundEventMessage<WebComponentEvent.MEETING_ENDED>;
} else {
message = {
// Send LEFT event to the parent component
const message: WebComponentOutboundEventMessage<WebComponentEvent.LEFT> = {
event: WebComponentEvent.LEFT,
payload: {
roomId: event.roomName,
participantName: event.participantName,
reason: leftReason
}
} as WebComponentOutboundEventMessage<WebComponentEvent.LEFT>;
}
};
this.wcManagerService.sendMessageToParent(message);
// Remove the moderator secret from session storage if the participant left for a reason other than browser unload
if (event.reason !== ParticipantLeftReason.BROWSER_UNLOAD) {
this.sessionStorageService.removeModeratorSecret(event.roomName);
}

View File

@ -91,19 +91,15 @@ test.describe('Web Component E2E Tests', () => {
expect(leftElements.length).toBe(1);
});
test('should successfully join to room and receive MEETING_ENDED event when using end meeting command', async ({
test('should successfully join to room and receive LEFT event when using end meeting command', async ({
page
}) => {
await joinRoomAs('moderator', participantName, page);
await page.click('#end-meeting-btn');
await page.waitForSelector('.event-MEETING_ENDED');
const meetingEndedElements = await page.locator('.event-MEETING_ENDED').all();
await page.waitForSelector('.event-LEFT');
const meetingEndedElements = await page.locator('.event-LEFT').all();
expect(meetingEndedElements.length).toBe(1);
// Check LEFT event does not exist
const leftEventElements = await page.locator('.event-LEFT').all();
expect(leftEventElements.length).toBe(0);
});
});
});

View File

@ -202,10 +202,6 @@ const listenWebComponentEvents = () => {
console.log('LEFT event received:', event);
addEventToLog('LEFT', JSON.stringify(event));
});
meet.on('MEETING_ENDED', (event: CustomEvent<any>) => {
console.log('MEETING_ENDED event received:', event);
addEventToLog('MEETING_ENDED', JSON.stringify(event));
});
meet.on('CLOSED', (event: CustomEvent<any>) => {
console.log('CLOSED event received:', event);
addEventToLog('CLOSED', JSON.stringify(event));

View File

@ -16,10 +16,6 @@ export enum WebComponentEvent {
* Event emitted when the local participant leaves the room.
*/
LEFT = 'LEFT',
/**
* Event emitted when a moderator ends the meeting.
*/
MEETING_ENDED = 'MEETING_ENDED',
/**
* Event emitted when the application is closed.
*/
@ -59,10 +55,6 @@ export interface WebComponentEventPayloads {
participantName: string;
reason: LeftEventReason;
};
[WebComponentEvent.MEETING_ENDED]: {
roomId: string;
endedByMe: boolean; // Indicates if the meeting was ended by the local participant
};
}
/**