Commit 8df8970c authored by Neil Gershenfeld's avatar Neil Gershenfeld

starting client.html

parent 73959cbc
<html>
<body>
<img id="img" alt="waiting for screen transmission to start"><br>
<a href="server.js">server.js</a>
<a href="client.js">client.js</a>
<a href="client.html">client.html</a>
<script type="text/javascript">
//
// client.html
// streaming content browser client
// Neil Gershenfeld
// 2/12/17
//
var client_delay
initialize()
//update()
function initialize() {
var req = new XMLHttpRequest()
req.open('GET','/initimg',true);
req.responseType = 'blob'
req.send()
req.addEventListener('loadend',function(evt) {
console.log(req.response)
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