ocarina/html/controls.html
Bryan Schumaker a88f8225a7 Web remote controls
I can play, pause, stop, and advance to the next song through the web
interface.
2010-11-19 22:47:41 -05:00

72 lines
1.2 KiB
HTML

<html>
<head>
<script type="text/javascript">
function do_request(action)
{
var http = new XMLHttpRequest();
http.open('GET', "controls.py?a="+action, true);
http.send();
return http;
}
/*function get_response(http)
{
while (http.readyState != 4)
{}
var resp = http.responseText;
return resp;
}*/
function control(action)
{
var http = do_request(action);
/*var resp = get_response(http);*/
}
function play()
{
control("play");
var button = document.getElementById("play_pause");
button.innerHTML = "<img src=\"stock_media-pause.png\" onclick=\"pause();\">";
}
function pause()
{
control("pause");
var button = document.getElementById("play_pause");
button.innerHTML = "<img src=\"stock_media-play.png\" onclick=\"play();\">";
}
function stop()
{
control("stop");
var button = document.getElementById("play_pause");
button.innerHTML = "<img src=\"stock_media-play.png\" onclick=\"play();\">";
}
function next()
{
control("next");
}
</script>
</head>
<body>
<table>
<tr>
<td id="play_pause">
<img src="stock_media-play.png" onclick="play();"/>
</td><td>
<img src="stock_media-stop.png" onclick="stop();"/>
</td><td>
<img src="stock_media-next.png" onclick="next();"/>
</td>
</tr>
</table>
</body>
</html>