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();
|
await utils.checkToolbarIsPresent();
|
||||||
|
|
||||||
console.log('data:image/png;base64,' + (await browser.takeScreenshot()));
|
|
||||||
|
|
||||||
// Clicking to leave button
|
// Clicking to leave button
|
||||||
const leaveButton = await utils.waitForElement('#leave-btn');
|
const leaveButton = await utils.waitForElement('#leave-btn');
|
||||||
expect(await utils.isPresent('#leave-btn')).toBeTrue();
|
expect(await utils.isPresent('#leave-btn')).toBeTrue();
|
||||||
await leaveButton.click();
|
await leaveButton.click();
|
||||||
await browser.sleep(1000);
|
|
||||||
console.log('data:image/png;base64,' + (await browser.takeScreenshot()));
|
|
||||||
|
|
||||||
await utils.waitForElement('#events');
|
await utils.waitForElement('#events');
|
||||||
|
|
||||||
// Checking if onParticipantLeft has been received
|
// Checking if onParticipantLeft has been received
|
||||||
await utils.waitForElement('#onParticipantLeft');
|
await utils.waitForElement('#onParticipantLeft');
|
||||||
expect(await utils.isPresent('#onParticipantLeft')).toBeTrue();
|
expect(await utils.isPresent('#onParticipantLeft')).toBeTrue();
|
||||||
|
|
|
@ -174,11 +174,9 @@ export class CallComponent implements OnInit {
|
||||||
}
|
}
|
||||||
|
|
||||||
async onParticipantLeft(event: ParticipantLeftEvent) {
|
async onParticipantLeft(event: ParticipantLeftEvent) {
|
||||||
this.configReady = false;
|
|
||||||
this.isSessionAlive = false;
|
|
||||||
this.appendElement('onParticipantLeft');
|
|
||||||
console.warn('VC PARTICIPANT LEFT', event);
|
console.warn('VC PARTICIPANT LEFT', event);
|
||||||
if (this.redirectToHomeOnLeaves) await this.router.navigate(['/']);
|
this.appendElement('onParticipantLeft');
|
||||||
|
this.handleDisconnect();
|
||||||
}
|
}
|
||||||
|
|
||||||
onRoomCreated(room: Room) {
|
onRoomCreated(room: Room) {
|
||||||
|
@ -246,11 +244,13 @@ export class CallComponent implements OnInit {
|
||||||
console.warn('VC chat status changed: ', event);
|
console.warn('VC chat status changed: ', event);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @deprecated
|
||||||
|
*/
|
||||||
async onRoomDisconnected() {
|
async onRoomDisconnected() {
|
||||||
this.appendElement('onRoomDisconnected');
|
this.appendElement('onRoomDisconnected');
|
||||||
this.isSessionAlive = false;
|
|
||||||
console.log('VC LEAVE BUTTON CLICKED');
|
console.log('VC LEAVE BUTTON CLICKED');
|
||||||
await this.router.navigate(['/']);
|
this.handleDisconnect();
|
||||||
}
|
}
|
||||||
|
|
||||||
onFullscreenButtonClicked() {
|
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) {
|
private appendElement(id: string) {
|
||||||
const eventsDiv = document.getElementById('events');
|
const eventsDiv = document.getElementById('events');
|
||||||
if (!eventsDiv) {
|
if (!eventsDiv) {
|
||||||
|
|
Loading…
Reference in New Issue