diff --git a/static/sfu.css b/static/sfu.css index e277ed5..0295ce6 100644 --- a/static/sfu.css +++ b/static/sfu.css @@ -519,7 +519,7 @@ textarea.form-reply { position: absolute; top: 15%; left: 25%; - width: 30em; + width: 35em; padding: 2em; } diff --git a/static/sfu.html b/static/sfu.html index 80b1d59..9031fde 100644 --- a/static/sfu.html +++ b/static/sfu.html @@ -120,9 +120,9 @@ - + - +
diff --git a/static/sfu.js b/static/sfu.js index 39d5940..a6ab55c 100644 --- a/static/sfu.js +++ b/static/sfu.js @@ -1404,14 +1404,40 @@ function displayUsername() { document.getElementById('permspan').textContent = text; } +let presentRequested = null; + /** * @param {Object} perms */ -function gotPermissions(perms) { +async function gotPermissions(perms) { displayUsername(); setButtonsVisibility(); - if(serverConnection.permissions.present) - displayMessage("Press Present to enable your camera or microphone"); + + try { + if(serverConnection.permissions.present && !findUpMedia('local')) { + if(presentRequested) { + if(presentRequested === 'mike') + updateSettings({video: ''}); + else if(presentRequested === 'both') + delSetting('video'); + reflectSettings(); + + let button = getButtonElement('presentbutton'); + button.disabled = true; + try { + await addLocalMedia(); + } finally { + button.disabled = false; + } + } else { + displayMessage( + "Press Present to enable your camera or microphone" + ); + } + } + } finally { + presentRequested = null; + } } const urlRegexp = /https?:\/\/[-a-zA-Z0-9@:%/._\\+~#&()=?]+[-a-zA-Z0-9@:%/_\\+~#&()=]/g; @@ -2036,26 +2062,12 @@ document.getElementById('userform').onsubmit = async function(e) { connecting = false; } - let presentboth = getInputElement('presentboth').checked; - let presentmike = getInputElement('presentmike').checked; - - if(presentmike) - updateSettings({video: ''}); - else if(presentboth) - delSetting('video'); - reflectSettings(); - - if(presentboth || presentmike) { - let button = getButtonElement('presentbutton'); - button.disabled = true; - try { - let id = findUpMedia('local'); - if(!id) - await addLocalMedia(); - } finally { - button.disabled = false; - } - } + if(getInputElement('presentboth').checked) + presentRequested = 'both'; + else if(getInputElement('presentmike').checked) + presentRequested = 'mike'; + else + presentRequested = null; getInputElement('presentoff').checked = true; };