summaryrefslogtreecommitdiff
path: root/web
diff options
context:
space:
mode:
authorDevaev Maxim <[email protected]>2020-12-01 12:57:13 +0300
committerDevaev Maxim <[email protected]>2020-12-01 12:57:13 +0300
commitfd1e0d7296c1259a5cbf810817a812a39f9a0ff0 (patch)
tree237338c17890476675fac10491bffb59637b8b39 /web
parent5eff81061bce75d15a3e8634ec38be2481c8b4ef (diff)
fixed resolution switching
Diffstat (limited to 'web')
-rw-r--r--web/share/js/kvm/stream.js14
1 files changed, 5 insertions, 9 deletions
diff --git a/web/share/js/kvm/stream.js b/web/share/js/kvm/stream.js
index 87731ed9..4e3e31fb 100644
--- a/web/share/js/kvm/stream.js
+++ b/web/share/js/kvm/stream.js
@@ -34,7 +34,6 @@ export function Streamer() {
var __resolution = {width: 640, height: 480};
var __resolution_str = "640x480";
- var __available_resolutions = [];
var __size_factor = 1;
@@ -53,10 +52,7 @@ export function Streamer() {
tools.sliderSetParams($("stream-desired-fps-slider"), 0, 120, 1, 0);
tools.sliderSetOnUp($("stream-desired-fps-slider"), 1000, __updateDesiredFpsValue, (value) => __sendParam("desired_fps", value));
- $("stream-resolution-selector").onchange = (() => {
- wm.switchEnabled($("stream-resolution-selector"), false);
- __sendParam("resolution", $("stream-resolution-selector").value);
- });
+ $("stream-resolution-selector").onchange = (() => __sendParam("resolution", $("stream-resolution-selector").value));
tools.sliderSetParams($("stream-size-slider"), 20, 200, 5, 100);
$("stream-size-slider").oninput = () => __resize();
@@ -124,16 +120,16 @@ export function Streamer() {
}
if (state.features.resolution) {
- if (__available_resolutions !== state.limits.available_resolutions) {
- __available_resolutions = state.limits.available_resolutions;
+ if ($("stream-resolution-selector").resolutions !== state.limits.available_resolutions) {
let resolutions_html = "";
- for (let variant of __available_resolutions) {
+ for (let variant of state.limits.available_resolutions) {
resolutions_html += `<option value="${variant}">${variant}</option>`;
}
- if (!__available_resolutions.includes(__resolution_str)) {
+ if (!state.limits.available_resolutions.includes(__resolution_str)) {
resolutions_html += `<option value="${__resolution_str}">${__resolution_str}</option>`;
}
$("stream-resolution-selector").innerHTML = resolutions_html;
+ $("stream-resolution-selector").resolutions = state.limits.available_resolutions;
}
document.querySelector(`#stream-resolution-selector [value="${__resolution_str}"]`).selected = true;
wm.switchEnabled($("stream-resolution-selector"), true);