mirror of
https://github.com/radio95-rnt/RadioPlayer.git
synced 2026-07-30 07:49:18 +02:00
ping?
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width,initial-scale=1" />
|
||||
<title>FSDB Editor</title>
|
||||
<style>
|
||||
body {
|
||||
|
||||
@@ -3,6 +3,8 @@
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<meta name="viewport" content="width=device-width,initial-scale=1" />
|
||||
<meta name="theme-color" content="#0b1220">
|
||||
<link rel="preconnect" href="/ws">
|
||||
<title>Radio95 Track Monitor</title>
|
||||
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/7.0.1/css/all.min.css" integrity="sha512-2SwdPD6INVrV/lHTZbO2nodKhrnDdJK9/kg2XD1r9uGqPo1cUbujc+IYdlYdEErWNu69gVcYgdxlmVmzTWnetw==" crossorigin="anonymous" referrerpolicy="no-referrer" />
|
||||
<style>
|
||||
@@ -257,6 +259,7 @@
|
||||
<div class="footer small">
|
||||
<div><i class="fa-solid fa-server"></i> <span id="server-status">connecting...</span></div>
|
||||
<div><i class="fa-solid fa-user"></i> <span id="user-count">-</span></div>
|
||||
<div><i class="fa fa-arrows-h"></i> <span id="ping-status">-</span>ms</div>
|
||||
<div class="small" id="keybinds">
|
||||
<span><kbd>S</kbd> skip</span>
|
||||
<span><kbd>N</kbd> +skip</span>
|
||||
|
||||
+10
-4
@@ -17,6 +17,7 @@ let skippedIndices = [];
|
||||
let lastElapsed = 0;
|
||||
let lastUpdateTime = 0;
|
||||
let currentRealTotal = 1;
|
||||
let timeOffset = 0;
|
||||
|
||||
function toggleSection(id) {
|
||||
document.getElementById(id).classList.toggle("collapsed");
|
||||
@@ -90,10 +91,17 @@ function wsSend(obj) {
|
||||
ws.send(JSON.stringify(obj));
|
||||
}
|
||||
|
||||
// ─── Message Handling ────────────────────────────────────────────────────────
|
||||
|
||||
function handleMessage(msg) {
|
||||
if(msg.time && timeOffset != 0) {
|
||||
const now = performance.now() / 1000;
|
||||
const lag = now - (msg.time + offset);
|
||||
document.getElementById("ping-status").textContent = lag;
|
||||
}
|
||||
switch (msg.event) {
|
||||
case "time": {
|
||||
const localNow = performance.now() / 1000;
|
||||
timeOffset = localNow - msg.data;
|
||||
}
|
||||
case "state": {
|
||||
const d = msg.data || {};
|
||||
if (d.dirs) updateDirs(d.dirs);
|
||||
@@ -144,8 +152,6 @@ function renderAll() {
|
||||
renderPlaylist();
|
||||
}
|
||||
|
||||
// ─── Track State ─────────────────────────────────────────────────────────────
|
||||
|
||||
function trackLabel(track, index) {
|
||||
const prefix = track.official ? "(official) " : "(unofficial) ";
|
||||
return prefix + track.path.replace(basePath, "").slice(1);
|
||||
|
||||
Reference in New Issue
Block a user