summaryrefslogtreecommitdiff
path: root/web
diff options
context:
space:
mode:
authorDevaev Maxim <[email protected]>2018-11-08 05:16:17 +0300
committerDevaev Maxim <[email protected]>2018-11-08 05:16:17 +0300
commit363bbdac57fb20cda7a261196105ab4b5f61e7ff (patch)
tree495c3ac16e698010a5e8e0867e521160db7df94a /web
parent4927d3e17334dfe6768396457c49b11aa8e16e21 (diff)
new ustreamer
Diffstat (limited to 'web')
-rw-r--r--web/index.html4
-rw-r--r--web/js/stream.js61
2 files changed, 34 insertions, 31 deletions
diff --git a/web/index.html b/web/index.html
index 0fac2724..4ecf7928 100644
--- a/web/index.html
+++ b/web/index.html
@@ -86,9 +86,9 @@
</div>
<hr>
<div class="ctl-dropdown-content-text">
- Soft FPS limit: <span id="stream-soft-fps-value">30</span>
+ Stream FPS: <span id="stream-desired-fps-value">30</span>
<div class="stream-slider-box">
- <input disabled type="range" id="stream-soft-fps-slider" class="slider" />
+ <input disabled type="range" id="stream-desired-fps-slider" class="slider" />
</div>
</div>
<hr>
diff --git a/web/js/stream.js b/web/js/stream.js
index d9c1e788..2b431e89 100644
--- a/web/js/stream.js
+++ b/web/js/stream.js
@@ -6,9 +6,9 @@ function Stream() {
var __prev_state = false;
var __resolution = {width: 640, height: 480};
var __size_factor = 1;
- var __key = tools.makeId();
+ var __client_key = tools.makeId();
var __client_id = "";
- var __fps = -1;
+ var __client_fps = -1;
var __init__ = function() {
$("stream-led").title = "Stream inactive";
@@ -21,12 +21,12 @@ function Stream() {
$("stream-quality-value").innerHTML = value + "%";
}, __sendQuality);
- $("stream-soft-fps-slider").min = 1;
- $("stream-soft-fps-slider").max = 30;
- $("stream-soft-fps-slider").step = 1;
- $("stream-soft-fps-slider").value = 30;
- tools.setOnUpSlider($("stream-soft-fps-slider"), 1000, function(value) {
- $("stream-soft-fps-value").innerHTML = value;
+ $("stream-desired-fps-slider").min = 0;
+ $("stream-desired-fps-slider").max = 30;
+ $("stream-desired-fps-slider").step = 1;
+ $("stream-desired-fps-slider").value = 0;
+ tools.setOnUpSlider($("stream-desired-fps-slider"), 1000, function(value) {
+ $("stream-desired-fps-value").innerHTML = (value == 0 ? "Unlimited" : value);
}, __sendSoftFps);
$("stream-size-slider").min = 20;
@@ -61,31 +61,34 @@ function Stream() {
$("stream-screenshot-button").disabled = true;
__setStreamerControlsDisabled(true);
__updateStreamHeader(false);
- __key = tools.makeId();
+ __client_key = tools.makeId();
__client_id = "";
- __fps = -1;
+ __client_fps = -1;
__prev_state = false;
}
} else if (http.status === 200) {
- if (!$("stream-soft-fps-slider").activated) {
- $("stream-soft-fps-slider").disabled = false;
- if ($("stream-soft-fps-slider").value !== response.source.soft_fps) {
- $("stream-soft-fps-slider").value = response.source.soft_fps;
- $("stream-soft-fps-value").innerHTML = response.source.soft_fps;
+ var source = response.result.source;
+ var stream = response.result.stream;
+
+ if (!$("stream-desired-fps-slider").activated) {
+ $("stream-desired-fps-slider").disabled = false;
+ if ($("stream-desired-fps-slider").value !== source.desired_fps) {
+ $("stream-desired-fps-slider").value = source.desired_fps;
+ $("stream-desired-fps-value").innerHTML = (source.desired_fps == 0 ? "Unlimited" : source.desired_fps);
}
}
if (!$("stream-quality-slider").activated) {
$("stream-quality-slider").disabled = false;
- if ($("stream-quality-slider").value !== response.source.quality) {
- $("stream-quality-slider").value = response.source.quality;
- $("stream-quality-value").innerHTML = response.source.quality + "%";
+ if ($("stream-quality-slider").value !== source.quality) {
+ $("stream-quality-slider").value = source.quality;
+ $("stream-quality-value").innerHTML = source.quality + "%";
}
}
- if (__resolution.width !== response.source.resolution.width || __resolution.height !== response.source.resolution.height) {
- __resolution = response.source.resolution;
+ if (__resolution.width !== source.resolution.width || __resolution.height !== source.resolution.height) {
+ __resolution = source.resolution;
if ($("stream-auto-resize-checkbox").checked) {
__adjustSizeFactor();
} else {
@@ -94,21 +97,21 @@ function Stream() {
}
var stream_client = tools.getCookie("stream_client");
- if (!__client_id && stream_client && stream_client.startsWith(__key + "/")) {
+ if (!__client_id && stream_client && stream_client.startsWith(__client_key + "/")) {
tools.info("Stream: found acceptable stream_client cookie:", stream_client);
__client_id = stream_client.slice(stream_client.indexOf("/") + 1);
}
- if (response.stream.clients_stat.hasOwnProperty(__client_id)) {
- __fps = response.stream.clients_stat[__client_id].fps;
+ if (stream.clients_stat.hasOwnProperty(__client_id)) {
+ __client_fps = stream.clients_stat[__client_id].fps;
} else {
- __fps = -1;
+ __client_fps = -1;
}
__updateStreamHeader(true);
if (!__prev_state) {
- var path = "/streamer/stream?key=" + __key;
+ var path = "/streamer/stream?key=" + __client_key;
if (tools.browser.is_chrome || tools.browser.is_blink) {
// uStreamer fix for Blink https://bugs.chromium.org/p/chromium/issues/detail?id=527446
tools.info("Stream: using advance_headers=1 to fix Blink MJPG bugs");
@@ -138,7 +141,7 @@ function Stream() {
var el_grab = document.querySelector("#stream-window-header .window-grab");
var el_info = $("stream-info");
if (online) {
- var fps_suffix = (__fps >= 0 ? " / " + __fps + " fps" : "");
+ var fps_suffix = (__client_fps >= 0 ? " / " + __client_fps + " fps" : "");
el_grab.innerHTML = el_info.innerHTML = "Stream &ndash; " + __resolution.width + "x" + __resolution.height + fps_suffix;
} else {
el_grab.innerHTML = el_info.innerHTML = "Stream &ndash; offline";
@@ -179,12 +182,12 @@ function Stream() {
var __sendSoftFps = function(value) {
__setStreamerControlsDisabled(true);
- var http = tools.makeRequest("POST", "/kvmd/streamer/set_params?soft_fps=" + value, function() {
+ var http = tools.makeRequest("POST", "/kvmd/streamer/set_params?desired_fps=" + value, function() {
if (http.readyState === 4) {
if (http.status !== 200) {
ui.error("Can't configure stream:<br>", http.responseText);
}
- $("stream-soft-fps-slider").activated = false;
+ $("stream-desired-fps-slider").activated = false;
}
});
};
@@ -192,7 +195,7 @@ function Stream() {
var __setStreamerControlsDisabled = function(disabled) {
$("stream-reset-button").disabled = disabled;
$("stream-quality-slider").disabled = disabled;
- $("stream-soft-fps-slider").disabled = disabled;
+ $("stream-desired-fps-slider").disabled = disabled;
};
var __resize = function(center=false) {