diff --git a/openvidu-components-angular/projects/openvidu-components-angular/src/lib/directives/api/activities-panel.directive.ts b/openvidu-components-angular/projects/openvidu-components-angular/src/lib/directives/api/activities-panel.directive.ts index 18b743479..a23be570a 100644 --- a/openvidu-components-angular/projects/openvidu-components-angular/src/lib/directives/api/activities-panel.directive.ts +++ b/openvidu-components-angular/projects/openvidu-components-angular/src/lib/directives/api/activities-panel.directive.ts @@ -1,6 +1,10 @@ import { AfterViewInit, Directive, ElementRef, Input, OnDestroy } from '@angular/core'; import { OpenViduComponentsConfigService } from '../../services/config/directive-config.service'; +function isVideoconferenceHost(elementRef: ElementRef): boolean { + return elementRef.nativeElement?.tagName?.toLowerCase() === 'ov-videoconference'; +} + /** * The **recordingActivity** directive allows show/hide the recording activity in {@link ActivitiesPanelComponent}. * @@ -41,7 +45,9 @@ export class ActivitiesPanelRecordingActivityDirective implements AfterViewInit, this.update(this.recordingActivityValue); } ngOnDestroy(): void { - this.clear(); + if (isVideoconferenceHost(this.elementRef)) { + this.clear(); + } } clear() { this.recordingActivityValue = true; @@ -93,7 +99,9 @@ export class ActivitiesPanelBroadcastingActivityDirective implements AfterViewIn this.update(this.broadcastingActivityValue); } ngOnDestroy(): void { - this.clear(); + if (isVideoconferenceHost(this.elementRef)) { + this.clear(); + } } clear() { this.broadcastingActivityValue = true; diff --git a/openvidu-components-angular/projects/openvidu-components-angular/src/lib/directives/api/internals.directive.ts b/openvidu-components-angular/projects/openvidu-components-angular/src/lib/directives/api/internals.directive.ts index 3c50cc346..1268a2816 100644 --- a/openvidu-components-angular/projects/openvidu-components-angular/src/lib/directives/api/internals.directive.ts +++ b/openvidu-components-angular/projects/openvidu-components-angular/src/lib/directives/api/internals.directive.ts @@ -4,6 +4,10 @@ import { AfterViewInit, Directive, ElementRef, HostListener, Input, OnDestroy, O import { ParticipantModel } from '../../models/participant.model'; import { OpenViduComponentsConfigService } from '../../services/config/directive-config.service'; +function isVideoconferenceHost(elementRef: ElementRef): boolean { + return elementRef.nativeElement?.tagName?.toLowerCase() === 'ov-videoconference'; +} + /** * Load default OpenVidu logo if custom one is not exist * @internal @@ -70,7 +74,9 @@ export class LayoutRemoteParticipantsDirective { ) {} ngOnDestroy(): void { - this.clear(); + if (isVideoconferenceHost(this.elementRef)) { + this.clear(); + } } ngAfterViewInit() { @@ -117,7 +123,9 @@ export class ToolbarBrandingLogoDirective implements AfterViewInit, OnDestroy { } ngOnDestroy(): void { - this.clear(); + if (isVideoconferenceHost(this.elementRef)) { + this.clear(); + } } private clear() { this._brandingLogo = ''; @@ -153,7 +161,9 @@ export class PrejoinDisplayParticipantName implements OnDestroy { ) {} ngOnDestroy(): void { - this.clear(); + if (isVideoconferenceHost(this.elementRef)) { + this.clear(); + } } private clear() { @@ -333,7 +343,7 @@ export class ToolbarViewRecordingsButtonDirective implements AfterViewInit, OnDe } private clear() { this.viewRecordingsValue = false; - this.update(true); + this.update(this.viewRecordingsValue); } private update(value: boolean) { @@ -469,7 +479,7 @@ export class RecordingActivityShowRecordingsListDirective implements AfterViewIn } private clear() { - this._value = true; + this._value = false; this.update(this._value); } diff --git a/openvidu-components-angular/projects/openvidu-components-angular/src/lib/directives/api/participant-panel-item.directive.ts b/openvidu-components-angular/projects/openvidu-components-angular/src/lib/directives/api/participant-panel-item.directive.ts index 318765758..dfc3c6e15 100644 --- a/openvidu-components-angular/projects/openvidu-components-angular/src/lib/directives/api/participant-panel-item.directive.ts +++ b/openvidu-components-angular/projects/openvidu-components-angular/src/lib/directives/api/participant-panel-item.directive.ts @@ -1,6 +1,10 @@ import { Directive, AfterViewInit, OnDestroy, Input, ElementRef } from '@angular/core'; import { OpenViduComponentsConfigService } from '../../services/config/directive-config.service'; +function isVideoconferenceHost(elementRef: ElementRef): boolean { + return elementRef.nativeElement?.tagName?.toLowerCase() === 'ov-videoconference'; +} + /** * The **muteButton** directive allows show/hide the muted button in participant panel item component. * @@ -41,7 +45,9 @@ export class ParticipantPanelItemMuteButtonDirective implements AfterViewInit, O this.update(this.muteValue); } ngOnDestroy(): void { - this.clear(); + if (isVideoconferenceHost(this.elementRef)) { + this.clear(); + } } clear() { this.muteValue = true; diff --git a/openvidu-components-angular/projects/openvidu-components-angular/src/lib/directives/api/stream.directive.ts b/openvidu-components-angular/projects/openvidu-components-angular/src/lib/directives/api/stream.directive.ts index a04186993..28593e488 100644 --- a/openvidu-components-angular/projects/openvidu-components-angular/src/lib/directives/api/stream.directive.ts +++ b/openvidu-components-angular/projects/openvidu-components-angular/src/lib/directives/api/stream.directive.ts @@ -1,6 +1,10 @@ import { AfterViewInit, Directive, ElementRef, Input, OnDestroy } from '@angular/core'; import { OpenViduComponentsConfigService } from '../../services/config/directive-config.service'; +function isVideoconferenceHost(elementRef: ElementRef): boolean { + return elementRef.nativeElement?.tagName?.toLowerCase() === 'ov-videoconference'; +} + /** * The **displayParticipantName** directive allows show/hide the participants name in stream component. * @@ -38,7 +42,9 @@ export class StreamDisplayParticipantNameDirective implements AfterViewInit, OnD ) {} ngOnDestroy(): void { - this.clear(); + if (isVideoconferenceHost(this.elementRef)) { + this.clear(); + } } ngAfterViewInit() { @@ -94,7 +100,9 @@ export class StreamDisplayAudioDetectionDirective implements AfterViewInit, OnDe this.update(this.displayAudioDetectionValue); } ngOnDestroy(): void { - this.clear(); + if (isVideoconferenceHost(this.elementRef)) { + this.clear(); + } } update(value: boolean) { @@ -146,7 +154,9 @@ export class StreamVideoControlsDirective implements AfterViewInit, OnDestroy { } ngOnDestroy(): void { - this.clear(); + if (isVideoconferenceHost(this.elementRef)) { + this.clear(); + } } update(value: boolean) { diff --git a/openvidu-components-angular/projects/openvidu-components-angular/src/lib/directives/api/toolbar.directive.ts b/openvidu-components-angular/projects/openvidu-components-angular/src/lib/directives/api/toolbar.directive.ts index d8a27b807..95938cd84 100644 --- a/openvidu-components-angular/projects/openvidu-components-angular/src/lib/directives/api/toolbar.directive.ts +++ b/openvidu-components-angular/projects/openvidu-components-angular/src/lib/directives/api/toolbar.directive.ts @@ -2,6 +2,10 @@ import { AfterViewInit, Directive, ElementRef, Input, OnDestroy } from '@angular import { OpenViduComponentsConfigService } from '../../services/config/directive-config.service'; import { ToolbarAdditionalButtonsPosition } from '../../models/toolbar.model'; +function isVideoconferenceHost(elementRef: ElementRef): boolean { + return elementRef.nativeElement?.tagName?.toLowerCase() === 'ov-videoconference'; +} + /** * The **cameraButton** directive allows show/hide the camera toolbar button. * @@ -53,7 +57,9 @@ export class ToolbarCameraButtonDirective implements AfterViewInit, OnDestroy { } ngOnDestroy(): void { - this.clear(); + if (isVideoconferenceHost(this.elementRef)) { + this.clear(); + } } private clear() { @@ -117,7 +123,9 @@ export class ToolbarMicrophoneButtonDirective implements AfterViewInit, OnDestro } ngOnDestroy(): void { - this.clear(); + if (isVideoconferenceHost(this.elementRef)) { + this.clear(); + } } private clear() { @@ -181,7 +189,9 @@ export class ToolbarScreenshareButtonDirective implements AfterViewInit, OnDestr } ngOnDestroy(): void { - this.clear(); + if (isVideoconferenceHost(this.elementRef)) { + this.clear(); + } } private clear() { @@ -243,7 +253,9 @@ export class ToolbarRecordingButtonDirective implements AfterViewInit, OnDestroy } ngOnDestroy(): void { - this.clear(); + if (isVideoconferenceHost(this.elementRef)) { + this.clear(); + } } private clear() { this.recordingValue = true; @@ -305,7 +317,9 @@ export class ToolbarBroadcastingButtonDirective implements AfterViewInit, OnDest } ngOnDestroy(): void { - this.clear(); + if (isVideoconferenceHost(this.elementRef)) { + this.clear(); + } } private clear() { this.broadcastingValue = true; @@ -366,7 +380,9 @@ export class ToolbarFullscreenButtonDirective implements AfterViewInit, OnDestro this.update(this.fullscreenValue); } ngOnDestroy(): void { - this.clear(); + if (isVideoconferenceHost(this.elementRef)) { + this.clear(); + } } private clear() { this.fullscreenValue = true; @@ -427,7 +443,9 @@ export class ToolbarBackgroundEffectsButtonDirective implements AfterViewInit, O this.update(this.backgroundEffectsValue); } ngOnDestroy(): void { - this.clear(); + if (isVideoconferenceHost(this.elementRef)) { + this.clear(); + } } private clear() { this.backgroundEffectsValue = true; @@ -547,7 +565,9 @@ export class ToolbarSettingsButtonDirective implements AfterViewInit, OnDestroy this.update(this.settingsValue); } ngOnDestroy(): void { - this.clear(); + if (isVideoconferenceHost(this.elementRef)) { + this.clear(); + } } private clear() { this.settingsValue = true; @@ -609,7 +629,9 @@ export class ToolbarLeaveButtonDirective implements AfterViewInit, OnDestroy { } ngOnDestroy(): void { - this.clear(); + if (isVideoconferenceHost(this.elementRef)) { + this.clear(); + } } private clear() { this.leaveValue = true; @@ -672,7 +694,9 @@ export class ToolbarParticipantsPanelButtonDirective implements AfterViewInit, O } ngOnDestroy(): void { - this.clear(); + if (isVideoconferenceHost(this.elementRef)) { + this.clear(); + } } private clear() { this.participantsPanelValue = true; @@ -733,7 +757,9 @@ export class ToolbarChatPanelButtonDirective implements AfterViewInit, OnDestroy } ngOnDestroy(): void { - this.clear(); + if (isVideoconferenceHost(this.elementRef)) { + this.clear(); + } } private clear() { this.toolbarChatPanelValue = true; @@ -794,7 +820,9 @@ export class ToolbarActivitiesPanelButtonDirective implements AfterViewInit, OnD } ngOnDestroy(): void { - this.clear(); + if (isVideoconferenceHost(this.elementRef)) { + this.clear(); + } } private clear() { this.toolbarActivitiesPanelValue = true; @@ -856,7 +884,9 @@ export class ToolbarDisplayRoomNameDirective implements AfterViewInit, OnDestroy } ngOnDestroy(): void { - this.clear(); + if (isVideoconferenceHost(this.elementRef)) { + this.clear(); + } } private clear() { this.displayRoomValue = true;