diff --git a/openvidu-components-angular/projects/openvidu-components-angular/src/lib/components/session/session.component.ts b/openvidu-components-angular/projects/openvidu-components-angular/src/lib/components/session/session.component.ts index 794be160..c4139a3d 100644 --- a/openvidu-components-angular/projects/openvidu-components-angular/src/lib/components/session/session.component.ts +++ b/openvidu-components-angular/projects/openvidu-components-angular/src/lib/components/session/session.component.ts @@ -204,6 +204,7 @@ export class SessionComponent implements OnInit, OnDestroy { // this.subscribeToParticipantNameChanged(); this.subscribeToDataMessage(); this.subscribeToReconnection(); + this.subscribeToVirtualBackground(); if (this.libService.isRecordingEnabled()) { // this.subscribeToRecordingEvents(); @@ -541,6 +542,17 @@ export class SessionComponent implements OnInit, OnDestroy { }); } + private subscribeToVirtualBackground() { + this.libService.backgroundEffectsButton$.subscribe(async (enable) => { + if (!enable && this.backgroundService.isBackgroundApplied()) { + await this.backgroundService.removeBackground(); + if (this.panelService.isBackgroundEffectsPanelOpened()) { + this.panelService.closePanel(); + } + } + }); + } + private startUpdateLayoutInterval() { this.updateLayoutInterval = setInterval(() => { this.layoutService.update();