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