Can toggle camera visibility

This commit is contained in:
Pierre HUBERT 2020-04-13 10:25:39 +02:00
parent 4095ae5653
commit 2429ea2ad8

View File

@ -109,6 +109,15 @@ class CallWindow extends CustomEvents {
// Display the list of buttons // Display the list of buttons
const buttonsList = [ const buttonsList = [
// Toggle current user camera
{
icon: "fa-eye",
selected: true,
onclick: (btn) => {
setButtonSelected(btn, this.toggleMainStreamVisibility())
}
},
// Audio button // Audio button
{ {
icon: "fa-microphone", icon: "fa-microphone",
@ -475,6 +484,30 @@ class CallWindow extends CustomEvents {
this.refreshButtonsState() this.refreshButtonsState()
} }
/**
* Toggle current peer stream visibility
*
* @return {boolean} New state
*/
toggleMainStreamVisibility() {
const el = this.videoEls.get(userID())
if(!el || el.nodeName !== "VIDEO")
return true;
// Show again element
if(el.parentNode.style.display == "none") {
el.parentNode.style.display = ""
return true
}
// Hide element
else {
el.parentNode.style.display = "none"
return false
}
}
/** /**
* Add audio / video stream to the user * Add audio / video stream to the user
* *