Last active
December 27, 2015 16:09
-
-
Save Gottox/7353204 to your computer and use it in GitHub Desktop.
Plain Javascript/HTML Client for MPD.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="utf-8" /> | |
<title></title> | |
<script type="text/javascript"> | |
function command(cmd) { | |
var http = new XMLHttpRequest(); | |
var params = cmd+"\nclose\n"; | |
var host = document.getElementById("host").value; | |
var port = document.getElementById("port").value; | |
http.open("POST", "http://"+host+":"+port, true); | |
http.send(params); | |
http.onreadystatechange = function() {//Call a function when the state changes. | |
console.log(http); | |
console.log(arguments); | |
} | |
} | |
</script> | |
</head> | |
<body> | |
Host: <input id="host" value="localhost"> | | |
<input id="port" type="number" value="6600"> <br> | |
<a href="javascript:void(command('previous'))">⏪</a> | |
<a href="javascript:void(command('play'))">▶</a> | |
<a href="javascript:void(command('pause'))">||</a> | |
<a href="javascript:void(command('next'))">⏩</a> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment