mirror of
https://github.com/jech/galene.git
synced 2024-12-22 23:35:46 +01:00
Implement stopping of videos.
This commit is contained in:
parent
2c9ee2f431
commit
58ba37d8da
2 changed files with 22 additions and 0 deletions
|
@ -65,6 +65,12 @@
|
|||
<label>Unshare 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 invisible" id="user">
|
||||
<span><i class="fas fa-user dropbtn" aria-hidden="true"></i></span>
|
||||
|
|
|
@ -393,6 +393,7 @@ function setButtonsVisibility() {
|
|||
let permissions = serverConnection.permissions;
|
||||
let local = !!findUpMedia('local');
|
||||
let share = !!findUpMedia('screenshare');
|
||||
let video = !!findUpMedia('video');
|
||||
|
||||
// don't allow multiple presentations
|
||||
setVisibility('presentbutton', permissions.present && !local);
|
||||
|
@ -403,6 +404,8 @@ function setButtonsVisibility() {
|
|||
('getDisplayMedia' in navigator.mediaDevices));
|
||||
setVisibility('unsharebutton', share);
|
||||
|
||||
setVisibility('stopvideobutton', video);
|
||||
|
||||
setVisibility('mediaoptions', permissions.present);
|
||||
}
|
||||
|
||||
|
@ -467,6 +470,12 @@ document.getElementById('unsharebutton').onclick = function(e) {
|
|||
resizePeers();
|
||||
}
|
||||
|
||||
document.getElementById('stopvideobutton').onclick = function(e) {
|
||||
e.preventDefault();
|
||||
delUpMediaKind('video');
|
||||
resizePeers();
|
||||
}
|
||||
|
||||
/** @returns {number} */
|
||||
function getMaxVideoThroughput() {
|
||||
let v = getSettings().send;
|
||||
|
@ -528,6 +537,7 @@ getInputElement('fileinput').onchange = function(e) {
|
|||
let files = input.files;
|
||||
for(let i = 0; i < files.length; i++)
|
||||
addFileMedia(files[i]);
|
||||
input.value = '';
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -900,6 +910,7 @@ async function addFileMedia(file) {
|
|||
};
|
||||
setMedia(c, true, video);
|
||||
video.play();
|
||||
setButtonsVisibility()
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1190,6 +1201,11 @@ function delMedia(id) {
|
|||
let media = /** @type{HTMLVideoElement} */
|
||||
(document.getElementById('media-' + id));
|
||||
|
||||
if(media.src) {
|
||||
URL.revokeObjectURL(media.src);
|
||||
media.src = null;
|
||||
}
|
||||
|
||||
media.srcObject = null;
|
||||
mediadiv.removeChild(peer);
|
||||
|
||||
|
|
Loading…
Reference in a new issue