Commit 39453047 authored by Neil Gershenfeld's avatar Neil Gershenfeld

initial viewer commit

parent 04b234e2
<html>
<body>
<img id="img" alt="waiting for screen transmission to start"><br>
<a href="screen.js">screen.js</a>
<a href="viewer.html">viewer.html</a>
<script type="text/javascript">
//
// viewer.html
// screen.js content viewer
// Neil Gershenfeld
// 2/9/17
//
var client_delay
initialize()
update()
function initialize() {
var req = new XMLHttpRequest()
req.open('GET','/initvars',true);
req.send()
req.addEventListener('loadend',function(evt) {
if (evt.loaded == 0) {
req.abort()
}
else {
var vars = JSON.parse(req.responseText)
client_delay = vars.client_delay
}
})
var req = new XMLHttpRequest()
req.open('GET','/initimg',true);
req.responseType = 'blob'
req.send()
req.addEventListener('loadend',function(evt) {
if (evt.loaded == 0) {
req.abort()
}
else {
var url = window.URL.createObjectURL(req.response)
document.getElementById("img").src = url
}
})
}
function update() {
var req = new XMLHttpRequest()
req.open('GET','/img',true);
req.responseType = 'blob'
req.send()
req.addEventListener('loadend',function(evt) {
if (evt.loaded == 0) {
req.abort()
document.getElementById("img").alt = 'screen transmission ended'
document.getElementById("img").src = ''
}
else {
var url = window.URL.createObjectURL(req.response)
document.getElementById("img").src = url
setTimeout(update,client_delay)
}
})
}
</script>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment