From 730edee7ff8f00af2777ba18ec0906cbe09c5041 Mon Sep 17 00:00:00 2001 From: Hanyuu Date: Sat, 4 Jan 2025 23:49:55 +0100 Subject: [PATCH] pending: fix and hook up spectrogram viewer --- assets/js/radio.js | 13 +++++++++++++ streamer/audio/spectrum.go | 2 +- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/assets/js/radio.js b/assets/js/radio.js index 940804ce..a8b87f09 100644 --- a/assets/js/radio.js +++ b/assets/js/radio.js @@ -237,6 +237,19 @@ function adminPlayerPlayPause() { } } +function adminShowSpectrogram() { + let img = document.querySelector("#admin-player-spec-image"); + let modal = document.querySelector("#admin-player-spec-modal"); + if (img && modal && admin_player.src) { + // Only the pending endpoint supports spectrograms, but + // the player is used for both pending and database. + if (admin_player.src.includes("pending")) { + img.src = admin_player.src + "?spectrum=true"; + modal.classList.add("is-active"); + } + } +} + // updateTimes looks for all