diff options
Diffstat (limited to '')
-rw-r--r-- | priv/static/js/widget.js | 57 |
1 files changed, 0 insertions, 57 deletions
diff --git a/priv/static/js/widget.js b/priv/static/js/widget.js deleted file mode 100644 index e1a5603..0000000 --- a/priv/static/js/widget.js +++ /dev/null @@ -1,57 +0,0 @@ -window.onload=function() { - - soundManager.setup({ - url: "/swf/", - preferFlash: false, - onready: function() { - window.soundPlayer = soundManager.createSound({ - id: 'radio', - url: 'http://91.121.59.45:8089/stream', - stream: true, - autoPlay: false, - usePolicyFile: true, - preferFlash: false, - autoStart: false - }) - - var playButton = document.getElementById("state"); - playButton.onclick = function() { - if (window.playerPlaying) { - console.log("should stop") - window.soundPlayer.stop(); - window.playerPlaying = false; - playButton.innerHTML = "▶"; - } else { - console.log("should start"); - window.soundPlayer.start(); - window.playerPlaying = true; - playButton.innerHTML = "⏸"; - } - } - - }, - ontimeout: function() { - console.log("soundmanager timeout") - } -}); - -window.evtSource = new EventSource("/api/icecast.sse"); -window.icecastStats = {}; -window.evtSource.addEventListener('icecast', function(e) { - var data = JSON.parse(e.data).icecast; - document.getElementById("np").innerHTML = data.np; - document.getElementById("genre").innerHTML = data.genre + " <span>en direct</span>"; - - player = document.getElementById("player"); - if (data.live != window.icecastStats.live) { - if (data.live) { - player.classList = ["live"]; - console.log("is live"); - } else { - player.classList = ["autodj"]; - console.log("stopped live"); - } - } - window.icecastStats = data; -}, false); -} |