openvidu-testapp: add auto refresh of video track information

pull/850/merge
pabloFuente 2024-11-06 11:32:19 +01:00
parent baa753ac21
commit 0a3129e818
1 changed files with 11 additions and 2 deletions

View File

@ -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 { CdkTextareaAutosize } from '@angular/cdk/text-field';
import { take } from 'rxjs/operators'; import { take } from 'rxjs/operators';
import { MAT_DIALOG_DATA } from '@angular/material/dialog'; 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', templateUrl: './info-dialog.component.html',
styleUrls: ['./info-dialog.component.css'], styleUrls: ['./info-dialog.component.css'],
}) })
export class InfoDialogComponent { export class InfoDialogComponent implements OnDestroy {
title: string; title: string;
subtitle: string; subtitle: string;
updateFunction: () => Promise<string>; updateFunction: () => Promise<string>;
textAreaValue: string; textAreaValue: string;
interval;
@ViewChild('autosize') autosize: CdkTextareaAutosize; @ViewChild('autosize') autosize: CdkTextareaAutosize;
constructor( constructor(
@ -31,6 +33,9 @@ export class InfoDialogComponent {
this.updateFunction = data.updateFunction; this.updateFunction = data.updateFunction;
this.updateValue(); this.updateValue();
this.interval = setInterval(() => {
this.updateValue();
}, 700);
// this.publisher // this.publisher
// .getSenders() // .getSenders()
@ -70,6 +75,10 @@ export class InfoDialogComponent {
// }); // });
} }
ngOnDestroy() {
clearInterval(this.interval);
}
async updateValue() { async updateValue() {
this.textAreaValue = await this.updateFunction(); this.textAreaValue = await this.updateFunction();
this.triggerResize(); this.triggerResize();