1
Fork 0
mirror of https://github.com/jech/galene.git synced 2024-12-22 23:35:46 +01:00

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.
This commit is contained in:
Juliusz Chroboczek 2020-12-01 00:26:14 +01:00
parent 71744c44ca
commit e8df60cbbe
3 changed files with 38 additions and 26 deletions

View file

@ -519,7 +519,7 @@ textarea.form-reply {
position: absolute;
top: 15%;
left: 25%;
width: 30em;
width: 35em;
padding: 2em;
}

View file

@ -120,9 +120,9 @@
<input id="presentoff" type="radio" name="presentradio" value="" checked/>
<label for="presentoff">nothing</label>
<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"/>
<label for="presentoff">camera and mike</label>
<label for="presentoff">camera and microphone</label>
<div class="clear"></div>
<input id="connectbutton" type="submit" class="btn btn-blue" value="Connect"/>
</form>

View file

@ -1404,14 +1404,40 @@ function displayUsername() {
document.getElementById('permspan').textContent = text;
}
let presentRequested = null;
/**
* @param {Object<string,boolean>} 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;
};