From 0a3129e818a14caf3a7625e17fbd4d0a27494a36 Mon Sep 17 00:00:00 2001 From: pabloFuente Date: Wed, 6 Nov 2024 11:32:19 +0100 Subject: [PATCH] openvidu-testapp: add auto refresh of video track information --- .../dialogs/info-dialog/info-dialog.component.ts | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/openvidu-testapp/src/app/components/dialogs/info-dialog/info-dialog.component.ts b/openvidu-testapp/src/app/components/dialogs/info-dialog/info-dialog.component.ts index 753dcdea..d2213af9 100644 --- a/openvidu-testapp/src/app/components/dialogs/info-dialog/info-dialog.component.ts +++ b/openvidu-testapp/src/app/components/dialogs/info-dialog/info-dialog.component.ts @@ -1,4 +1,4 @@ -import { Component, Inject, NgZone, ViewChild } from '@angular/core'; +import { Component, Inject, NgZone, OnDestroy, ViewChild } from '@angular/core'; import { CdkTextareaAutosize } from '@angular/cdk/text-field'; import { take } from 'rxjs/operators'; import { MAT_DIALOG_DATA } from '@angular/material/dialog'; @@ -8,13 +8,15 @@ import { MAT_DIALOG_DATA } from '@angular/material/dialog'; templateUrl: './info-dialog.component.html', styleUrls: ['./info-dialog.component.css'], }) -export class InfoDialogComponent { +export class InfoDialogComponent implements OnDestroy { title: string; subtitle: string; updateFunction: () => Promise; textAreaValue: string; + interval; + @ViewChild('autosize') autosize: CdkTextareaAutosize; constructor( @@ -31,6 +33,9 @@ export class InfoDialogComponent { this.updateFunction = data.updateFunction; this.updateValue(); + this.interval = setInterval(() => { + this.updateValue(); + }, 700); // this.publisher // .getSenders() @@ -70,6 +75,10 @@ export class InfoDialogComponent { // }); } + ngOnDestroy() { + clearInterval(this.interval); + } + async updateValue() { this.textAreaValue = await this.updateFunction(); this.triggerResize();