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

do not listen on camera control button when it's not present

This commit is contained in:
Alain Takoudjou 2020-11-06 10:03:33 +01:00
parent 581d2439ab
commit 7cb73a501f

View file

@ -1092,22 +1092,25 @@ function registerControlEvent(peerid) {
}
};
peer.querySelector("span.camera").onclick = function(event) {
event.preventDefault();
let video = getParentVideo(event.target);
let id = video.id.split("-")[1];
if (!settings.video)
return;
if (event.target.getAttribute("data-type") === "bt-camera") {
addLocalMedia(id, true);
event.target.setAttribute("data-type", "bt-camera-off");
event.target.parentElement.classList.add("disabled");
} else {
event.target.setAttribute("data-type", "bt-camera");
event.target.parentElement.classList.remove("disabled");
addLocalMedia(id);
}
};
let camera = peer.querySelector("span.camera");
if (camera) {
peer.querySelector("span.camera").onclick = function(event) {
event.preventDefault();
let video = getParentVideo(event.target);
let id = video.id.split("-")[1];
if (!settings.video)
return;
if (event.target.getAttribute("data-type") === "bt-camera") {
addLocalMedia(id, true);
event.target.setAttribute("data-type", "bt-camera-off");
event.target.parentElement.classList.add("disabled");
} else {
event.target.setAttribute("data-type", "bt-camera");
event.target.parentElement.classList.remove("disabled");
addLocalMedia(id);
}
};
}
}