webrtc audio draft

This commit is contained in:
Maxim Devaev 2022-06-01 09:32:45 +03:00
parent fd256852bf
commit 08b7c577d7
4 changed files with 24 additions and 0 deletions

View File

@ -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

View File

@ -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">

View File

@ -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") &bull; Show stream

View File

@ -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);