Commit 29fb5dfc authored by Alain Takoudjou's avatar Alain Takoudjou

Allow to stop a shared screen

Add a control button in a shared video which allow to stop only this shared video.
parent 6b53fb57
......@@ -208,6 +208,9 @@
<div id="videocontrols-template" class="invisible">
<div class="video-controls vc-overlay">
<span class="stopsharing invisible" title="Stop Sharing">
<i class="fas fa-stop" data-type="bt-fullscreen" aria-hidden="true"></i>
</span>
<span class="volume" title="Volume">
<i class="fas fa-volume-up" data-type="bt-volume" aria-hidden="true"></i>
</span>
......
......@@ -1074,8 +1074,14 @@ function setMedia(c, isUp, video) {
volume.classList.add("fa-volume-off");
}
}
if (local_media && local_media.kind === "local")
volume.parentElement.remove();
if(local_media)
if(local_media.kind === "local")
volume.parentElement.remove();
else if (local_media.kind === "screenshare") {
let stop = controls.querySelector(".stopsharing");
stop.classList.remove('invisible');
volume.parentElement.remove();
}
}
media.srcObject = c.stream;
......@@ -1171,6 +1177,24 @@ function registerControlEvent(peerid) {
}
};
}
let stop = /** @type {HTMLElement} */(peer.querySelector(".stopsharing"));
if (stop) {
stop.onclick = function(event) {
event.preventDefault();
let video = getParentVideo(event.target);
let video_id = video.id.split("-")[1];
for(let id in serverConnection.up) {
if (video_id === id) {
let c = serverConnection.up[id];
c.close(true);
delMedia(id);
delete(serverConnection.up[id]);
setButtonsVisibility();
}
}
};
}
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment