1
Fork 0
mirror of https://github.com/jech/galene.git synced 2024-11-10 02:35:58 +01:00

Implement studio and blackboard mode.

This commit is contained in:
Juliusz Chroboczek 2020-09-18 19:14:10 +02:00
parent b8011371cf
commit 8a4b2f5d3f
2 changed files with 52 additions and 3 deletions

View file

@ -154,6 +154,14 @@
<option value="">off</option> <option value="">off</option>
</select> </select>
<form>
<input id="blackboardbox" type="checkbox">Blackboard mode</input>
</form>
<form>
<input id="studiobox" type="checkbox">Studio mode</input>
</form>
</div> </div>
<label for="sendselect">Send:</label> <label for="sendselect">Send:</label>

View file

@ -78,6 +78,8 @@ function getUsername() {
* @property {string} [send] * @property {string} [send]
* @property {string} [request] * @property {string} [request]
* @property {boolean} [activityDetection] * @property {boolean} [activityDetection]
* @property {boolean} [blackboardMode]
* @property {boolean} [studioMode]
*/ */
/** @type{settings} */ /** @type{settings} */
@ -163,6 +165,10 @@ function reflectSettings() {
document.getElementById('activitybox').checked = settings.activityDetection; document.getElementById('activitybox').checked = settings.activityDetection;
document.getElementById('blackboardbox').checked = settings.blackboardMode;
document.getElementById('studiobox').checked = settings.studioMode;
if(store) if(store)
storeSettings(settings); storeSettings(settings);
@ -359,6 +365,18 @@ document.getElementById('audioselect').onchange = function(e) {
changePresentation(); changePresentation();
}; };
document.getElementById('blackboardbox').onchange = function(e) {
e.preventDefault();
updateSettings({blackboardMode: this.checked});
changePresentation();
}
document.getElementById('studiobox').onchange = function(e) {
e.preventDefault();
updateSettings({studioMode: this.checked});
changePresentation();
}
document.getElementById('mutebutton').onclick = function(e) { document.getElementById('mutebutton').onclick = function(e) {
e.preventDefault(); e.preventDefault();
let localMute = getSettings().localMute; let localMute = getSettings().localMute;
@ -646,6 +664,23 @@ async function addLocalMedia(id) {
let audio = settings.audio ? {deviceId: settings.audio} : false; let audio = settings.audio ? {deviceId: settings.audio} : false;
let video = settings.video ? {deviceId: settings.video} : false; let video = settings.video ? {deviceId: settings.video} : false;
if(audio) {
if(settings.studioMode) {
audio.echoCancellation = false;
audio.noiseSuppression = false;
audio.channelCount = 2;
audio.latency = 0.01;
audio.autoGainControl = false;
}
}
if(video) {
if(settings.blackboardMode) {
video.width = { min: 640, ideal: 1920 };
video.height = { min: 400, ideal: 1080 };
}
}
let old = id && serverConnection.up[id]; let old = id && serverConnection.up[id];
if(!audio && !video) { if(!audio && !video) {
@ -662,7 +697,6 @@ async function addLocalMedia(id) {
try { try {
stream = await navigator.mediaDevices.getUserMedia(constraints); stream = await navigator.mediaDevices.getUserMedia(constraints);
} catch(e) { } catch(e) {
console.error(e);
displayError(e); displayError(e);
if(old) if(old)
delUpMedia(old); delUpMedia(old);
@ -678,8 +712,15 @@ async function addLocalMedia(id) {
let mute = getSettings().localMute; let mute = getSettings().localMute;
stream.getTracks().forEach(t => { stream.getTracks().forEach(t => {
c.labels[t.id] = t.kind c.labels[t.id] = t.kind
if(t.kind == 'audio' && mute) if(t.kind == 'audio') {
if(mute)
t.enabled = false; t.enabled = false;
} else if(t.kind == 'video') {
if(settings.blackboardMode) {
if('contentHint' in t)
t.contentHint = 'detail';
}
}
let sender = c.pc.addTrack(t, stream); let sender = c.pc.addTrack(t, stream);
}); });