Online radio streaming delay
On urbansunsets.com I am streaming online radio from radio.co. It does work, but after a period of continuous playing, there is a delay at the part that shows what is currently playing.
- <div class="col-lg-12 col-sm-12">
- <div id="radio_player">
- <div class="default-player">
- <audio width="320" height="240" controls playsinline id="audio_player">
- <source src="http://stream.radio.co/sedf8bacc9/listen" type="audio/mpeg">
- </audio>
- </div>
- <div id="audioplayer">
- <button id="pButton" class="pause"></button>
- <div class="live">Live</div>
- <div id="volume_control">
- <label id="rngVolume_label" for="rngVolume">
- <i class="fa fa-volume-up" aria-hidden="true"></i>
- </label>
- <input type="range" id="rngVolume" min="0" max="1" step="0.01" value="0.5">
- </div>
- <div class="current-piece">
- // Current piece
- <div class="now-playing">Now playing:</div>
- <script src="https://public.radio.co/embed/sedf8bacc9/song.js"></script>
- </div>
- </div>
- </div>
- </div>
In jQuery, I have put together a small script to force reload the script that shoes the current track:
- function showCurrSong() {
- var currSongScript = document.createElement('script');
- currSongScript.src= 'https://public.radio.co/embed/sedf8bacc9/song.js';
- $('#song_name').html('');
- $('#song_name').append(currSongScript);
- console.log(currSongScript);
- }
- var refreshTime = 1000 * 60 * 3; // minutes
- setInterval(function(){showCurrSong()}, refreshTime);
But that replaces the "frozen" old track name with "Loading...".
Why is that?
Thank you!