openvidu-testapp: show codec in video track info window

dependabot/npm_and_yarn/openvidu-testapp/elliptic-6.6.0
pabloFuente 2024-10-28 14:30:22 +01:00
parent 57d92873da
commit ed2fa45d59
1 changed files with 10 additions and 0 deletions

View File

@ -63,7 +63,12 @@ export class VideoTrackComponent extends TrackComponent {
const updateFunction = async (): Promise<string> => { const updateFunction = async (): Promise<string> => {
const videoLayers: any[] = []; const videoLayers: any[] = [];
let stats = await (this._track! as VideoTrack).getRTCStatsReport(); let stats = await (this._track! as VideoTrack).getRTCStatsReport();
let codecs = new Map();
stats?.forEach((report) => { stats?.forEach((report) => {
if (report.type === 'codec') {
// Store for matching with codecId in 'outbound-rtp' or 'inbound-rtp' reports
codecs.set(report.id, report);
}
if (report.type === 'outbound-rtp' || report.type === 'inbound-rtp') { if (report.type === 'outbound-rtp' || report.type === 'inbound-rtp') {
videoLayers.push({ videoLayers.push({
codecId: report.codecId, codecId: report.codecId,
@ -78,6 +83,11 @@ export class VideoTrackComponent extends TrackComponent {
}); });
} }
}); });
videoLayers.forEach((layer) => {
if (codecs.has(layer.codecId)) {
layer.codec = codecs.get(layer.codecId).mimeType;
}
});
return JSON.stringify(videoLayers, null, 2); return JSON.stringify(videoLayers, null, 2);
}; };
this.dialog.open(InfoDialogComponent, { this.dialog.open(InfoDialogComponent, {