1
Fork 0
mirror of https://github.com/jech/galene.git synced 2024-11-10 02:35:58 +01:00

remove button control to mute/unmute my video

This commit is contained in:
Alain Takoudjou 2020-11-09 12:08:04 +01:00 committed by Juliusz Chroboczek
parent 0bc8129159
commit ff110ec9cd

View file

@ -1026,8 +1026,8 @@ function setMedia(c, isUp) {
controls = /** @type{HTMLElement} */(template.cloneNode(true)); controls = /** @type{HTMLElement} */(template.cloneNode(true));
controls.id = 'controls-' + c.id; controls.id = 'controls-' + c.id;
div.appendChild(controls); div.appendChild(controls);
let volume = controls.querySelector(".fa-volume-up");
if(media.muted) { if(media.muted) {
let volume = controls.querySelector(".fa-volume-up");
if (volume) { if (volume) {
volume.classList.remove("fa-volume-up"); volume.classList.remove("fa-volume-up");
volume.classList.add("fa-volume-off"); volume.classList.add("fa-volume-off");
@ -1039,6 +1039,7 @@ function setMedia(c, isUp) {
if (camera) if (camera)
camera.classList.add("camera-off"); camera.classList.add("camera-off");
} }
volume.parentElement.remove();
} else } else
camera.remove(); camera.remove();
} }
@ -1087,20 +1088,23 @@ function registerControlEvent(peerid) {
let settings = getSettings(); let settings = getSettings();
let peer = document.getElementById(peerid); let peer = document.getElementById(peerid);
//Add event listener when a video component is added to the DOM //Add event listener when a video component is added to the DOM
peer.querySelector("span.volume").onclick = function(event) { let volume = /** @type {HTMLElement} */(peer.querySelector("span.volume"));
event.preventDefault(); if (volume) {
let video = getParentVideo(event.target); volume.onclick = function(event) {
if(event.target.className.indexOf("fa-volume-off") !== -1) { event.preventDefault();
event.target.classList.remove("fa-volume-off"); let video = getParentVideo(event.target);
event.target.classList.add("fa-volume-up"); if(event.target.className.indexOf("fa-volume-off") !== -1) {
video.muted = false; event.target.classList.remove("fa-volume-off");
} else { event.target.classList.add("fa-volume-up");
event.target.classList.remove("fa-volume-up"); video.muted = false;
event.target.classList.add("fa-volume-off"); } else {
// mute video sound event.target.classList.remove("fa-volume-up");
video.muted = true; event.target.classList.add("fa-volume-off");
} // mute video sound
}; video.muted = true;
}
};
}
let pip = /** @type {HTMLElement} */(peer.querySelector("span.pip")); let pip = /** @type {HTMLElement} */(peer.querySelector("span.pip"));
/** @ts-ignore */ /** @ts-ignore */