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
dbd87895
Commit
dbd87895
authored
Jun 11, 2020
by
Juliusz Chroboczek
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add visual feedback for connection status.
parent
4b32c55a
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
27 additions
and
0 deletions
+27
-0
static/sfu.css
static/sfu.css
+4
-0
static/sfu.js
static/sfu.js
+23
-0
No files found.
static/sfu.css
View file @
dbd87895
...
...
@@ -196,6 +196,10 @@ h1 {
width
:
100%
;
}
.media-failed
{
opacity
:
0.7
;
}
.label
{
text-align
:
center
;
height
:
2em
;
...
...
static/sfu.js
View file @
dbd87895
...
...
@@ -530,6 +530,7 @@ function setMedia(id) {
media
.
srcObject
=
c
.
stream
;
setLabel
(
id
);
setMediaStatus
(
id
,
false
);
resizePeers
();
}
...
...
@@ -545,6 +546,19 @@ function delMedia(id) {
resizePeers
();
}
function
setMediaStatus
(
id
,
good
)
{
let
media
=
document
.
getElementById
(
'
media-
'
+
id
);
if
(
!
media
)
{
console
.
warn
(
'
Setting status of unknown media.
'
);
return
;
}
if
(
good
)
media
.
classList
.
remove
(
'
media-failed
'
);
else
media
.
classList
.
add
(
'
media-failed
'
);
}
function
setLabel
(
id
,
fallback
)
{
let
label
=
document
.
getElementById
(
'
label-
'
+
id
);
if
(
!
label
)
...
...
@@ -725,6 +739,12 @@ async function gotOffer(id, labels, offer) {
});
};
pc
.
oniceconnectionstatechange
=
e
=>
{
setMediaStatus
(
id
,
pc
.
iceConnectionState
===
'
connected
'
||
pc
.
iceConnectionState
===
'
completed
'
);
}
c
.
pc
.
ontrack
=
function
(
e
)
{
let
label
=
e
.
transceiver
&&
c
.
labelsByMid
[
e
.
transceiver
.
mid
];
if
(
label
)
{
...
...
@@ -1178,6 +1198,9 @@ async function newUpStream(id) {
};
pc
.
oniceconnectionstatechange
=
e
=>
{
setMediaStatus
(
id
,
pc
.
iceConnectionState
===
'
connected
'
||
pc
.
iceConnectionState
===
'
completed
'
);
if
(
pc
.
iceConnectionState
===
'
failed
'
)
{
try
{
pc
.
restartIce
();
...
...
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