summaryrefslogtreecommitdiff
path: root/kvmd/web/js/stream.js
diff options
context:
space:
mode:
authorDevaev Maxim <[email protected]>2018-08-06 21:25:41 +0300
committerDevaev Maxim <[email protected]>2018-08-06 21:25:41 +0300
commitf45efdf2fc1a49341bd7dc88c804b9eea5b1f775 (patch)
tree3c5472f2254cc932eb14f5c53cc7b550c515bba3 /kvmd/web/js/stream.js
parentff29d85faf8e8d414006a173b29b4eaf2bceab84 (diff)
adjustable stream size
Diffstat (limited to 'kvmd/web/js/stream.js')
-rw-r--r--kvmd/web/js/stream.js22
1 files changed, 17 insertions, 5 deletions
diff --git a/kvmd/web/js/stream.js b/kvmd/web/js/stream.js
index e7bd82d4..e393c6fe 100644
--- a/kvmd/web/js/stream.js
+++ b/kvmd/web/js/stream.js
@@ -1,5 +1,7 @@
var stream = new function() {
var __prev_state = false;
+ var __normal_size = {width: 640, height: 480};
+ var __size_factor = 1;
this.startPoller = function() {
var http = tools.makeRequest("GET", "/streamer/?action=snapshot", function() {
@@ -38,14 +40,24 @@ var stream = new function() {
});
};
+ this.resize = function(percent) {
+ $("stream-size-counter").innerHTML = percent + "%";
+ __size_factor = percent / 100;
+ __applySizeFactor();
+ };
+
+ var __applySizeFactor = function() {
+ var el_stream_image = $("stream-image");
+ el_stream_image.style.width = __normal_size.width * __size_factor + "px";
+ el_stream_image.style.height = __normal_size.height * __size_factor + "px";
+ };
+
var __refreshImage = function() {
var http = tools.makeRequest("GET", "/kvmd/streamer", function() {
if (http.readyState === 4 && http.status === 200) {
- size = JSON.parse(http.responseText).result.size;
- el_stream_image = $("stream-image");
- el_stream_image.style.width = size.width + "px";
- el_stream_image.style.height = size.height + "px";
- el_stream_image.src = "/streamer/?action=stream&time=" + new Date().getTime();
+ __normal_size = JSON.parse(http.responseText).result.size;
+ __applySizeFactor();
+ $("stream-image").src = "/streamer/?action=stream&time=" + new Date().getTime();
ui.showWindow("stream-window");
}
});