Skip to content

Commit

Permalink
Add resolution to monitoring example
Browse files Browse the repository at this point in the history
  • Loading branch information
dsilhavy committed Nov 29, 2021
1 parent e4a48bd commit 731693e
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions samples/advanced/monitoring.html
Original file line number Diff line number Diff line change
Expand Up @@ -48,13 +48,16 @@
var repSwitch = dashMetrics.getCurrentRepresentationSwitch('video', true);
var bufferLevel = dashMetrics.getCurrentBufferLevel('video', true);
var bitrate = repSwitch ? Math.round(dashAdapter.getBandwidthForRepresentation(repSwitch.to, periodIdx) / 1000) : NaN;
var adaptation = dashAdapter.getAdaptationForType(periodIdx, 'video', streamInfo)
var frameRate = adaptation.Representation_asArray.find(function (rep) {
var adaptation = dashAdapter.getAdaptationForType(periodIdx, 'video', streamInfo);
var currentRep = adaptation.Representation_asArray.find(function (rep) {
return rep.id === repSwitch.to
}).frameRate;
})
var frameRate = currentRep.frameRate;
var resolution = currentRep.width + 'x' + currentRep.height;
document.getElementById('bufferLevel').innerText = bufferLevel + " secs";
document.getElementById('framerate').innerText = frameRate + " fps";
document.getElementById('reportedBitrate').innerText = bitrate + " Kbps";
document.getElementById('resolution').innerText = resolution;
}
}, 1000);

Expand Down Expand Up @@ -113,7 +116,10 @@ <h4>Metrics</h4>
<span id="calculatedBitrate"></span>
</div>
<strong>Framerate:</strong>
<span id="framerate"></span>
<span id="framerate"></span>
</br>
<strong>Resolution:</strong>
<span id="resolution"></span>
</div>
</div>
</div>
Expand Down

0 comments on commit 731693e

Please sign in to comment.