diff options
author | Devaev Maxim <[email protected]> | 2018-11-05 06:13:08 +0300 |
---|---|---|
committer | Devaev Maxim <[email protected]> | 2018-11-05 06:13:08 +0300 |
commit | 18a626a30c63367b97af74bc3e30fc6b75cc48dd (patch) | |
tree | 76443a01079bb809f03d88e4220bcb356afabc7e /web | |
parent | 4e49931a252ebd555ab523673c2c69808c20ab6a (diff) |
soft fps limit
Diffstat (limited to 'web')
-rw-r--r-- | web/index.html | 7 | ||||
-rw-r--r-- | web/js/stream.js | 34 |
2 files changed, 41 insertions, 0 deletions
diff --git a/web/index.html b/web/index.html index 99e48cf8..0fac2724 100644 --- a/web/index.html +++ b/web/index.html @@ -86,6 +86,13 @@ </div> <hr> <div class="ctl-dropdown-content-text"> + Soft FPS limit: <span id="stream-soft-fps-value">30</span> + <div class="stream-slider-box"> + <input disabled type="range" id="stream-soft-fps-slider" class="slider" /> + </div> + </div> + <hr> + <div class="ctl-dropdown-content-text"> Stream size: <span id="stream-size-value">100%</span> <div class="stream-slider-box"> <input type="range" id="stream-size-slider" class="slider" /> diff --git a/web/js/stream.js b/web/js/stream.js index 3394951e..5ea48067 100644 --- a/web/js/stream.js +++ b/web/js/stream.js @@ -9,6 +9,7 @@ function Stream() { var __client_id = ""; var __fps = 0; var __quality_timer = null; + var __soft_fps_timer = null; var __init__ = function() { $("stream-led").title = "Stream inactive"; @@ -20,6 +21,13 @@ function Stream() { $("stream-quality-slider").oninput = __setQuality; $("stream-quality-slider").onchange = __setQuality; + $("stream-soft-fps-slider").min = 1; + $("stream-soft-fps-slider").max = 30; + $("stream-soft-fps-slider").step = 1; + $("stream-soft-fps-slider").value = 30; + $("stream-soft-fps-slider").oninput = __setSoftFps; + $("stream-soft-fps-slider").onchange = __setSoftFps; + $("stream-size-slider").min = 20; $("stream-size-slider").max = 200; $("stream-size-slider").step = 5; @@ -50,6 +58,7 @@ function Stream() { $("stream-led").title = "Stream inactive"; $("stream-screenshot-button").disabled = true; $("stream-quality-slider").disabled = true; + $("stream-soft-fps-slider").disabled = true; $("stream-reset-button").disabled = true; __updateStreamHeader(false); __fps = 0; @@ -60,6 +69,11 @@ function Stream() { $("stream-quality-slider").value = response.source.quality; $("stream-quality-value").innerHTML = response.source.quality + "%"; } + if ($("stream-soft-fps-slider").value !== response.source.soft_fps && !__soft_fps_timer) { + $("stream-soft-fps-slider").value = response.source.soft_fps; + $("stream-soft-fps-value").innerHTML = response.source.soft_fps; + } + if (__resolution.width !== response.source.resolution.width || __resolution.height !== response.source.resolution.height) { __resolution = response.source.resolution; @@ -101,6 +115,7 @@ function Stream() { $("stream-led").title = "Stream is active"; $("stream-screenshot-button").disabled = false; $("stream-quality-slider").disabled = false; + $("stream-soft-fps-slider").disabled = false; $("stream-reset-button").disabled = false; __prev_state = true; tools.info("Stream acquired"); @@ -160,6 +175,25 @@ function Stream() { }, 1000); }; + var __setSoftFps = function() { + var soft_fps = $("stream-soft-fps-slider").value; + $("stream-soft-fps-value").innerHTML = soft_fps; + if (__soft_fps_timer) { + clearTimeout(__soft_fps_timer); + } + __soft_fps_timer = setTimeout(function() { + $("stream-soft-fps-slider").disabled = true; + var http = tools.makeRequest("POST", "/kvmd/streamer/set_params?soft_fps=" + soft_fps, function() { + if (http.readyState === 4) { + if (http.status !== 200) { + ui.error("Can't configure stream:<br>", http.responseText); + } + __soft_fps_timer = null; + } + }); + }, 1000); + }; + var __resize = function(center=false) { var size = $("stream-size-slider").value; $("stream-size-value").innerHTML = size + "%"; |