mirror of https://github.com/OpenVidu/openvidu.git
ov-components: refactor participant left and room disconnected handling to use a common disconnect method
parent
f087c172fc
commit
c12dbf247c
|
@ -615,17 +615,12 @@ describe('Testing videoconference EVENTS', () => {
|
|||
|
||||
await utils.checkToolbarIsPresent();
|
||||
|
||||
console.log('data:image/png;base64,' + (await browser.takeScreenshot()));
|
||||
|
||||
// Clicking to leave button
|
||||
const leaveButton = await utils.waitForElement('#leave-btn');
|
||||
expect(await utils.isPresent('#leave-btn')).toBeTrue();
|
||||
await leaveButton.click();
|
||||
await browser.sleep(1000);
|
||||
console.log('data:image/png;base64,' + (await browser.takeScreenshot()));
|
||||
|
||||
await utils.waitForElement('#events');
|
||||
|
||||
// Checking if onParticipantLeft has been received
|
||||
await utils.waitForElement('#onParticipantLeft');
|
||||
expect(await utils.isPresent('#onParticipantLeft')).toBeTrue();
|
||||
|
|
|
@ -174,11 +174,9 @@ export class CallComponent implements OnInit {
|
|||
}
|
||||
|
||||
async onParticipantLeft(event: ParticipantLeftEvent) {
|
||||
this.configReady = false;
|
||||
this.isSessionAlive = false;
|
||||
this.appendElement('onParticipantLeft');
|
||||
console.warn('VC PARTICIPANT LEFT', event);
|
||||
if (this.redirectToHomeOnLeaves) await this.router.navigate(['/']);
|
||||
this.appendElement('onParticipantLeft');
|
||||
this.handleDisconnect();
|
||||
}
|
||||
|
||||
onRoomCreated(room: Room) {
|
||||
|
@ -246,11 +244,13 @@ export class CallComponent implements OnInit {
|
|||
console.warn('VC chat status changed: ', event);
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated
|
||||
*/
|
||||
async onRoomDisconnected() {
|
||||
this.appendElement('onRoomDisconnected');
|
||||
this.isSessionAlive = false;
|
||||
console.log('VC LEAVE BUTTON CLICKED');
|
||||
await this.router.navigate(['/']);
|
||||
this.handleDisconnect();
|
||||
}
|
||||
|
||||
onFullscreenButtonClicked() {
|
||||
|
@ -363,6 +363,12 @@ export class CallComponent implements OnInit {
|
|||
}
|
||||
}
|
||||
|
||||
private async handleDisconnect() {
|
||||
this.configReady = false;
|
||||
this.isSessionAlive = false;
|
||||
if (this.redirectToHomeOnLeaves) await this.router.navigate(['/']);
|
||||
}
|
||||
|
||||
private appendElement(id: string) {
|
||||
const eventsDiv = document.getElementById('events');
|
||||
if (!eventsDiv) {
|
||||
|
|
Loading…
Reference in New Issue