diff options
author | Devaev Maxim <[email protected]> | 2021-06-10 16:27:58 +0300 |
---|---|---|
committer | Devaev Maxim <[email protected]> | 2021-06-10 16:27:58 +0300 |
commit | f9d2e747e35968d1d1cae06a451a7eec001068ad (patch) | |
tree | 20bb23a78dc02c5885842c56237558bbd3f83548 /web | |
parent | 3e92523ba393647fa54589639d80f6ad16cd0fbe (diff) |
show streamer name in window title
Diffstat (limited to 'web')
-rw-r--r-- | web/kvm/index.html | 2 | ||||
-rw-r--r-- | web/kvm/window-stream.pug | 2 | ||||
-rw-r--r-- | web/share/js/kvm/stream.js | 38 |
3 files changed, 25 insertions, 17 deletions
diff --git a/web/kvm/index.html b/web/kvm/index.html index d8fa86f2..2880702a 100644 --- a/web/kvm/index.html +++ b/web/kvm/index.html @@ -532,7 +532,7 @@ </ul> <div class="window window-resizable" id="stream-window" data-show-by-button="show-stream-button"> <div class="window-header" id="stream-window-header"> - <div class="window-grab">Stream</div> + <div class="window-grab">MJPEG</div> <button class="window-button-close">×</button> <button class="window-button-maximize">☐</button> <button class="window-button-original">•</button> diff --git a/web/kvm/window-stream.pug b/web/kvm/window-stream.pug index 3bd7c2d5..d72d25e8 100644 --- a/web/kvm/window-stream.pug +++ b/web/kvm/window-stream.pug @@ -1,6 +1,6 @@ div(id="stream-window" class="window window-resizable" data-show-by-button="show-stream-button") div(id="stream-window-header" class="window-header") - div(class="window-grab") Stream + div(class="window-grab") MJPEG button(class="window-button-close") × button(class="window-button-maximize") ☐ button(class="window-button-original") • diff --git a/web/share/js/kvm/stream.js b/web/share/js/kvm/stream.js index 92f1cd69..b4633d4c 100644 --- a/web/share/js/kvm/stream.js +++ b/web/share/js/kvm/stream.js @@ -45,6 +45,9 @@ function _JanusStreamer(__setActive, __setInactive, __setInfo) { var __state = null; + self.getName = () => "WebRTC"; + self.getMode = () => "janus"; + self.getResolution = function() { let el_video = $("stream-video"); return { @@ -292,6 +295,9 @@ function _MjpegStreamer(__setActive, __setInactive, __setInfo) { /************************************************************************/ + self.getName = () => "MJPEG"; + self.getMode = () => "mjpeg"; + self.getResolution = function() { let el_image = $("stream-image"); return { @@ -557,10 +563,10 @@ export function Streamer() { $("stream-box").classList.toggle("stream-box-offline", !online); let el_grab = document.querySelector("#stream-window-header .window-grab"); let el_info = $("stream-info"); - let title = "Stream – "; + let title = `${__streamer.getName()} – `; if (is_active) { if (!online) { - title += "no signal / "; + title += "No signal / "; } title += __makeStringResolution(__resolution); if (text.length > 0) { @@ -570,7 +576,7 @@ export function Streamer() { if (text.length > 0) { title += text; } else { - title += "inactive"; + title += "Inactive"; } } el_grab.innerHTML = el_info.innerHTML = title; @@ -603,18 +609,20 @@ export function Streamer() { var __clickModeRadio = function() { if (_Janus !== null) { let mode = tools.radioGetValue("stream-mode-radio"); - setTimeout(() => tools.radioSetValue("stream-mode-radio", mode), 100); - tools.hiddenSetVisible($("stream-image"), (mode === "mjpeg")); - tools.hiddenSetVisible($("stream-video"), (mode !== "mjpeg")); - if (mode === "mjpeg") { - __streamer.stopStream(); - __streamer = new _MjpegStreamer(__setActive, __setInactive, __setInfo); - } else { // janus - __streamer.stopStream(); - __streamer = new _JanusStreamer(__setActive, __setInactive, __setInfo); - } - if (wm.isWindowVisible($("stream-window"))) { - __streamer.ensureStream(__state); + if (mode !== __streamer.getMode()) { + setTimeout(() => tools.radioSetValue("stream-mode-radio", mode), 100); + tools.hiddenSetVisible($("stream-image"), (mode === "mjpeg")); + tools.hiddenSetVisible($("stream-video"), (mode !== "mjpeg")); + if (mode === "mjpeg") { + __streamer.stopStream(); + __streamer = new _MjpegStreamer(__setActive, __setInactive, __setInfo); + } else { // janus + __streamer.stopStream(); + __streamer = new _JanusStreamer(__setActive, __setInactive, __setInfo); + } + if (wm.isWindowVisible($("stream-window"))) { + __streamer.ensureStream(__state); + } } } }; |