Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
galene
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
galene
Commits
cbcfbb3f
Commit
cbcfbb3f
authored
Feb 21, 2022
by
Juliusz Chroboczek
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make presenting files a chat command.
parent
5ecb3a1f
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
38 additions
and
27 deletions
+38
-27
static/galene.html
static/galene.html
+0
-5
static/galene.js
static/galene.js
+38
-22
No files found.
static/galene.html
View file @
cbcfbb3f
...
...
@@ -233,11 +233,6 @@
</form>
</fieldset>
<form
id=
"fileform"
>
<label
for=
"fileinput"
class=
".sidenav-label-first"
>
Play local file:
</label>
<input
type=
"file"
id=
"fileinput"
accept=
"audio/*,video/*"
multiple
/>
</form>
</div>
</div>
...
...
static/galene.js
View file @
cbcfbb3f
...
...
@@ -405,11 +405,6 @@ function setButtonsVisibility() {
let
present
=
permissions
.
indexOf
(
'
present
'
)
>=
0
;
let
local
=
!!
findUpMedia
(
'
camera
'
);
let
canWebrtc
=
!
(
typeof
RTCPeerConnection
===
'
undefined
'
);
let
canFile
=
/** @ts-ignore */
!!
HTMLVideoElement
.
prototype
.
captureStream
||
/** @ts-ignore */
!!
HTMLVideoElement
.
prototype
.
mozCaptureStream
;
let
mediacount
=
document
.
getElementById
(
'
peers
'
).
childElementCount
;
let
mobilelayout
=
isMobileLayout
();
...
...
@@ -426,7 +421,6 @@ function setButtonsVisibility() {
setVisibility
(
'
mediaoptions
'
,
present
);
setVisibility
(
'
sendform
'
,
present
);
setVisibility
(
'
simulcastform
'
,
present
);
setVisibility
(
'
fileform
'
,
canFile
&&
present
);
setVisibility
(
'
collapse-video
'
,
mediacount
&&
mobilelayout
);
}
...
...
@@ -617,21 +611,6 @@ getInputElement('activitybox').onchange = function(e) {
}
};
getInputElement
(
'
fileinput
'
).
onchange
=
function
(
e
)
{
if
(
!
(
this
instanceof
HTMLInputElement
))
throw
new
Error
(
'
Unexpected type for this
'
);
let
input
=
this
;
let
files
=
input
.
files
;
for
(
let
i
=
0
;
i
<
files
.
length
;
i
++
)
{
addFileMedia
(
files
[
i
]).
catch
(
e
=>
{
console
.
error
(
e
);
displayError
(
e
);
});
}
input
.
value
=
''
;
closeNav
();
};
/**
* @this {Stream}
* @param {Object<string,any>} stats
...
...
@@ -3375,6 +3354,43 @@ commands.unraise = {
}
}
function
presentFile
()
{
let
input
=
document
.
createElement
(
'
input
'
);
input
.
type
=
'
file
'
;
input
.
accept
=
"
audio/*,video/*
"
;
input
.
onchange
=
function
(
e
)
{
if
(
!
(
this
instanceof
HTMLInputElement
))
throw
new
Error
(
'
Unexpected type for this
'
);
let
files
=
this
.
files
;
for
(
let
i
=
0
;
i
<
files
.
length
;
i
++
)
{
addFileMedia
(
files
[
i
]).
catch
(
e
=>
{
console
.
error
(
e
);
displayError
(
e
);
});
}
};
input
.
click
();
}
commands
.
presentfile
=
{
description
:
'
broadcast a video or audio file
'
,
f
:
(
c
,
r
)
=>
{
presentFile
();
},
predicate
:
()
=>
{
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
null
;
},
};
/**
* @param {string} id
*/
...
...
@@ -3384,7 +3400,7 @@ function sendFile(id) {
input
.
onchange
=
function
(
e
)
{
if
(
!
(
this
instanceof
HTMLInputElement
))
throw
new
Error
(
'
Unexpected type for this
'
);
let
files
=
input
.
files
;
let
files
=
this
.
files
;
for
(
let
i
=
0
;
i
<
files
.
length
;
i
++
)
{
try
{
offerFile
(
id
,
files
[
i
]);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment