Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
sfu
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
Alain Takoudjou
sfu
Commits
3c607a6e
Commit
3c607a6e
authored
Nov 08, 2020
by
Juliusz Chroboczek
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Improve typing, reindent.
parent
3c57cc77
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
63 additions
and
60 deletions
+63
-60
static/sfu.js
static/sfu.js
+63
-60
No files found.
static/sfu.js
View file @
3c607a6e
...
@@ -758,9 +758,10 @@ async function addLocalMedia(id, disableVideo) {
...
@@ -758,9 +758,10 @@ async function addLocalMedia(id, disableVideo) {
let
settings
=
getSettings
();
let
settings
=
getSettings
();
let
audio
=
settings
.
audio
?
{
deviceId
:
settings
.
audio
}
:
false
;
let
audio
=
settings
.
audio
?
{
deviceId
:
settings
.
audio
}
:
false
;
let
video
=
false
;
let
video
=
if
(
!
disableVideo
)
disableVideo
?
false
:
video
=
settings
.
video
?
{
deviceId
:
settings
.
video
}
:
false
;
settings
.
video
?
{
deviceId
:
settings
.
video
}
:
false
;
if
(
audio
)
{
if
(
audio
)
{
if
(
settings
.
studioMode
)
{
if
(
settings
.
studioMode
)
{
...
@@ -1003,14 +1004,14 @@ function setMedia(c, isUp) {
...
@@ -1003,14 +1004,14 @@ function setMedia(c, isUp) {
.
firstElementChild
;
.
firstElementChild
;
let
top_controls
=
document
.
getElementById
(
'
topcontrols-
'
+
c
.
id
);
let
top_controls
=
document
.
getElementById
(
'
topcontrols-
'
+
c
.
id
);
if
(
template
&&
!
top_controls
)
{
if
(
template
&&
!
top_controls
)
{
top_controls
=
top_template
.
cloneNode
(
true
);
top_controls
=
/** @type{HTMLElement} */
(
top_template
.
cloneNode
(
true
)
);
top_controls
.
id
=
'
topcontrols-
'
+
c
.
id
;
top_controls
.
id
=
'
topcontrols-
'
+
c
.
id
;
div
.
appendChild
(
top_controls
);
div
.
appendChild
(
top_controls
);
}
}
let
controls
=
document
.
getElementById
(
'
controls-
'
+
c
.
id
);
let
controls
=
document
.
getElementById
(
'
controls-
'
+
c
.
id
);
if
(
template
&&
!
controls
)
{
if
(
template
&&
!
controls
)
{
controls
=
template
.
cloneNode
(
true
);
controls
=
/** @type{HTMLElement} */
(
template
.
cloneNode
(
true
)
);
controls
.
id
=
'
controls-
'
+
c
.
id
;
controls
.
id
=
'
controls-
'
+
c
.
id
;
div
.
appendChild
(
controls
);
div
.
appendChild
(
controls
);
if
(
media
.
muted
)
{
if
(
media
.
muted
)
{
...
@@ -1043,7 +1044,9 @@ function setMedia(c, isUp) {
...
@@ -1043,7 +1044,9 @@ function setMedia(c, isUp) {
* @param {HTMLVideoElement} video
* @param {HTMLVideoElement} video
*/
*/
async
function
videoPIP
(
video
)
{
async
function
videoPIP
(
video
)
{
/** @ts-ignore */
if
(
video
.
requestPictureInPicture
)
{
if
(
video
.
requestPictureInPicture
)
{
/** @ts-ignore */
await
video
.
requestPictureInPicture
();
await
video
.
requestPictureInPicture
();
}
else
{
}
else
{
displayWarning
(
"
Video PIP Mode not supported!
"
);
displayWarning
(
"
Video PIP Mode not supported!
"
);
...
@@ -1069,59 +1072,59 @@ function getParentVideo(target) {
...
@@ -1069,59 +1072,59 @@ function getParentVideo(target) {
* @param {string} peerid
* @param {string} peerid
*/
*/
function
registerControlEvent
(
peerid
)
{
function
registerControlEvent
(
peerid
)
{
let
settings
=
getSettings
();
let
settings
=
getSettings
();
let
peer
=
document
.
getElementById
(
peerid
);
let
peer
=
document
.
getElementById
(
peerid
);
//Add event listener when a video component is added to the DOM
//Add event listener when a video component is added to the DOM
peer
.
querySelector
(
"
span.volume
"
).
onclick
=
function
(
event
)
{
peer
.
querySelector
(
"
span.volume
"
).
onclick
=
function
(
event
)
{
event
.
preventDefault
();
event
.
preventDefault
();
let
video
=
getParentVideo
(
event
.
target
);
let
video
=
getParentVideo
(
event
.
target
);
if
(
event
.
target
.
className
.
indexOf
(
"
fa-volume-off
"
)
!==
-
1
)
{
if
(
event
.
target
.
className
.
indexOf
(
"
fa-volume-off
"
)
!==
-
1
)
{
event
.
target
.
classList
.
remove
(
"
fa-volume-off
"
);
event
.
target
.
classList
.
remove
(
"
fa-volume-off
"
);
event
.
target
.
classList
.
add
(
"
fa-volume-up
"
);
event
.
target
.
classList
.
add
(
"
fa-volume-up
"
);
video
.
muted
=
false
;
video
.
muted
=
false
;
}
else
{
}
else
{
event
.
target
.
classList
.
remove
(
"
fa-volume-up
"
);
event
.
target
.
classList
.
remove
(
"
fa-volume-up
"
);
event
.
target
.
classList
.
add
(
"
fa-volume-off
"
);
event
.
target
.
classList
.
add
(
"
fa-volume-off
"
);
// mute video sound
// mute video sound
video
.
muted
=
true
;
video
.
muted
=
true
;
}
}
};
};
peer
.
querySelector
(
"
span.pip
"
).
onclick
=
function
(
event
)
{
peer
.
querySelector
(
"
span.pip
"
).
onclick
=
function
(
event
)
{
event
.
preventDefault
();
event
.
preventDefault
();
let
video
=
getParentVideo
(
event
.
target
);
let
video
=
getParentVideo
(
event
.
target
);
videoPIP
(
video
);
videoPIP
(
video
);
};
};
peer
.
querySelector
(
"
span.fullscreen
"
).
onclick
=
function
(
event
)
{
peer
.
querySelector
(
"
span.fullscreen
"
).
onclick
=
function
(
event
)
{
event
.
preventDefault
();
event
.
preventDefault
();
let
video
=
getParentVideo
(
event
.
target
);
let
video
=
getParentVideo
(
event
.
target
);
if
(
video
.
requestFullscreen
)
{
if
(
video
.
requestFullscreen
)
{
video
.
requestFullscreen
();
video
.
requestFullscreen
();
}
else
{
}
else
{
displayWarning
(
"
Video Fullscreen not supported!
"
);
displayWarning
(
"
Video Fullscreen not supported!
"
);
}
}
};
};
let
camera
=
peer
.
querySelector
(
"
span.camera
"
);
let
camera
=
peer
.
querySelector
(
"
span.camera
"
);
if
(
camera
)
{
if
(
camera
)
{
peer
.
querySelector
(
"
span.camera
"
).
onclick
=
function
(
event
)
{
peer
.
querySelector
(
"
span.camera
"
).
onclick
=
function
(
event
)
{
event
.
preventDefault
();
event
.
preventDefault
();
let
video
=
getParentVideo
(
event
.
target
);
let
video
=
getParentVideo
(
event
.
target
);
let
id
=
video
.
id
.
split
(
"
-
"
)[
1
];
let
id
=
video
.
id
.
split
(
"
-
"
)[
1
];
if
(
!
settings
.
video
)
if
(
!
settings
.
video
)
return
;
return
;
if
(
event
.
target
.
getAttribute
(
"
data-type
"
)
===
"
bt-camera
"
)
{
if
(
event
.
target
.
getAttribute
(
"
data-type
"
)
===
"
bt-camera
"
)
{
addLocalMedia
(
id
,
true
);
addLocalMedia
(
id
,
true
);
event
.
target
.
setAttribute
(
"
data-type
"
,
"
bt-camera-off
"
);
event
.
target
.
setAttribute
(
"
data-type
"
,
"
bt-camera-off
"
);
event
.
target
.
parentElement
.
classList
.
add
(
"
disabled
"
);
event
.
target
.
parentElement
.
classList
.
add
(
"
disabled
"
);
}
else
{
}
else
{
event
.
target
.
setAttribute
(
"
data-type
"
,
"
bt-camera
"
);
event
.
target
.
setAttribute
(
"
data-type
"
,
"
bt-camera
"
);
event
.
target
.
parentElement
.
classList
.
remove
(
"
disabled
"
);
event
.
target
.
parentElement
.
classList
.
remove
(
"
disabled
"
);
addLocalMedia
(
id
);
addLocalMedia
(
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