diff options
-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 |