Skip to content

Instantly share code, notes, and snippets.

@willasaywhat
Created April 11, 2015 03:30
Show Gist options
  • Save willasaywhat/67e5fc91e492bf24c2a1 to your computer and use it in GitHub Desktop.
Save willasaywhat/67e5fc91e492bf24c2a1 to your computer and use it in GitHub Desktop.
Foscam Viewer in JavaScript for Xbox One
<html>
<head>
<title>Cam Viewer</title>
<style type="text/css">
body {
background: black;
color: white;
}
body, input, button, select, option, textarea {
font-family: "Trebuchet MS", "Sans Serifs"; /* whatever font */
}
body {
font-size: 200%; /* whatever base font size I want */
}
input, button, select, option, textarea {
font-size: 200%;
width: 100%;
}
</style>
<script type='text/javascript'>
function refreshCamera(){
var img = document.getElementById('snapshot');
var usr = document.getElementById('usr');
var pw = document.getElementById('pw');
img.src = "http://10.0.1.2:88/cgi-bin/CGIProxy.fcgi?cmd=snapPicture2&usr="+usr.value+"&pwd="+pw.value+"&nonce="+String(Math.random()*10);
if(usr.value != '' && pw.value != ''){
var f = document.getElementById('loginform');
f.style.display = 'none';
img.style.display = 'block';
setTimeout(refreshCamera, 1000); // refresh 10 seconds
}
return false;
}
</script>
</head>
<body>
<img src='http://willasaywhat.com/content/images/2014/12/11368_10103651812325672_8727223405865750271_n.jpg' id='snapshot' style='width: 100%; display:none;' />
<form id='loginform'>
<label for='usr'>Username: </label><br/><input type='text' name='usr' id='usr' /><br/>
<label for='pw'>Password: </label><br/><input type='password' name='pw' id='pw' /><br/><br/>
<input type='button' class='submitBtn' onClick="refreshCamera();" name='submit' value='login' id='submit' />
</form>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment