mirror of
https://github.com/jech/galene.git
synced 2024-12-22 15:25:48 +01:00
Use stop video button on all streamed videos.
Delete the stop video button, it is now redundant. Panic remains.
This commit is contained in:
parent
a20741408c
commit
ce0571cb7a
2 changed files with 26 additions and 46 deletions
|
@ -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 controls = cloneHTMLElement(template);
|
||||
controls.id = 'controls-' + c.localId;
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
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 volume = getVideoButton(controls, 'volume');
|
||||
let stopsharing = getVideoButton(topcontrols, 'video-stop');
|
||||
if (c.label !== "screenshare") {
|
||||
stopsharing.remove();
|
||||
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);
|
||||
}
|
||||
if(c.label === 'camera') {
|
||||
volume.remove();
|
||||
} else {
|
||||
setVolumeButton(media.muted,
|
||||
getVideoButton(controls, "volume-mute"),
|
||||
getVideoButton(controls, "volume-slider"));
|
||||
}
|
||||
|
||||
container.appendChild(topcontrols);
|
||||
container.appendChild(controls);
|
||||
registerControlHandlers(media, container, c);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue