mirror of
https://github.com/jech/galene.git
synced 2024-12-22 15:25:48 +01:00
Add presenting files to context menu.
This commit is contained in:
parent
296fe622df
commit
96a46c695a
1 changed files with 16 additions and 7 deletions
|
@ -2037,6 +2037,8 @@ function userMenu(elt) {
|
|||
'setdata', serverConnection.id, {'raisehand': true},
|
||||
);
|
||||
}});
|
||||
if(serverConnection.permissions.indexOf('present')>= 0 && canFile())
|
||||
items.push({label: 'Broadcast file', onClick: presentFile});
|
||||
items.push({label: 'Restart media', onClick: renegotiateStreams});
|
||||
} else {
|
||||
items.push({label: 'Send file', onClick: () => {
|
||||
|
@ -3404,6 +3406,16 @@ commands.unraise = {
|
|||
}
|
||||
}
|
||||
|
||||
/** @returns {boolean} */
|
||||
function canFile() {
|
||||
let v =
|
||||
/** @ts-ignore */
|
||||
!!HTMLVideoElement.prototype.captureStream ||
|
||||
/** @ts-ignore */
|
||||
!!HTMLVideoElement.prototype.mozCaptureStream;
|
||||
return v;
|
||||
}
|
||||
|
||||
function presentFile() {
|
||||
let input = document.createElement('input');
|
||||
input.type = 'file';
|
||||
|
@ -3428,16 +3440,13 @@ commands.presentfile = {
|
|||
presentFile();
|
||||
},
|
||||
predicate: () => {
|
||||
if(!canFile())
|
||||
return 'Your browser does not support presenting arbitrary files';
|
||||
if(!serverConnection || !serverConnection.permissions ||
|
||||
serverConnection.permissions.indexOf('present') < 0)
|
||||
return 'You are not authorised to present';
|
||||
/** @ts-ignore */
|
||||
if(!HTMLVideoElement.prototype.captureStream &&
|
||||
/** @ts-ignore */
|
||||
!HTMLVideoElement.prototype.mozCaptureStream)
|
||||
return 'Your browser does not support presenting arbitrary files';
|
||||
return 'You are not authorised to present.';
|
||||
return null;
|
||||
},
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue