summaryrefslogtreecommitdiff
path: root/web/share/js/kvm/stream_janus.js
diff options
context:
space:
mode:
authorMaxim Devaev <[email protected]>2022-11-29 15:13:48 +0300
committerMaxim Devaev <[email protected]>2022-11-29 15:13:48 +0300
commit0e9b87ad6101582bd5f7542e60535ee602e11dd6 (patch)
treedc18b2be6a290be626463f8de0ec70d5cca9bad6 /web/share/js/kvm/stream_janus.js
parenta68eb4ed2d34682a696f5145868cc744cef9a949 (diff)
web: optional audio transmitting
Diffstat (limited to 'web/share/js/kvm/stream_janus.js')
-rw-r--r--web/share/js/kvm/stream_janus.js17
1 files changed, 7 insertions, 10 deletions
diff --git a/web/share/js/kvm/stream_janus.js b/web/share/js/kvm/stream_janus.js
index ad5b5b54..c79d54e2 100644
--- a/web/share/js/kvm/stream_janus.js
+++ b/web/share/js/kvm/stream_janus.js
@@ -29,7 +29,7 @@ import {tools, $} from "../tools.js";
var _Janus = null;
-export function JanusStreamer(__setActive, __setInactive, __setInfo) {
+export function JanusStreamer(__setActive, __setInactive, __setInfo, __allow_audio) {
var self = this;
var __stop = false;
@@ -45,7 +45,9 @@ export function JanusStreamer(__setActive, __setInactive, __setInfo) {
var __state = null;
var __frames = 0;
- self.getName = () => "H.264";
+ self.isAudioAllowed = () => __allow_audio;
+
+ self.getName = () => (__allow_audio ? "H.264 + Audio" : "H.264");
self.getMode = () => "janus";
self.getResolution = function() {
@@ -124,7 +126,6 @@ export function JanusStreamer(__setActive, __setInactive, __setInfo) {
__handle.webrtcStuff.remoteStream = null;
}
$("stream-video").srcObject = null;
- __setAudioEnabled(false);
if (__janus !== null) {
__janus.destroy();
}
@@ -179,7 +180,7 @@ export function JanusStreamer(__setActive, __setInactive, __setInfo) {
__setInactive();
__setInfo(false, false, "");
} else if (msg.result.status === "features") {
- __setAudioEnabled(msg.result.features.audio);
+ tools.feature.setEnabled($("stream-audio"), msg.result.features.audio);
}
} else if (msg.error_code || msg.error) {
__logError("Got uStreamer error message:", msg.error_code, "-", msg.error);
@@ -241,10 +242,6 @@ export function JanusStreamer(__setActive, __setInactive, __setInfo) {
});
};
- var __setAudioEnabled = function(enabled) {
- tools.feature.setEnabled($("stream-audio"), enabled);
- };
-
var __startInfoInterval = function() {
__stopInfoInterval();
__setActive();
@@ -292,9 +289,9 @@ export function JanusStreamer(__setActive, __setInactive, __setInfo) {
var __sendWatch = function() {
if (__handle) {
- __logInfo("Sending WATCH + FEATURES ...");
+ __logInfo(`Sending WATCH(audio=${__allow_audio}) + FEATURES ...`);
__handle.send({"message": {"request": "features"}});
- __handle.send({"message": {"request": "watch", "params": {"audio": true}}});
+ __handle.send({"message": {"request": "watch", "params": {"audio": __allow_audio}}});
}
};