Skip to content

Commit

Permalink
openvidu-testapp: show codec in video track info window
Browse files Browse the repository at this point in the history
  • Loading branch information
pabloFuente committed Oct 28, 2024
1 parent 57d9287 commit ed2fa45
Showing 1 changed file with 10 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,12 @@ export class VideoTrackComponent extends TrackComponent {
const updateFunction = async (): Promise<string> => {
const videoLayers: any[] = [];
let stats = await (this._track! as VideoTrack).getRTCStatsReport();
let codecs = new Map();
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') {
videoLayers.push({
codecId: report.codecId,
Expand All @@ -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);
};
this.dialog.open(InfoDialogComponent, {
Expand Down

0 comments on commit ed2fa45

Please sign in to comment.