summaryrefslogtreecommitdiff
path: root/web/share
diff options
context:
space:
mode:
Diffstat (limited to 'web/share')
-rw-r--r--web/share/js/kvm/stream.js13
-rw-r--r--web/share/js/kvm/stream_janus.js24
2 files changed, 31 insertions, 6 deletions
diff --git a/web/share/js/kvm/stream.js b/web/share/js/kvm/stream.js
index 7d947736..2de3d469 100644
--- a/web/share/js/kvm/stream.js
+++ b/web/share/js/kvm/stream.js
@@ -94,6 +94,15 @@ export function Streamer() {
__resetStream();
}
}
+ tools.el.setEnabled($("stream-mic-switch"), !!value);
+ });
+
+ tools.storage.bindSimpleSwitch($("stream-mic-switch"), "stream.mic", false, function(allow_mic) {
+ if (__streamer.getMode() === "janus") {
+ if (__streamer.isMicAllowed() !== allow_mic) {
+ __resetStream();
+ }
+ }
});
tools.el.setOnClick($("stream-screenshot-button"), __clickScreenshotButton);
@@ -206,6 +215,7 @@ export function Streamer() {
tools.feature.setEnabled($("stream-mode"), f.h264);
if (!f.h264) {
tools.feature.setEnabled($("stream-audio"), false);
+ tools.feature.setEnabled($("stream-mic"), false);
}
let mode = tools.storage.get("stream.mode", "janus");
@@ -291,7 +301,7 @@ export function Streamer() {
__streamer.stopStream();
if (mode === "janus") {
__streamer = new JanusStreamer(__setActive, __setInactive, __setInfo,
- tools.storage.getInt("stream.orient", 0), !$("stream-video").muted);
+ tools.storage.getInt("stream.orient", 0), !$("stream-video").muted, $("stream-mic-switch").checked);
// Firefox doesn't support RTP orientation:
// - https://bugzilla.mozilla.org/show_bug.cgi?id=1316448
tools.feature.setEnabled($("stream-orient"), !tools.browser.is_firefox);
@@ -303,6 +313,7 @@ export function Streamer() {
}
tools.feature.setEnabled($("stream-orient"), false);
tools.feature.setEnabled($("stream-audio"), false); // Enabling in stream_janus.js
+ tools.feature.setEnabled($("stream-mic"), false); // Ditto
}
if (wm.isWindowVisible($("stream-window"))) {
__streamer.ensureStream((__state && __state.streamer !== undefined) ? __state.streamer : null);
diff --git a/web/share/js/kvm/stream_janus.js b/web/share/js/kvm/stream_janus.js
index 09ee75da..449450b7 100644
--- a/web/share/js/kvm/stream_janus.js
+++ b/web/share/js/kvm/stream_janus.js
@@ -29,11 +29,13 @@ import {tools, $} from "../tools.js";
var _Janus = null;
-export function JanusStreamer(__setActive, __setInactive, __setInfo, __orient, __allow_audio) {
+export function JanusStreamer(__setActive, __setInactive, __setInfo, __orient, __allow_audio, __allow_mic) {
var self = this;
/************************************************************************/
+ __allow_mic = (__allow_audio && __allow_mic); // XXX: Mic only with audio
+
var __stop = false;
var __ensuring = false;
@@ -51,8 +53,18 @@ export function JanusStreamer(__setActive, __setInactive, __setInfo, __orient, _
self.getOrientation = () => __orient;
self.isAudioAllowed = () => __allow_audio;
-
- self.getName = () => (__allow_audio ? "WebRTC H.264 + Audio" : "WebRTC H.264");
+ self.isMicAllowed = () => __allow_mic;
+
+ self.getName = function() {
+ let name = "WebRTC H.264";
+ if (__allow_audio) {
+ name += " + Audio";
+ if (__allow_mic) {
+ name += " + Mic";
+ }
+ }
+ return name;
+ };
self.getMode = () => "janus";
self.getResolution = function() {
@@ -229,6 +241,7 @@ export function JanusStreamer(__setActive, __setInactive, __setInfo, __orient, _
__setInfo(false, false, "");
} else if (msg.result.status === "features") {
tools.feature.setEnabled($("stream-audio"), msg.result.features.audio);
+ tools.feature.setEnabled($("stream-mic"), msg.result.features.mic);
}
} else if (msg.error_code || msg.error) {
__logError("Got uStreamer error message:", msg.error_code, "-", msg.error);
@@ -251,7 +264,7 @@ export function JanusStreamer(__setActive, __setInactive, __setInfo, __orient, _
__logInfo("Handling SDP:", jsep);
let tracks = [{"type": "video", "capture": false, "recv": true, "add": true}];
if (__allow_audio) {
- tracks.push({"type": "audio", "capture": false, "recv": true, "add": true});
+ tracks.push({"type": "audio", "capture": __allow_mic, "recv": true, "add": true});
}
__handle.createAnswer({
"jsep": jsep,
@@ -354,11 +367,12 @@ export function JanusStreamer(__setActive, __setInactive, __setInfo, __orient, _
var __sendWatch = function() {
if (__handle) {
- __logInfo(`Sending WATCH(orient=${__orient}, audio=${__allow_audio}) + FEATURES ...`);
+ __logInfo(`Sending WATCH(orient=${__orient}, audio=${__allow_audio}, mic=${__allow_mic}) + FEATURES ...`);
__handle.send({"message": {"request": "features"}});
__handle.send({"message": {"request": "watch", "params": {
"orientation": __orient,
"audio": __allow_audio,
+ "mic": __allow_mic,
}}});
}
};