feat: Sessions view (#537)

This commit is contained in:
lostb1t
2025-02-21 13:14:57 +01:00
committed by GitHub
parent b0c5255bd7
commit 5b8418cd82
14 changed files with 534 additions and 30 deletions

8
utils/bitrate.ts Normal file
View File

@@ -0,0 +1,8 @@
export const formatBitrate = (bitrate?: number | null) => {
if (!bitrate) return "N/A";
const sizes = ["bps", "Kbps", "Mbps", "Gbps", "Tbps"];
if (bitrate === 0) return "0 bps";
const i = parseInt(Math.floor(Math.log(bitrate) / Math.log(1000)).toString());
return Math.round((bitrate / Math.pow(1000, i)) * 100) / 100 + " " + sizes[i];
};