mirror of https://github.com/OpenVidu/openvidu.git
ov-components: Fixed blocking dialog when connection issues
parent
c273ae0109
commit
9a7a2e3adb
|
@ -211,7 +211,7 @@ export class SessionComponent implements OnInit, OnDestroy {
|
||||||
if (this.shouldDisconnectRoomWhenComponentIsDestroyed) {
|
if (this.shouldDisconnectRoomWhenComponentIsDestroyed) {
|
||||||
await this.disconnectRoom();
|
await this.disconnectRoom();
|
||||||
}
|
}
|
||||||
this.room.removeAllListeners();
|
if(this.room) this.room.removeAllListeners();
|
||||||
this.participantService.clear();
|
this.participantService.clear();
|
||||||
// this.room = undefined;
|
// this.room = undefined;
|
||||||
if (this.menuSubscription) this.menuSubscription.unsubscribe();
|
if (this.menuSubscription) this.menuSubscription.unsubscribe();
|
||||||
|
@ -443,27 +443,25 @@ export class SessionComponent implements OnInit, OnDestroy {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
private subscribeToReconnection() {
|
subscribeToReconnection() {
|
||||||
this.room.on(RoomEvent.Reconnecting, () => {
|
this.room.on(RoomEvent.Reconnecting, () => {
|
||||||
this.log.w('Connection lost: Reconnecting');
|
this.log.w('Connection lost: Reconnecting');
|
||||||
this.actionService.openDialog(
|
this.actionService.openConnectionDialog(
|
||||||
this.translateService.translate('ERRORS.CONNECTION'),
|
this.translateService.translate('ERRORS.CONNECTION'),
|
||||||
this.translateService.translate('ERRORS.RECONNECT'),
|
this.translateService.translate('ERRORS.RECONNECT')
|
||||||
false
|
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
this.room.on(RoomEvent.Reconnected, () => {
|
this.room.on(RoomEvent.Reconnected, () => {
|
||||||
this.log.w('Connection lost: Reconnected');
|
this.log.w('Connection lost: Reconnected');
|
||||||
this.actionService.closeDialog();
|
this.actionService.closeConnectionDialog();
|
||||||
});
|
});
|
||||||
|
|
||||||
this.room.on(RoomEvent.Disconnected, async (reason: DisconnectReason | undefined) => {
|
this.room.on(RoomEvent.Disconnected, async (reason: DisconnectReason | undefined) => {
|
||||||
if (reason === DisconnectReason.SERVER_SHUTDOWN) {
|
if (reason === DisconnectReason.SERVER_SHUTDOWN) {
|
||||||
this.log.e('Room Disconnected', reason);
|
this.log.e('Room Disconnected', reason);
|
||||||
this.actionService.openDialog(
|
this.actionService.openConnectionDialog(
|
||||||
this.translateService.translate('ERRORS.CONNECTION'),
|
this.translateService.translate('ERRORS.CONNECTION'),
|
||||||
this.translateService.translate('ERRORS.RECONNECT'),
|
this.translateService.translate('ERRORS.RECONNECT')
|
||||||
false
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
// await this.disconnectRoom();
|
// await this.disconnectRoom();
|
||||||
|
|
|
@ -20,6 +20,9 @@ export class ActionService {
|
||||||
| MatDialogRef<DialogTemplateComponent | RecordingDialogComponent | DeleteDialogComponent | ProFeatureDialogTemplateComponent>
|
| MatDialogRef<DialogTemplateComponent | RecordingDialogComponent | DeleteDialogComponent | ProFeatureDialogTemplateComponent>
|
||||||
| undefined;
|
| undefined;
|
||||||
private dialogSubscription: Subscription;
|
private dialogSubscription: Subscription;
|
||||||
|
private connectionDialogRef: MatDialogRef<DialogTemplateComponent> | undefined;
|
||||||
|
private isConnectionDialogOpen: boolean = false;
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
private snackBar: MatSnackBar,
|
private snackBar: MatSnackBar,
|
||||||
public dialog: MatDialog,
|
public dialog: MatDialog,
|
||||||
|
@ -62,23 +65,17 @@ export class ActionService {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// openProFeatureDialog(titleMessage: string, descriptionMessage: string, allowClose = true) {
|
openConnectionDialog(titleMessage: string, descriptionMessage: string, allowClose = false) {
|
||||||
// try {
|
if (this.isConnectionDialogOpen) return;
|
||||||
// this.closeDialog();
|
const config: MatDialogConfig = {
|
||||||
// } catch (error) {
|
minWidth: '250px',
|
||||||
// } finally {
|
data: { title: titleMessage, description: descriptionMessage, showActionButtons: allowClose },
|
||||||
// const config: MatDialogConfig = {
|
disableClose: !allowClose
|
||||||
// minWidth: '250px',
|
};
|
||||||
// data: { title: titleMessage, description: descriptionMessage, showActionButtons: allowClose },
|
|
||||||
// disableClose: !allowClose
|
this.connectionDialogRef = this.dialog.open(DialogTemplateComponent, config);
|
||||||
// };
|
this.isConnectionDialogOpen = true;
|
||||||
// this.dialogRef = this.dialog.open(ProFeatureDialogTemplateComponent, config);
|
}
|
||||||
// this.dialogSubscription = this.dialogRef.afterClosed().subscribe((result) => {
|
|
||||||
// this.dialogRef = undefined;
|
|
||||||
// if (this.dialogSubscription) this.dialogSubscription.unsubscribe();
|
|
||||||
// });
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
openDeleteRecordingDialog(succsessCallback) {
|
openDeleteRecordingDialog(succsessCallback) {
|
||||||
try {
|
try {
|
||||||
|
@ -121,6 +118,14 @@ export class ActionService {
|
||||||
this.dialogRef?.close();
|
this.dialogRef?.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
closeConnectionDialog() {
|
||||||
|
if (this.connectionDialogRef) {
|
||||||
|
this.connectionDialogRef.close();
|
||||||
|
this.isConnectionDialogOpen = false;
|
||||||
|
this.connectionDialogRef = undefined;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private handleRecordingPlayerError(error: MediaError | null) {
|
private handleRecordingPlayerError(error: MediaError | null) {
|
||||||
let message = 'ERRORS.MEDIA_ERR_GENERIC';
|
let message = 'ERRORS.MEDIA_ERR_GENERIC';
|
||||||
if (error) {
|
if (error) {
|
||||||
|
|
Loading…
Reference in New Issue