From 7820e025746ad47d8786cc3b6ed142ce073f2d59 Mon Sep 17 00:00:00 2001 From: pabloFuente Date: Thu, 10 Nov 2022 13:40:17 +0100 Subject: [PATCH] openvidu-testapp: fix video codec retrieval --- .../src/app/components/video/video.component.ts | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/openvidu-testapp/src/app/components/video/video.component.ts b/openvidu-testapp/src/app/components/video/video.component.ts index a20a7421..8e6b2c22 100644 --- a/openvidu-testapp/src/app/components/video/video.component.ts +++ b/openvidu-testapp/src/app/components/video/video.component.ts @@ -826,28 +826,27 @@ export class VideoComponent implements OnInit, OnDestroy { async showCodecUsed() { let stats = await this.streamManager.stream.getWebRtcPeer().pc.getStats(); - let codecIdIndex = null; + let codecIdIndex: string = null; // Search codec Index stats.forEach(report => { console.log(report); - if (!this.streamManager.remote && report.id.includes("RTCOutboundRTPVideoStream")) { + if (!this.streamManager.remote && report.type === 'outbound-rtp' && report.mediaType === 'video') { codecIdIndex = report.codecId; - - } else if (this.streamManager.remote && report.id.includes("RTCInboundRTPVideoStream")) { + } else if (this.streamManager.remote && report.type === 'inbound-rtp' && report.mediaType === 'video') { codecIdIndex = report.codecId; } - }) + }); // Search codec Info stats.forEach(report => { if (report.id === codecIdIndex) { this.usedVideoCodec = report.mimeType; } - }) + }); this.dialog.open(ShowCodecDialogComponent, { data: { usedVideoCodec: this.usedVideoCodec }, - width: '450px' + width: '295px' }); } }