mirror of
https://github.com/jech/galene.git
synced 2024-11-22 16:45:58 +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>
|
<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() {
|
||||||
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() {
|
||||||
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) {
|
||||||
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) {
|
||||||
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) {
|
||||||
* @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');
|
let template =
|
||||||
return;
|
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 =
|
if(!document.getElementById('topcontrols-' + c.localId)) {
|
||||||
document.getElementById('videocontrols-template').firstElementChild;
|
let toptemplate =
|
||||||
let toptemplate =
|
document.getElementById('topvideocontrols-template').firstElementChild;
|
||||||
document.getElementById('topvideocontrols-template').firstElementChild;
|
let topcontrols = cloneHTMLElement(toptemplate);
|
||||||
controls = cloneHTMLElement(template);
|
topcontrols.id = 'topcontrols-' + c.localId;
|
||||||
controls.id = 'controls-' + c.localId;
|
container.appendChild(topcontrols);
|
||||||
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(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);
|
registerControlHandlers(media, container, c);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue