diff --git a/openvidu-components-angular/projects/openvidu-components-angular/src/lib/components/panel/activities-panel/recording-activity/recording-activity.component.ts b/openvidu-components-angular/projects/openvidu-components-angular/src/lib/components/panel/activities-panel/recording-activity/recording-activity.component.ts index 69fc0be1..56e09cec 100644 --- a/openvidu-components-angular/projects/openvidu-components-angular/src/lib/components/panel/activities-panel/recording-activity/recording-activity.component.ts +++ b/openvidu-components-angular/projects/openvidu-components-angular/src/lib/components/panel/activities-panel/recording-activity/recording-activity.component.ts @@ -99,12 +99,18 @@ export class RecordingActivityComponent implements OnInit { */ recordingError: any; + /** + * @internal + */ + hasRoomTracksPublished: boolean = false; + /** * @internal */ mouseHovering: boolean = false; private log: ILogger; private recordingStatusSubscription: Subscription; + private tracksSubscription: Subscription; /** * @internal @@ -125,6 +131,7 @@ export class RecordingActivityComponent implements OnInit { */ ngOnInit(): void { this.subscribeToRecordingStatus(); + this.subscribeToTracksChanges(); } /** @@ -132,13 +139,14 @@ export class RecordingActivityComponent implements OnInit { */ ngOnDestroy() { if (this.recordingStatusSubscription) this.recordingStatusSubscription.unsubscribe(); + if (this.tracksSubscription) this.tracksSubscription.unsubscribe(); } /** * @internal */ - get hasRoomTracksPublished(): boolean { - return this.openviduService.hasRoomTracksPublished(); + trackByRecordingId(index: number, recording: RecordingInfo): string | undefined { + return recording.id; } /** @@ -246,4 +254,24 @@ export class RecordingActivityComponent implements OnInit { this.cd.markForCheck(); }); } + + private subscribeToTracksChanges() { + this.hasRoomTracksPublished = this.openviduService.hasRoomTracksPublished(); + + this.tracksSubscription = this.participantService.localParticipant$.subscribe(() => { + const newValue = this.openviduService.hasRoomTracksPublished(); + if (this.hasRoomTracksPublished !== newValue) { + this.hasRoomTracksPublished = newValue; + this.cd.markForCheck(); + } + }); + + this.participantService.remoteParticipants$.subscribe(() => { + const newValue = this.openviduService.hasRoomTracksPublished(); + if (this.hasRoomTracksPublished !== newValue) { + this.hasRoomTracksPublished = newValue; + this.cd.markForCheck(); + } + }); + } }