[mirotalk] - improve network stats

This commit is contained in:
Miroslav Pejic
2025-11-21 08:16:20 +01:00
parent 11c669d5de
commit be6ea85620
6 changed files with 24 additions and 13 deletions
+1 -1
View File
@@ -45,7 +45,7 @@ dependencies: {
* @license For commercial use or closed source, contact us at license.mirotalk@gmail.com or purchase directly from CodeCanyon
* @license CodeCanyon: https://codecanyon.net/item/mirotalk-p2p-webrtc-realtime-video-conferences/38376661
* @author Miroslav Pejic - miroslav.pejic.85@gmail.com
* @version 1.6.39
* @version 1.6.40
*
*/
+2 -2
View File
@@ -1,12 +1,12 @@
{
"name": "mirotalk",
"version": "1.6.39",
"version": "1.6.40",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "mirotalk",
"version": "1.6.39",
"version": "1.6.40",
"license": "AGPL-3.0",
"dependencies": {
"@mattermost/client": "11.1.0",
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "mirotalk",
"version": "1.6.39",
"version": "1.6.40",
"description": "A free WebRTC browser-based video call",
"main": "server.js",
"scripts": {
+1 -1
View File
@@ -77,7 +77,7 @@ let brand = {
},
about: {
imageUrl: '../images/mirotalk-logo.gif',
title: 'WebRTC P2P v1.6.39',
title: 'WebRTC P2P v1.6.40',
html: `
<button
id="support-button"
+2 -2
View File
@@ -15,7 +15,7 @@
* @license For commercial use or closed source, contact us at license.mirotalk@gmail.com or purchase directly from CodeCanyon
* @license CodeCanyon: https://codecanyon.net/item/mirotalk-p2p-webrtc-realtime-video-conferences/38376661
* @author Miroslav Pejic - miroslav.pejic.85@gmail.com
* @version 1.6.39
* @version 1.6.40
*
*/
@@ -12322,7 +12322,7 @@ function showAbout() {
Swal.fire({
background: swBg,
position: 'center',
title: brand.about?.title && brand.about.title.trim() !== '' ? brand.about.title : 'WebRTC P2P v1.6.39',
title: brand.about?.title && brand.about.title.trim() !== '' ? brand.about.title : 'WebRTC P2P v1.6.40',
imageUrl: brand.about?.imageUrl && brand.about.imageUrl.trim() !== '' ? brand.about.imageUrl : images.about,
customClass: { image: 'img-about' },
html: `
+17 -6
View File
@@ -77,13 +77,24 @@ function bytesToSize(bytes) {
return (bytes / Math.pow(1024, i)).toFixed(2) + ' ' + sizes[i];
}
/**
* Convert seconds to ms, s, h as readable string
*/
function timeToReadable(seconds) {
if (seconds < 1e-3) return (seconds * 1e6).toFixed(2) + ' μs';
if (seconds < 1) return (seconds * 1000).toFixed(2) + ' ms';
if (seconds < 60) return seconds.toFixed(3) + ' s';
if (seconds < 3600) return (seconds / 60).toFixed(2) + ' min';
return (seconds / 3600).toFixed(2) + ' h';
}
/** Display into UI */
function showNetworkStats(stats) {
networkSent.innerText = stats.bytesSent;
networkReceived.innerText = stats.bytesReceived;
networkJitter.innerText = stats.jitter.toFixed(3) + ' s';
networkSent.innerText = bytesToSize(stats.bytesSent);
networkReceived.innerText = bytesToSize(stats.bytesReceived);
networkJitter.innerText = timeToReadable(stats.jitter);
networkPacketLost.innerText = stats.packetsLost;
networkRtt.innerText = stats.rtt.toFixed(3) + ' s';
networkRtt.innerText = timeToReadable(stats.rtt);
}
/**
@@ -123,8 +134,8 @@ setInterval(async () => {
if (rttCount > 0) global.rtt /= rttCount;
showNetworkStats({
bytesSent: bytesToSize(global.bytesSent),
bytesReceived: bytesToSize(global.bytesReceived),
bytesSent: global.bytesSent,
bytesReceived: global.bytesReceived,
packetsLost: global.packetsLost,
jitter: global.jitter,
rtt: global.rtt,