mirror of
https://github.com/jech/galene.git
synced 2024-11-26 02:25:58 +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},
|
'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});
|
items.push({label: 'Restart media', onClick: renegotiateStreams});
|
||||||
} else {
|
} else {
|
||||||
items.push({label: 'Send file', onClick: () => {
|
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() {
|
function presentFile() {
|
||||||
let input = document.createElement('input');
|
let input = document.createElement('input');
|
||||||
input.type = 'file';
|
input.type = 'file';
|
||||||
|
@ -3428,16 +3440,13 @@ commands.presentfile = {
|
||||||
presentFile();
|
presentFile();
|
||||||
},
|
},
|
||||||
predicate: () => {
|
predicate: () => {
|
||||||
|
if(!canFile())
|
||||||
|
return 'Your browser does not support presenting arbitrary files';
|
||||||
if(!serverConnection || !serverConnection.permissions ||
|
if(!serverConnection || !serverConnection.permissions ||
|
||||||
serverConnection.permissions.indexOf('present') < 0)
|
serverConnection.permissions.indexOf('present') < 0)
|
||||||
return 'You are not authorised to present';
|
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 null;
|
return null;
|
||||||
},
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue