diff options
author | kaotisk <kaotisk@arching-kaos.org> | 2024-11-12 03:04:41 +0200 |
---|---|---|
committer | kaotisk <kaotisk@arching-kaos.org> | 2024-11-12 03:04:41 +0200 |
commit | 926c843a5f45bc79ac1d9f3f59cb379fef04043e (patch) | |
tree | beb28e23e7e34c9e8de32f9f191df88d2e370d6b | |
parent | da40e85c746c623826544076199be33bc46479e7 (diff) | |
download | arching-kaos-radio-926c843a5f45bc79ac1d9f3f59cb379fef04043e.tar.gz arching-kaos-radio-926c843a5f45bc79ac1d9f3f59cb379fef04043e.tar.bz2 arching-kaos-radio-926c843a5f45bc79ac1d9f3f59cb379fef04043e.zip |
Fix bug
-rw-r--r-- | client/index.html | 1 | ||||
-rw-r--r-- | client/js/radio_emulator.js | 7 |
2 files changed, 6 insertions, 2 deletions
diff --git a/client/index.html b/client/index.html index db4d0eb..9d0ef33 100644 --- a/client/index.html +++ b/client/index.html @@ -46,6 +46,7 @@ <audio preload="auto" controls muted></audio> </div> <div class="div-row"> + <button onclick="start_radio()">Start!</button> <button onclick="sync_radio()">Sync!</button> </div> </div> diff --git a/client/js/radio_emulator.js b/client/js/radio_emulator.js index 3687ffb..13d874e 100644 --- a/client/js/radio_emulator.js +++ b/client/js/radio_emulator.js @@ -202,7 +202,7 @@ function loadShowCallback(json, params) debugLog(listItem); //debugLog(params); audioElement.load(); - FetchAudio(`${audioRequest}${json.hash}`, genericCallback); + FetchAudio(`${audioRequest}${json.hash}`, sync_radio); audioElement.type = json.mimetype; values.current_time = Math.floor((values.now_on_sequence/1000)); // - listItem.starts_on)/1000); updateComponentsAfterLoadShowCallback(json, listItem); @@ -233,7 +233,6 @@ function fadeInAudio() function sync_radio() { - FetchJSON(`${listRequest}`, hashCallback, [ new Date().getTime() ]); var new_now = values.current_time + getSecondsHere(); debugLog("Trying to sync @ "+ values.current_time + " + " + getSecondsHere() + " = " + new_now); audioElement.currentTime = new_now; @@ -371,5 +370,9 @@ function hashCallback(json, params) FetchJSON(`${jsonRequest}${json.latest_list}`, listCallback, [now, json.latest_list]); } +function start_radio() +{ + FetchJSON(`${listRequest}`, hashCallback, [ new Date().getTime() ]); +} // @license-end |