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
fa694e67
Commit
fa694e67
authored
Sep 28, 2020
by
Alain Takoudjou
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
improve html interface, add custom controls for video
parent
aae6b460
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
164 additions
and
25 deletions
+164
-25
static/sfu.css
static/sfu.css
+70
-24
static/sfu.html
static/sfu.html
+8
-0
static/sfu.js
static/sfu.js
+86
-1
No files found.
static/sfu.css
View file @
fa694e67
...
...
@@ -12,7 +12,7 @@
.topnav
{
padding-left
:
0
;
height
:
4
rem
;
height
:
3.5
rem
;
z-index
:
1039
;
}
...
...
@@ -61,7 +61,7 @@
}
.navbar
{
position
:
relative
;
padding
:
.
5
rem
;
padding
:
.
1
rem
;
}
.topnav
.navbar-brand
{
...
...
@@ -192,7 +192,7 @@
.full-width
{
width
:
calc
(
100vw
-
200px
);
height
:
calc
(
var
(
--vh
,
1vh
)
*
100
-
64
px
);
height
:
calc
(
var
(
--vh
,
1vh
)
*
100
-
56
px
);
}
.full-width-active
{
...
...
@@ -204,7 +204,7 @@
}
.users-header
{
height
:
4
rem
;
height
:
3.5
rem
;
padding
:
10px
;
background
:
#610a86
;
font-size
:
.95rem
;
...
...
@@ -221,7 +221,7 @@
}
.reply
{
height
:
60
px
;
height
:
53
px
;
width
:
100%
;
background-color
:
#eae7e5
;
padding
:
10px
5px
10px
5px
;
...
...
@@ -242,7 +242,7 @@
}
textarea
.form-reply
{
height
:
2.
6
em
;
height
:
2.
1
em
;
margin-right
:
.5em
;
}
...
...
@@ -290,7 +290,7 @@ textarea.form-reply {
word-wrap
:
break-word
;
display
:
inline-block
;
margin
:
1em
0
0
;
max-width
:
8
0%
;
max-width
:
9
0%
;
}
.message-sender
{
...
...
@@ -345,7 +345,7 @@ textarea.form-reply {
}
.video-container
{
height
:
calc
(
var
(
--vh
,
1vh
)
*
100
-
64
px
);
height
:
calc
(
var
(
--vh
,
1vh
)
*
100
-
56
px
);
position
:
relative
;
background
:
rgba
(
0
,
0
,
0
,
0.91
);
/* Display only when showing video */
...
...
@@ -376,12 +376,52 @@ textarea.form-reply {
opacity
:
0
;
}
.video-controls
{
position
:
absolute
;
width
:
100%
;
left
:
0
;
bottom
:
40px
;
text-align
:
center
;
color
:
#e1e1e1
;
font-size
:
2.3em
;
transition
:
all
.5s
ease-out
;
opacity
:
0
;
}
.peer
:hover
>
.video-controls
{
opacity
:
1
;
transition
:
all
.7s
ease-out
;
}
.video-controls
span
{
margin-right
:
30px
;
transition
:
all
.5s
ease-out
;
opacity
:
.5
;
cursor
:
pointer
;
text-shadow
:
2px
2px
4px
rgba
(
123
,
123
,
123
,
0.65
);
}
.video-controls
span
:last-child
{
margin-right
:
0
;
}
.video-controls
span
:hover
{
opacity
:
1
;
transition
:
opacity
.5s
ease-out
;
}
.video-controls
.volume
{
width
:
44px
;
display
:
inline-block
;
text-align
:
center
;
}
.mobile-container
{
display
:
block
!important
;
}
.login-container
{
height
:
calc
(
var
(
--vh
,
1vh
)
*
100
-
64
px
);
height
:
calc
(
var
(
--vh
,
1vh
)
*
100
-
56
px
);
position
:
relative
;
display
:
block
;
}
...
...
@@ -566,6 +606,7 @@ h1 {
/* force to fill height */
height
:
100%
!important
;
min-width
:
300px
;
overflow
:
hidden
;
}
#inputform
{
...
...
@@ -574,7 +615,7 @@ h1 {
#box
{
overflow
:
auto
;
height
:
calc
(
100%
-
60
px
);
height
:
calc
(
100%
-
53
px
);
padding
:
10px
;
}
...
...
@@ -641,7 +682,8 @@ h1 {
.media
{
width
:
100%
;
max-height
:
calc
(
var
(
--vh
,
1vh
)
*
100
-
84px
);
min-width
:
220px
;
/* min-size for controls buttons */
max-height
:
calc
(
var
(
--vh
,
1vh
)
*
100
-
76px
);
padding-bottom
:
20px
;
object-fit
:
contain
;
}
...
...
@@ -672,13 +714,13 @@ h1 {
}
.sidenav
a
{
padding
:
10px
;
padding
:
10px
20px
;
text-decoration
:
none
;
font-size
:
30px
;
color
:
#dbd9d9
;
display
:
block
;
transition
:
0.3s
;
line-height
:
1.
2
;
line-height
:
1.
0
;
}
.sidenav
a
:hover
{
...
...
@@ -689,7 +731,8 @@ h1 {
cursor
:
pointer
;
position
:
absolute
;
top
:
0
;
right
:
5px
;
right
:
0
;
height
:
56px
;
}
.sidenav
label
{
...
...
@@ -702,12 +745,16 @@ h1 {
margin-top
:
15px
;
}
.sidenav-header
{
height
:
56px
;
}
.sidenav-header
h2
{
color
:
#fff
;
padding
:
10px
;
margin
:
0
;
max-width
:
70%
;
line-height
:
44
px
;
line-height
:
36
px
;
}
.sidenav-content
{
...
...
@@ -841,13 +888,14 @@ header .collapse {
cursor
:
pointer
;
padding-top
:
5px
;
margin-right
:
20px
;
margin-left
:
5px
;
}
.sfu-header
{
font-size
:
1.3rem
;
font-weight
:
900
;
color
:
#dbd9d9
;
line-height
:
4
4px
;
line-height
:
3
4px
;
}
.header-sep
{
...
...
@@ -934,14 +982,6 @@ header .collapse {
display
:
none
;
}
.topnav
{
height
:
3.5rem
;
}
.users-header
{
height
:
3.5rem
;
}
.full-width
{
height
:
calc
(
var
(
--vh
,
1vh
)
*
100
-
56px
);
}
...
...
@@ -955,6 +995,10 @@ header .collapse {
margin-bottom
:
60px
;
}
.video-controls
{
opacity
:
1
;
}
.login-container
{
position
:
fixed
;
height
:
calc
(
var
(
--vh
,
1vh
)
*
100
-
56px
);
...
...
@@ -1010,6 +1054,8 @@ header .collapse {
display
:
block
;
}
.sidenav
a
{
padding
:
10px
5px
;}
.sidenav-header
h2
{
line-height
:
36px
;
}
...
...
static/sfu.html
View file @
fa694e67
...
...
@@ -186,6 +186,14 @@
</div>
</div>
<div
id=
"videocontrols-template"
class=
"invisible"
>
<div
class=
"video-controls"
>
<span
class=
"volume"
><i
class=
"fa fa-volume-up"
data-type=
"bt-volume"
aria-hidden=
"true"
></i></span>
<span
class=
"pip"
><i
class=
"fa fa-clone"
data-type=
"bt-pip"
aria-hidden=
"true"
></i></span>
<span
class=
"fullscreen"
><i
class=
"fa fa-arrows-alt"
data-type=
"bt-fullscreen"
aria-hidden=
"true"
></i></span>
</div>
</div>
<script
src=
"/protocol.js"
defer
></script>
<script
src=
"/scripts/toastify.js"
defer
></script>
<script
src=
"/sfu.js"
defer
></script>
...
...
static/sfu.js
View file @
fa694e67
...
...
@@ -953,7 +953,7 @@ function setMedia(c, isUp) {
media
.
autoplay
=
true
;
/** @ts-ignore */
media
.
playsinline
=
true
;
media
.
controls
=
tru
e
;
media
.
controls
=
fals
e
;
if
(
isUp
)
media
.
muted
=
true
;
div
.
appendChild
(
media
);
...
...
@@ -967,14 +967,99 @@ function setMedia(c, isUp) {
div
.
appendChild
(
label
);
}
let
template
=
document
.
getElementById
(
'
videocontrols-template
'
).
firstElementChild
;
let
controls
=
document
.
getElementById
(
'
controls-
'
+
c
.
id
);
if
(
template
&&
!
controls
)
{
controls
=
template
.
cloneNode
(
true
);
controls
.
id
=
'
controls-
'
+
c
.
id
;
div
.
appendChild
(
controls
);
if
(
media
.
muted
)
{
let
volume
=
controls
.
querySelector
(
"
.fa-volume-up
"
);
if
(
volume
)
{
volume
.
classList
.
remove
(
"
fa-volume-up
"
);
volume
.
classList
.
add
(
"
fa-volume-off
"
);
}
}
}
media
.
srcObject
=
c
.
stream
;
setLabel
(
c
);
setMediaStatus
(
c
);
showVideo
();
resizePeers
();
registerControlEvent
(
div
.
id
);
}
/**
* @param {HTMLVideoElement} video
*/
async
function
videoPIP
(
video
)
{
if
(
video
.
requestPictureInPicture
)
{
await
video
.
requestPictureInPicture
();
}
else
{
displayWarning
(
"
Video PIP Mode not supported!
"
);
}
}
/**
* @param {HTMLElement} target
*/
function
getParentVideo
(
target
)
{
// target is the <i> element, parent the div <div><span><i/></span></div>
let
control
=
target
.
parentElement
.
parentElement
;
let
hash
=
control
.
id
.
split
(
'
-
'
)[
1
];
let
media
=
/** @type {HTMLVideoElement} */
(
document
.
getElementById
(
'
media-
'
+
hash
));
if
(
!
media
)
{
displayWarning
(
"
Cannot find media!
"
);
}
return
media
;
}
/**
* @param {string} peerid
*/
function
registerControlEvent
(
peerid
)
{
let
peer
=
document
.
getElementById
(
peerid
);
let
control_list
=
peer
.
querySelectorAll
(
"
span
"
);
function
control_event
(
event
)
{
event
.
preventDefault
();
let
control_type
=
event
.
target
.
getAttribute
(
"
data-type
"
);
let
video
=
getParentVideo
(
event
.
target
);
switch
(
control_type
)
{
case
"
bt-volume
"
:
if
(
event
.
target
.
className
.
indexOf
(
"
fa-volume-off
"
)
!==
-
1
)
{
event
.
target
.
classList
.
remove
(
"
fa-volume-off
"
);
event
.
target
.
classList
.
add
(
"
fa-volume-up
"
);
video
.
muted
=
false
;
}
else
{
event
.
target
.
classList
.
remove
(
"
fa-volume-up
"
);
event
.
target
.
classList
.
add
(
"
fa-volume-off
"
);
// mute video sound
video
.
muted
=
true
;
}
break
;
case
"
bt-pip
"
:
videoPIP
(
video
);
break
;
case
"
bt-fullscreen
"
:
if
(
video
.
requestFullscreen
)
{
video
.
requestFullscreen
();
}
else
{
displayWarning
(
"
Video Fullscreen not supported!
"
);
}
break
;
}
}
for
(
let
i
=
0
;
i
<
control_list
.
length
;
i
+=
1
)
{
control_list
[
i
].
onclick
=
control_event
;
}
}
/**
* @param {string} id
*/
...
...
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