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

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