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

Remove support for disabling camera in media player.

This commit is contained in:
Alain Takoudjou 2020-11-27 11:13:48 +01:00 committed by Juliusz Chroboczek
parent 484781e3c1
commit 907a712d6a
2 changed files with 3 additions and 40 deletions

View file

@ -211,9 +211,6 @@
<span class="volume" title="Volume"> <span class="volume" title="Volume">
<i class="fas fa-volume-up" data-type="bt-volume" aria-hidden="true"></i> <i class="fas fa-volume-up" data-type="bt-volume" aria-hidden="true"></i>
</span> </span>
<span class="camera" title="Camera">
<i class="fas fa-video" data-type="bt-camera" aria-hidden="true"></i>
</span>
<span class="pip" title="Picture In Picture"> <span class="pip" title="Picture In Picture">
<i class="fas fa-clone" data-type="bt-pip" aria-hidden="true"></i> <i class="fas fa-clone" data-type="bt-pip" aria-hidden="true"></i>
</span> </span>

View file

@ -768,19 +768,15 @@ async function setMaxVideoThroughput(c, bps) {
/** /**
* @param {string} [id] * @param {string} [id]
* @param {boolean} [disableVideo]
*/ */
async function addLocalMedia(id, disableVideo) { async function addLocalMedia(id) {
if(!getUserPass()) if(!getUserPass())
return; return;
let settings = getSettings(); let settings = getSettings();
let audio = settings.audio ? {deviceId: settings.audio} : false; let audio = settings.audio ? {deviceId: settings.audio} : false;
let video = let video = settings.video ? {deviceId: settings.video} : false;
disableVideo ? false :
settings.video ? {deviceId: settings.video} :
false;
if(video) { if(video) {
if(settings.blackboardMode) { if(settings.blackboardMode) {
@ -1012,7 +1008,6 @@ function muteLocalTracks(mute) {
*/ */
function setMedia(c, isUp, video) { function setMedia(c, isUp, video) {
let peersdiv = document.getElementById('peers'); let peersdiv = document.getElementById('peers');
let settings = getSettings();
let local_media; let local_media;
for(let id in serverConnection.up) { for(let id in serverConnection.up) {
@ -1080,15 +1075,8 @@ function setMedia(c, isUp, video) {
volume.classList.add("fa-volume-off"); volume.classList.add("fa-volume-off");
} }
} }
let camera = controls.querySelector("span.camera"); if (local_media && local_media.kind === "local")
if (local_media && local_media.kind === "local") {
if (!settings.video) {
if (camera)
camera.classList.add("camera-off");
}
volume.parentElement.remove(); volume.parentElement.remove();
} else
camera.remove();
} }
media.srcObject = c.stream; media.srcObject = c.stream;
@ -1134,7 +1122,6 @@ function getParentVideo(target) {
* @param {string} peerid * @param {string} peerid
*/ */
function registerControlEvent(peerid) { function registerControlEvent(peerid) {
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
let volume = /** @type {HTMLElement} */(peer.querySelector("span.volume")); let volume = /** @type {HTMLElement} */(peer.querySelector("span.volume"));
@ -1184,27 +1171,6 @@ function registerControlEvent(peerid) {
} }
}; };
} }
let camera = /** @type {HTMLElement} */(peer.querySelector("span.camera"));
if(camera) {
camera.onclick = function(event) {
event.preventDefault();
let camera = /** @type {HTMLElement} */(event.target);
let video = getParentVideo(camera);
let id = video.id.split("-")[1];
if(!settings.video)
return;
if(camera.getAttribute("data-type") === "bt-camera") {
addLocalMedia(id, true);
camera.setAttribute("data-type", "bt-camera-off");
camera.parentElement.classList.add("disabled");
} else {
camera.setAttribute("data-type", "bt-camera");
camera.parentElement.classList.remove("disabled");
addLocalMedia(id);
}
};
}
} }