Commit e8df60cb authored by Juliusz Chroboczek's avatar Juliusz Chroboczek

Move automatic presentation into gotPermissions.

Don't attempt to present if we don't have the present permission,
don't display the friendly popup if we've selected presentation.
parent 71744c44
...@@ -519,7 +519,7 @@ textarea.form-reply { ...@@ -519,7 +519,7 @@ textarea.form-reply {
position: absolute; position: absolute;
top: 15%; top: 15%;
left: 25%; left: 25%;
width: 30em; width: 35em;
padding: 2em; padding: 2em;
} }
......
...@@ -120,9 +120,9 @@ ...@@ -120,9 +120,9 @@
<input id="presentoff" type="radio" name="presentradio" value="" checked/> <input id="presentoff" type="radio" name="presentradio" value="" checked/>
<label for="presentoff">nothing</label> <label for="presentoff">nothing</label>
<input id="presentmike" type="radio" name="presentradio" value="mike"/> <input id="presentmike" type="radio" name="presentradio" value="mike"/>
<label for="presentmike">mike only</label> <label for="presentmike">microphone</label>
<input id="presentboth" type="radio" name="presentradio" value="both"/> <input id="presentboth" type="radio" name="presentradio" value="both"/>
<label for="presentoff">camera and mike</label> <label for="presentoff">camera and microphone</label>
<div class="clear"></div> <div class="clear"></div>
<input id="connectbutton" type="submit" class="btn btn-blue" value="Connect"/> <input id="connectbutton" type="submit" class="btn btn-blue" value="Connect"/>
</form> </form>
......
...@@ -1404,14 +1404,40 @@ function displayUsername() { ...@@ -1404,14 +1404,40 @@ function displayUsername() {
document.getElementById('permspan').textContent = text; document.getElementById('permspan').textContent = text;
} }
let presentRequested = null;
/** /**
* @param {Object<string,boolean>} perms * @param {Object<string,boolean>} perms
*/ */
function gotPermissions(perms) { async function gotPermissions(perms) {
displayUsername(); displayUsername();
setButtonsVisibility(); 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; const urlRegexp = /https?:\/\/[-a-zA-Z0-9@:%/._\\+~#&()=?]+[-a-zA-Z0-9@:%/_\\+~#&()=]/g;
...@@ -2036,26 +2062,12 @@ document.getElementById('userform').onsubmit = async function(e) { ...@@ -2036,26 +2062,12 @@ document.getElementById('userform').onsubmit = async function(e) {
connecting = false; connecting = false;
} }
let presentboth = getInputElement('presentboth').checked; if(getInputElement('presentboth').checked)
let presentmike = getInputElement('presentmike').checked; presentRequested = 'both';
else if(getInputElement('presentmike').checked)
if(presentmike) presentRequested = 'mike';
updateSettings({video: ''}); else
else if(presentboth) presentRequested = null;
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;
}
}
getInputElement('presentoff').checked = true; getInputElement('presentoff').checked = true;
}; };
......
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