pretty cursor for stream

This commit is contained in:
Devaev Maxim 2018-07-13 08:19:43 +00:00
parent 3228e49497
commit b73705e275
2 changed files with 13 additions and 10 deletions

View File

@ -1,15 +1,16 @@
.stream-box {
box-sizing: border-box;
display: inline-block;
background-color: #e5e5f5;
padding: 1em;
text-align: left;
box-sizing: border-box;
display: inline-block;
background-color: #e5e5f5;
padding: 1em;
text-align: left;
}
.stream-box .stream-image {
width: 640px;
height: 480px;
border: 1px solid grey;
display: inline-block;
width: 640px;
height: 480px;
border: 1px solid grey;
display: inline-block;
cursor: wait;
}
.session-opened {

View File

@ -167,14 +167,16 @@ function pollStreamer() {
var http = new XMLHttpRequest();
http.open("GET", "/streamer/?action=snapshot", true);
http.onreadystatechange = function() {
if (http.readyState == 2) {
if (http.readyState == 2 || http.readyState == 4) {
var status = http.status;
http.abort();
if (status != 200) {
console.log("Refreshing streamer ...");
pollStreamer.last = false;
document.getElementById("stream-image").style.cursor = "wait";
} else if (!pollStreamer.last) {
__refreshStremaer();
document.getElementById("stream-image").style.cursor = "cell";
pollStreamer.last = true;
}
}