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
6a9ab969
Commit
6a9ab969
authored
Nov 24, 2020
by
Juliusz Chroboczek
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use default controls for streamed video.
parent
58ba37d8
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
58 additions
and
52 deletions
+58
-52
static/sfu.js
static/sfu.js
+58
-52
No files found.
static/sfu.js
View file @
6a9ab969
...
...
@@ -892,6 +892,7 @@ async function addFileMedia(file) {
let
url
=
URL
.
createObjectURL
(
file
);
let
video
=
document
.
createElement
(
'
video
'
);
video
.
src
=
url
;
video
.
controls
=
true
;
/** @ts-ignore */
let
stream
=
video
.
captureStream
();
...
...
@@ -1042,42 +1043,43 @@ function setMedia(c, isUp, video) {
div
.
appendChild
(
label
);
}
let
template
=
document
.
getElementById
(
'
videocontrols-template
'
)
.
firstElementChild
;
let
top_template
=
document
.
getElementById
(
'
top-videocontrols-template
'
)
.
firstElementChild
;
let
top_controls
=
document
.
getElementById
(
'
topcontrols-
'
+
c
.
id
);
if
(
template
&&
!
top_controls
)
{
top_controls
=
/** @type{HTMLElement} */
(
top_template
.
cloneNode
(
true
));
top_controls
.
id
=
'
topcontrols-
'
+
c
.
id
;
div
.
appendChild
(
top_controls
);
}
let
controls
=
document
.
getElementById
(
'
controls-
'
+
c
.
id
);
if
(
template
&&
!
controls
)
{
controls
=
/** @type{HTMLElement} */
(
template
.
cloneNode
(
true
));
controls
.
id
=
'
controls-
'
+
c
.
id
;
div
.
appendChild
(
controls
);
let
volume
=
controls
.
querySelector
(
"
.fa-volume-up
"
);
if
(
media
.
muted
)
{
if
(
volume
)
{
volume
.
classList
.
remove
(
"
fa-volume-up
"
);
volume
.
classList
.
add
(
"
fa-volume-off
"
);
}
if
(
!
video
)
{
let
template
=
document
.
getElementById
(
'
videocontrols-template
'
)
.
firstElementChild
;
let
top_template
=
document
.
getElementById
(
'
top-videocontrols-template
'
)
.
firstElementChild
;
let
top_controls
=
document
.
getElementById
(
'
topcontrols-
'
+
c
.
id
);
if
(
template
&&
!
top_controls
)
{
top_controls
=
/** @type{HTMLElement} */
(
top_template
.
cloneNode
(
true
));
top_controls
.
id
=
'
topcontrols-
'
+
c
.
id
;
div
.
appendChild
(
top_controls
);
}
let
camera
=
controls
.
querySelector
(
"
span.camera
"
);
if
(
local_media
&&
local_media
.
kind
===
"
local
"
)
{
if
(
!
settings
.
video
)
{
if
(
camera
)
camera
.
classList
.
add
(
"
camera-off
"
);
let
controls
=
document
.
getElementById
(
'
controls-
'
+
c
.
id
);
if
(
template
&&
!
controls
)
{
controls
=
/** @type{HTMLElement} */
(
template
.
cloneNode
(
true
));
controls
.
id
=
'
controls-
'
+
c
.
id
;
div
.
appendChild
(
controls
);
let
volume
=
controls
.
querySelector
(
"
.fa-volume-up
"
);
if
(
media
.
muted
)
{
if
(
volume
)
{
volume
.
classList
.
remove
(
"
fa-volume-up
"
);
volume
.
classList
.
add
(
"
fa-volume-off
"
);
}
}
volume
.
parentElement
.
remove
();
}
else
camera
.
remove
();
}
let
camera
=
controls
.
querySelector
(
"
span.camera
"
);
if
(
local_media
&&
local_media
.
kind
===
"
local
"
)
{
if
(
!
settings
.
video
)
{
if
(
camera
)
camera
.
classList
.
add
(
"
camera-off
"
);
}
volume
.
parentElement
.
remove
();
}
else
camera
.
remove
();
}
if
(
!
video
)
media
.
srcObject
=
c
.
stream
;
}
setLabel
(
c
);
setMediaStatus
(
c
);
...
...
@@ -1142,29 +1144,33 @@ function registerControlEvent(peerid) {
}
let
pip
=
/** @type {HTMLElement} */
(
peer
.
querySelector
(
"
span.pip
"
));
/** @ts-ignore */
if
(
HTMLVideoElement
.
prototype
.
requestPictureInPicture
)
{
pip
.
onclick
=
function
(
event
)
{
event
.
preventDefault
();
let
pip
=
/** @type{HTMLElement} */
(
event
.
target
);
let
video
=
getParentVideo
(
pip
);
videoPIP
(
video
);
};
}
else
{
pip
.
style
.
display
=
'
none
'
;
if
(
pip
)
{
/** @ts-ignore */
if
(
HTMLVideoElement
.
prototype
.
requestPictureInPicture
)
{
pip
.
onclick
=
function
(
event
)
{
event
.
preventDefault
();
let
pip
=
/** @type{HTMLElement} */
(
event
.
target
);
let
video
=
getParentVideo
(
pip
);
videoPIP
(
video
);
};
}
else
{
pip
.
style
.
display
=
'
none
'
;
}
}
let
fs
=
/** @type {HTMLElement} */
(
peer
.
querySelector
(
"
span.fullscreen
"
));
fs
.
onclick
=
function
(
event
)
{
event
.
preventDefault
();
let
fs
=
/** @type {HTMLElement} */
(
event
.
target
);
let
video
=
getParentVideo
(
fs
);
if
(
video
.
requestFullscreen
)
{
video
.
requestFullscreen
();
}
else
{
displayWarning
(
"
Video Fullscreen not supported!
"
);
}
};
if
(
fs
)
{
fs
.
onclick
=
function
(
event
)
{
event
.
preventDefault
();
let
fs
=
/** @type {HTMLElement} */
(
event
.
target
);
let
video
=
getParentVideo
(
fs
);
if
(
video
.
requestFullscreen
)
{
video
.
requestFullscreen
();
}
else
{
displayWarning
(
"
Video Fullscreen not supported!
"
);
}
};
}
let
camera
=
/** @type {HTMLElement} */
(
peer
.
querySelector
(
"
span.camera
"
));
if
(
camera
)
{
...
...
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