Remove MEETING_ENDED event and always send LEFT event with proper reason
This commit is contained in:
parent
200225a948
commit
a0e23cd4a7
@ -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 = {
|
||||
event: WebComponentEvent.LEFT,
|
||||
payload: {
|
||||
roomId: event.roomName,
|
||||
participantName: event.participantName,
|
||||
reason: leftReason
|
||||
}
|
||||
} as WebComponentOutboundEventMessage<WebComponentEvent.LEFT>;
|
||||
}
|
||||
|
||||
// Send LEFT event to the parent component
|
||||
const message: WebComponentOutboundEventMessage<WebComponentEvent.LEFT> = {
|
||||
event: WebComponentEvent.LEFT,
|
||||
payload: {
|
||||
roomId: event.roomName,
|
||||
participantName: event.participantName,
|
||||
reason: leftReason
|
||||
}
|
||||
};
|
||||
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);
|
||||
}
|
||||
|
||||
@ -37,7 +37,7 @@ test.describe('Web Component E2E Tests', () => {
|
||||
});
|
||||
subscribedToAppErrors = true;
|
||||
}
|
||||
|
||||
|
||||
await prepareForJoiningRoom(page, MEET_TESTAPP_URL, testRoomPrefix);
|
||||
participantName = `P-${Math.random().toString(36).substring(2, 9)}`;
|
||||
});
|
||||
@ -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);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
@ -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));
|
||||
|
||||
@ -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
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user