DEV Community

Discussion on: Broadcasting Interactive Web Based Gaming Live Streams with Amazon IVS

Collapse
 
igmontero profile image
Ignacio Montero Schwarz

This is awesome!

I have a question -- how did you manage to show Bitrate, Latency and Buffer metrics in real time for the livestream?

I was able to do this by fetching metrics from CloudWatch, but they are far from being real time, and sometimes they are not retrieved properly.

Again. Thank you so much for this. I'm building a Livestream service for my platform Moon Boots (moonbootsapp.com) and I've been struggling to find step-by-step tutorials like the ones you've made.
Thank you!

Collapse
 
recursivecodes profile image
Todd Sharp • Edited

One way to show the live bitrate, latency and buffer in real time would be to use setInterval on the client and retrieve those values from the player itself:

setInterval(() => {
    document.getElementById('quality').innerHTML = ivsPlayer.getQuality().name;
    document.getElementById('bitrate').innerHTML = `${(ivsPlayer.getQuality().bitrate / 1000).toFixed()} kbps`;
    document.getElementById('latency').innerHTML = `${(ivsPlayer.getLiveLatency()).toFixed(2)}s`;
    document.getElementById('buffer').innerHTML = `${(ivsPlayer.getBufferDuration()).toFixed(2)}s`;
}, 1000);
Enter fullscreen mode Exit fullscreen mode
Collapse
 
igmontero profile image
Ignacio Montero Schwarz

I had no idea this was possible. Thank you very much!