diff options
author | Maxim Devaev <[email protected]> | 2022-06-01 09:32:45 +0300 |
---|---|---|
committer | Maxim Devaev <[email protected]> | 2022-06-01 09:32:45 +0300 |
commit | 08b7c577d7f00e037b84f9aca6c714edc4774a07 (patch) | |
tree | 7ae6b78c1f9482a0eceb26b9fd8a9559557ec8b7 | |
parent | fd256852bf78f6afe04c53c583a560622124baff (diff) |
webrtc audio draft
-rw-r--r-- | configs/os/sysusers.conf | 1 | ||||
-rw-r--r-- | web/kvm/index.html | 7 | ||||
-rw-r--r-- | web/kvm/navbar-system.pug | 4 | ||||
-rw-r--r-- | web/share/js/kvm/stream.js | 12 |
4 files changed, 24 insertions, 0 deletions
diff --git a/configs/os/sysusers.conf b/configs/os/sysusers.conf index fefb84f4..e939ad88 100644 --- a/configs/os/sysusers.conf +++ b/configs/os/sysusers.conf @@ -21,6 +21,7 @@ m kvmd systemd-journal m kvmd-ipmi kvmd m kvmd-vnc kvmd m kvmd-janus kvmd +m kvmd-janus audio m kvmd-nginx kvmd m kvmd-nginx kvmd-janus diff --git a/web/kvm/index.html b/web/kvm/index.html index 8fcbf81f..3343f07e 100644 --- a/web/kvm/index.html +++ b/web/kvm/index.html @@ -219,6 +219,13 @@ </div> </td> </tr> + <tr class="feature-disabled" id="stream-audio"> + <td>Audio volume:</td> + <td> + <input class="slider" type="range" id="stream-audio-volume-slider"> + </td> + <td class="value" id="stream-audio-volume-value" style="min-width: 30px; max-width:30px"></td> + </tr> </table> <hr> <div class="buttons buttons-row"> diff --git a/web/kvm/navbar-system.pug b/web/kvm/navbar-system.pug index 4bbb517c..55ec99ab 100644 --- a/web/kvm/navbar-system.pug +++ b/web/kvm/navbar-system.pug @@ -46,6 +46,10 @@ li(class="right") label(for="stream-mode-radio-mjpeg") MJPEG / HTTP input(type="radio" id="stream-mode-radio-janus" name="stream-mode-radio" value="janus") label(for="stream-mode-radio-janus") H.264 / WebRTC + tr(id="stream-audio", class="feature-disabled") + td Audio volume: + td #[input(type="range" id="stream-audio-volume-slider" class="slider")] + td(id="stream-audio-volume-value" class="value" style="min-width: 30px; max-width:30px") hr div(class="buttons buttons-row") button(data-force-hide-menu data-show-window="stream-window" class="row33") • Show stream diff --git a/web/share/js/kvm/stream.js b/web/share/js/kvm/stream.js index 4d432fb4..e2e03715 100644 --- a/web/share/js/kvm/stream.js +++ b/web/share/js/kvm/stream.js @@ -124,6 +124,7 @@ function _JanusStreamer(__setActive, __setInactive, __setInfo) { __handle.webrtcStuff.remoteStream = null; } $("stream-video").srcObject = null; + __setAudioEnabled(false); if (__janus !== null) { __janus.destroy(); } @@ -214,6 +215,7 @@ function _JanusStreamer(__setActive, __setInactive, __setInfo) { onremotestream: function(stream) { __logInfo("Got a remote stream:", stream); + __setAudioEnabled(!!stream.getAudioTracks()); _Janus.attachMediaStream($("stream-video"), stream); __startInfoInterval(); }, @@ -225,6 +227,10 @@ function _JanusStreamer(__setActive, __setInactive, __setInfo) { }); }; + var __setAudioEnabled = function(enabled) { + tools.feature.setEnabled($("stream-audio"), enabled); + }; + var __startInfoInterval = function() { __stopInfoInterval(); __setActive(); @@ -447,6 +453,12 @@ export function Streamer() { tools.radio.setOnClick("stream-mode-radio", __clickModeRadio, false); + tools.slider.setParams($("stream-audio-volume-slider"), 0, 100, 1, 0, function(value) { + $("stream-video").muted = !value; + $("stream-video").volume = value / 100; + $("stream-audio-volume-value").innerHTML = value + "%"; + }); + tools.el.setOnClick($("stream-screenshot-button"), __clickScreenshotButton); tools.el.setOnClick($("stream-reset-button"), __clickResetButton); |