diff --git a/static/galene.html b/static/galene.html index b1502db..9d5de01 100644 --- a/static/galene.html +++ b/static/galene.html @@ -183,6 +183,16 @@ +
+ + +
+ +
+ + +
+ diff --git a/static/galene.js b/static/galene.js index d061423..0f44fc2 100644 --- a/static/galene.js +++ b/static/galene.js @@ -45,6 +45,8 @@ let token = null; * @property {boolean} [mirrorView] * @property {boolean} [blackboardMode] * @property {string} [filter] + * @property {boolean} [preprocessing] + * @property {boolean} [hqaudio] */ /** @type{settings} */ @@ -216,6 +218,20 @@ function reflectSettings() { store = true; } + if(settings.hasOwnProperty('preprocessing')) { + getInputElement('preprocessingbox').checked = settings.preprocessing; + } else { + settings.preprocessing = getInputElement('preprocessingbox').checked; + store = true; + } + + if(settings.hasOwnProperty('hqaudio')) { + getInputElement('hqaudiobox').checked = settings.hqaudio; + } else { + settings.hqaudio = getInputElement('hqaudiobox').checked; + store = true; + } + if(store) storeSettings(settings); } @@ -479,6 +495,22 @@ getInputElement('blackboardbox').onchange = function(e) { replaceCameraStream(); }; +getInputElement('preprocessingbox').onchange = function(e) { + e.preventDefault(); + if(!(this instanceof HTMLInputElement)) + throw new Error('Unexpected type for this'); + updateSettings({preprocessing: this.checked}); + replaceCameraStream(); +}; + +getInputElement('hqaudiobox').onchange = function(e) { + e.preventDefault(); + if(!(this instanceof HTMLInputElement)) + throw new Error('Unexpected type for this'); + updateSettings({hqaudio: this.checked}); + replaceCameraStream(); +}; + document.getElementById('mutebutton').onclick = function(e) { e.preventDefault(); let localMute = getSettings().localMute; @@ -1075,6 +1107,7 @@ function isSafari() { const unlimitedRate = 1000000000; const simulcastRate = 100000; +const hqAudioRate = 128000; /** * Decide whether we want to send simulcast. @@ -1137,8 +1170,8 @@ function setUpStream(c, stream) { * @param {MediaStreamTrack} t */ function addUpTrack(t) { + let settings = getSettings(); if(c.label === 'camera') { - let settings = getSettings(); if(t.kind == 'audio') { if(settings.localMute) t.enabled = false; @@ -1169,9 +1202,9 @@ function setUpStream(c, stream) { maxBitrate: simulcastRate, }); } else { - if(c.label === 'video') { + if(c.label !== 'camera' || settings.hqaudio) { encodings.push({ - maxBitrate: 192000, + maxBitrate: hqAudioRate, }); } } @@ -1300,6 +1333,14 @@ async function addLocalMedia(localId) { } } + if(audio) { + if(!settings.preprocessing) { + audio.echoCancellation = false; + audio.noiseSuppression = false; + audio.autoGainControl = false; + } + } + let old = serverConnection.findByLocalId(localId); if(old) { // make sure that the camera is released before we try to reopen it