forked from rfa/radioweb
merge fix
This commit is contained in:
commit
2d97d5ed05
113
index.html
113
index.html
@ -1,76 +1,65 @@
|
||||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<title>APR</title>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<link rel="stylesheet" href="./assets/stylesheets/mini-dark.css">
|
||||
<link rel="stylesheet" href="./assets/stylesheets/custom.css">
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<div id="content">
|
||||
<h1 aria-label="Anarchy Planet Radio">Anarchy PlⒶnet Radio</h1>
|
||||
<div class="container">
|
||||
<div class="row">
|
||||
|
||||
<div class="col-sm-12 col-md-8 col-md-offset-2 col-lg-6 col-lg-offset-3">
|
||||
<audio id="player" controls src="https://radio.anarchyplanet.org:8443/radio.ogg"></audio>
|
||||
|
||||
<ul id="history"><li><div class="spinner"></div></li></ul>
|
||||
|
||||
<footer>
|
||||
<p>Ⓐ</p>
|
||||
</footer>
|
||||
|
||||
<head>
|
||||
<title>APR</title>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<link rel="stylesheet" href="./assets/stylesheets/mini-dark.css">
|
||||
<link rel="stylesheet" href="./assets/stylesheets/custom.css">
|
||||
</head>
|
||||
<body>
|
||||
<div id="content">
|
||||
<h1 aria-label="Anarchy Planet Radio">Anarchy PlⒶnet Radio</h1>
|
||||
<div class="container">
|
||||
<div class="row">
|
||||
<div class="col-sm-12 col-md-8 col-md-offset-2 col-lg-6 col-lg-offset-3">
|
||||
<audio id="player" controls src="https://radio.anarchyplanet.org:8443/radio.ogg">
|
||||
Your browser does not support the HTML5 Audio element.
|
||||
</audio>
|
||||
<ul id="history"><li><div class="spinner"></div></li></ul>
|
||||
<footer>
|
||||
<p>Ⓐ</p>
|
||||
</footer>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<script>
|
||||
var player = document.getElementById('player');
|
||||
var rng = Math.floor(Math.random() * 10000);
|
||||
player.src = player.src + '?nocache=' + rng;
|
||||
|
||||
<script>
|
||||
var player = document.getElementById('player');
|
||||
var rng = Math.floor(Math.random() * 10000);
|
||||
player.src = player.src + '?nocache=' + rng;
|
||||
function update(msg) {
|
||||
document.title = msg.data + " - APR";
|
||||
|
||||
function update(msg) {
|
||||
document.title = msg.data + " - APR";
|
||||
var hist = document.getElementById("history");
|
||||
|
||||
var hist = document.getElementById("history");
|
||||
hist.insertAdjacentHTML("afterbegin", `<li>${msg.data}</li>`);
|
||||
|
||||
hist.insertAdjacentHTML("afterbegin", `<li>${msg.data}</li>`);
|
||||
if(hist.childElementCount >= 10) {
|
||||
hist.removeChild(hist.lastChild);
|
||||
}
|
||||
};
|
||||
|
||||
if(hist.childElementCount >= 10) {
|
||||
hist.removeChild(hist.lastChild);
|
||||
}
|
||||
};
|
||||
function connect() {
|
||||
var url = 'wss://radio.anarchyplanet.org/ws';
|
||||
var ws = new WebSocket(url);
|
||||
|
||||
function connect() {
|
||||
console.log('connecting');
|
||||
ws.onmessage = function(e) {
|
||||
update(e);
|
||||
};
|
||||
|
||||
var url = 'wss://radio.anarchyplanet.org/ws';
|
||||
var ws = new WebSocket(url);
|
||||
ws.onclose = function(e) {
|
||||
setTimeout(connect, 1000);
|
||||
};
|
||||
|
||||
ws.onmessage = function(e) {
|
||||
update(e);
|
||||
};
|
||||
ws.onerror = function(e) {
|
||||
ws.close();
|
||||
};
|
||||
}
|
||||
|
||||
ws.onclose = function(e) {
|
||||
setTimeout(connect, 1000);
|
||||
};
|
||||
|
||||
ws.onerror = function(e) {
|
||||
ws.close();
|
||||
};
|
||||
|
||||
console.log(ws);
|
||||
}
|
||||
|
||||
connect();
|
||||
|
||||
</script>
|
||||
|
||||
<noscript>Please enable javascript to use the audio player.</noscript>
|
||||
|
||||
</body>
|
||||
connect();
|
||||
</script>
|
||||
<noscript>Enable javascript for song information.</noscript>
|
||||
</body>
|
||||
</html>
|
||||
|
6
main.go
6
main.go
@ -47,15 +47,15 @@ func main() {
|
||||
}
|
||||
}
|
||||
|
||||
m.Broadcast([]byte(metadata))
|
||||
|
||||
history.Value = metadata
|
||||
history = history.Next()
|
||||
|
||||
m.Broadcast([]byte(metadata))
|
||||
}()
|
||||
})
|
||||
|
||||
m.HandleConnect(func(s *melody.Session) {
|
||||
for j := 0; j < 10; j++ {
|
||||
for i := 0; i < history.Len(); i++ {
|
||||
if history.Value != nil {
|
||||
s.Write([]byte(history.Value.(string)))
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user