Commit 8a4b2f5d authored by Juliusz Chroboczek's avatar Juliusz Chroboczek

Implement studio and blackboard mode.

parent b8011371
...@@ -154,6 +154,14 @@ ...@@ -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>
......
...@@ -78,6 +78,8 @@ function getUsername() { ...@@ -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() { ...@@ -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) { ...@@ -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) { ...@@ -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) { ...@@ -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) { ...@@ -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') {
t.enabled = false; if(mute)
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);
}); });
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment