summaryrefslogtreecommitdiff
path: root/web
diff options
context:
space:
mode:
authorDevaev Maxim <[email protected]>2018-09-28 05:06:23 +0300
committerDevaev Maxim <[email protected]>2018-09-28 06:13:38 +0300
commit054f8e44dbc49a458d22a1d8d5a588a9a831761c (patch)
tree2d67b1ac32b4e8a43e69bd6d2c5bf6ab1fda787f /web
parent8fd196bde84c1b396f54cd670e2767d1ed4068ee (diff)
some fixes for ustreamer
Diffstat (limited to 'web')
-rw-r--r--web/index.html4
-rw-r--r--web/js/stream.js34
2 files changed, 22 insertions, 16 deletions
diff --git a/web/index.html b/web/index.html
index 90fbd11e..4fd108b0 100644
--- a/web/index.html
+++ b/web/index.html
@@ -76,9 +76,7 @@
<hr>
<div data-dont-hide-menu class="ctl-dropdown-content-text">
Quality:
- <select disabled id="stream-quality-select">
- <option>80%</option>
- </select>
+ <select disabled id="stream-quality-select"></select>
</div>
<hr>
<div data-dont-hide-menu class="ctl-dropdown-content-text">
diff --git a/web/js/stream.js b/web/js/stream.js
index af3e45e9..18907788 100644
--- a/web/js/stream.js
+++ b/web/js/stream.js
@@ -5,7 +5,7 @@ function Stream() {
var __prev_state = false;
- var __quality = 80;
+ var __quality = 10;
var __normal_size = {width: 640, height: 480};
var __size_factor = 1;
@@ -14,6 +14,7 @@ function Stream() {
$("stream-led").title = "Stream inactive";
var quality = 10;
+ $("stream-quality-select").innerHTML = "";
for (; quality <= 100; quality += 10) {
$("stream-quality-select").innerHTML += "<option value=\"" + quality + "\">" + quality + "%</option>";
}
@@ -34,7 +35,7 @@ function Stream() {
var http = tools.makeRequest("GET", "/streamer/ping", function() {
if (http.readyState === 4) {
var response = (http.status === 200 ? JSON.parse(http.responseText) : null);
- if (http.status !== 200 || !response.stream.online) {
+ if (http.status !== 200) {
tools.info("Refreshing stream ...");
__prev_state = false;
$("stream-image").className = "stream-image-inactive";
@@ -43,20 +44,27 @@ function Stream() {
$("stream-led").title = "Stream inactive";
$("stream-reset-button").disabled = true;
$("stream-quality-select").disabled = true;
- } else if (http.status === 200 && !__prev_state) {
- __normal_size = response.stream.resolution;
- __refreshImage();
- __prev_state = true;
- $("stream-image").className = "stream-image-active";
- $("stream-box").classList.remove("stream-box-inactive");
- $("stream-led").className = "led-on";
- $("stream-led").title = "Stream is active";
- $("stream-reset-button").disabled = false;
- $("stream-quality-select").disabled = false;
+ } else if (http.status === 200) {
+ if (__prev_state) {
+ if (__normal_size != response.stream.resolution) {
+ __normal_size = response.stream.resolution;
+ __applySizeFactor();
+ }
+ } else {
+ __normal_size = response.stream.resolution;
+ __refreshImage();
+ __prev_state = true;
+ $("stream-image").className = "stream-image-active";
+ $("stream-box").classList.remove("stream-box-inactive");
+ $("stream-led").className = "led-on";
+ $("stream-led").title = "Stream is active";
+ $("stream-reset-button").disabled = false;
+ $("stream-quality-select").disabled = false;
+ }
}
}
});
- setTimeout(__startPoller, 1500);
+ setTimeout(__startPoller, 1000);
};
var __clickResetButton = function() {