Permalink
Switch branches/tags
Nothing to show
Find file
Fetching contributors…
Cannot retrieve contributors at this time
58 lines (51 sloc) 1.71 KB
<html>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.min.js"></script>
<script src="/socket.io/socket.io.js"></script>
<script>
var socket = io.connect('http://192.168.1.167'),
clients = [];
// function createClientsString(client){
// var clientsString = "";
// for (var i=0; i<clients.length; i++) {
// if (clients[i]) {
// clientsString = clientsString + clients[i] + "\n";
// }
// }
// return clientsString;
// }
$(document).ready(function(){
$("#play").click(function(){
socket.emit('masterEvent', {
'audioEvent': 'play'
});
});
$("#stop").click(function(){
socket.emit('masterEvent', {
'audioEvent': 'stop'
});
});
socket.emit('masterEvent', {
'audioEvent': 'requestClientList'
});
});
socket.on('masterEvent', function(data){
console.log(data);
if (data.audioEvent === 'updateSources') {
$("#clients").html(data.sources);
}
});
// socket.on('clientList', function(data){
// $("#clients").text(data.list);
// });
</script>
</head>
<body>
<input type="button" id="play" value="play"/>
<input type="button" id="pause" value="pause"/>
<input type="button" id="stop" value="stop"/><br>
currently connected:
<div id="clients">
</div>
</body>
</html>