Commit ce0571cb authored by Juliusz Chroboczek's avatar Juliusz Chroboczek

Use stop video button on all streamed videos.

Delete the stop video button, it is now redundant.  Panic remains.
parent a2074140
...@@ -60,12 +60,6 @@ ...@@ -60,12 +60,6 @@
<label>Share Screen</label> <label>Share Screen</label>
</div> </div>
</li> </li>
<li>
<div id="stopvideobutton" class="invisible nav-link nav-button nav-cancel">
<span><i class="fas fa-window-close" aria-hidden="true"></i></span>
<label>Stop Video</label>
</div>
</li>
<li> <li>
<div class="nav-button nav-link nav-more" id="openside"> <div class="nav-button nav-link nav-more" id="openside">
<span><i class="fas fa-ellipsis-v" aria-hidden="true"></i></span> <span><i class="fas fa-ellipsis-v" aria-hidden="true"></i></span>
......
...@@ -414,7 +414,6 @@ function setButtonsVisibility() { ...@@ -414,7 +414,6 @@ function setButtonsVisibility() {
let connected = serverConnection && serverConnection.socket; let connected = serverConnection && serverConnection.socket;
let permissions = serverConnection.permissions; let permissions = serverConnection.permissions;
let local = !!findUpMedia('camera'); let local = !!findUpMedia('camera');
let video = !!findUpMedia('video');
let canWebrtc = !(typeof RTCPeerConnection === 'undefined'); let canWebrtc = !(typeof RTCPeerConnection === 'undefined');
let canFile = let canFile =
/** @ts-ignore */ /** @ts-ignore */
...@@ -434,8 +433,6 @@ function setButtonsVisibility() { ...@@ -434,8 +433,6 @@ function setButtonsVisibility() {
setVisibility('sharebutton', canWebrtc && permissions.present && setVisibility('sharebutton', canWebrtc && permissions.present &&
('getDisplayMedia' in navigator.mediaDevices)); ('getDisplayMedia' in navigator.mediaDevices));
setVisibility('stopvideobutton', video);
setVisibility('mediaoptions', permissions.present); setVisibility('mediaoptions', permissions.present);
setVisibility('sendform', permissions.present); setVisibility('sendform', permissions.present);
setVisibility('fileform', canFile && permissions.present); setVisibility('fileform', canFile && permissions.present);
...@@ -508,12 +505,6 @@ document.getElementById('sharebutton').onclick = function(e) { ...@@ -508,12 +505,6 @@ document.getElementById('sharebutton').onclick = function(e) {
addShareMedia(); addShareMedia();
}; };
document.getElementById('stopvideobutton').onclick = function(e) {
e.preventDefault();
closeUpMedia('video');
resizePeers();
};
getSelectElement('filterselect').onchange = async function(e) { getSelectElement('filterselect').onchange = async function(e) {
if(!(this instanceof HTMLSelectElement)) if(!(this instanceof HTMLSelectElement))
throw new Error('Unexpected type for this'); throw new Error('Unexpected type for this');
...@@ -1380,8 +1371,7 @@ async function setMedia(c, isUp, mirror, video) { ...@@ -1380,8 +1371,7 @@ async function setMedia(c, isUp, mirror, video) {
media.playsinline = true; media.playsinline = true;
media.id = 'media-' + c.localId; media.id = 'media-' + c.localId;
div.appendChild(media); div.appendChild(media);
if(!video) addCustomControls(media, div, c, !!video);
addCustomControls(media, div, c);
} }
if(mirror) if(mirror)
...@@ -1446,38 +1436,34 @@ function cloneHTMLElement(elt) { ...@@ -1446,38 +1436,34 @@ function cloneHTMLElement(elt) {
* @param {HTMLElement} container * @param {HTMLElement} container
* @param {Stream} c * @param {Stream} c
*/ */
function addCustomControls(media, container, c) { function addCustomControls(media, container, c, toponly) {
media.controls = false; if(!toponly && !document.getElementById('controls-' + c.localId)) {
let controls = document.getElementById('controls-' + c.localId); media.controls = false;
if(controls) {
console.warn('Attempted to add duplicate controls');
return;
}
let template = let template =
document.getElementById('videocontrols-template').firstElementChild; document.getElementById('videocontrols-template').firstElementChild;
let toptemplate = let controls = cloneHTMLElement(template);
document.getElementById('topvideocontrols-template').firstElementChild; controls.id = 'controls-' + c.localId;
controls = cloneHTMLElement(template);
controls.id = 'controls-' + c.localId;
let topcontrols = cloneHTMLElement(toptemplate);
topcontrols.id = 'topcontrols-' + c.localId;
let volume = getVideoButton(controls, 'volume'); let volume = getVideoButton(controls, 'volume');
let stopsharing = getVideoButton(topcontrols, 'video-stop');
if (c.label !== "screenshare") { if(c.label === 'camera') {
stopsharing.remove(); volume.remove();
} } else {
if(c.label === 'camera') { setVolumeButton(media.muted,
volume.remove(); getVideoButton(controls, "volume-mute"),
} else { getVideoButton(controls, "volume-slider"));
setVolumeButton(media.muted, }
getVideoButton(controls, "volume-mute"), container.appendChild(controls);
getVideoButton(controls, "volume-slider"));
} }
container.appendChild(topcontrols); if(!document.getElementById('topcontrols-' + c.localId)) {
container.appendChild(controls); let toptemplate =
document.getElementById('topvideocontrols-template').firstElementChild;
let topcontrols = cloneHTMLElement(toptemplate);
topcontrols.id = 'topcontrols-' + c.localId;
container.appendChild(topcontrols);
}
registerControlHandlers(media, container, c); registerControlHandlers(media, container, c);
} }
......
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