1
Fork 0
mirror of https://github.com/jech/galene.git synced 2024-11-14 04:35:57 +01:00

Fix changing filter for a running stream.

This commit is contained in:
Juliusz Chroboczek 2021-05-09 18:59:46 +02:00
parent 627061f0de
commit be4ae56c14

View file

@ -512,8 +512,15 @@ getSelectElement('filterselect').onchange = async function(e) {
if(!(this instanceof HTMLSelectElement)) if(!(this instanceof HTMLSelectElement))
throw new Error('Unexpected type for this'); throw new Error('Unexpected type for this');
updateSettings({filter: this.value}); updateSettings({filter: this.value});
// no need to reopen the camera let c = findUpMedia('camera');
replaceUpStreams('camera'); if(c) {
let filter = (this.value && filters[this.value]) || null;
if(filter)
c.userdata.filterDefinition = filter;
else
delete c.userdata.filterDefinition;
replaceUpStream(c);
}
}; };
/** @returns {number} */ /** @returns {number} */
@ -1235,9 +1242,9 @@ async function replaceUpStream(c) {
let media = /** @type{HTMLVideoElement} */ let media = /** @type{HTMLVideoElement} */
(document.getElementById('media-' + c.localId)); (document.getElementById('media-' + c.localId));
setUpStream(cn, c.stream); setUpStream(cn, c.stream);
await setMedia(c, true, await setMedia(cn, true,
c.label == 'camera' && getSettings().mirrorView, cn.label == 'camera' && getSettings().mirrorView,
c.label == 'video' && media); cn.label == 'video' && media);
return cn; return cn;
} }