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
a2ab8c36
Commit
a2ab8c36
authored
Aug 23, 2020
by
Juliusz Chroboczek
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove up media when closing the socket.
parent
8fbd16cc
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
4 deletions
+12
-4
README.FRONTEND
README.FRONTEND
+5
-3
static/sfu.js
static/sfu.js
+7
-1
No files found.
README.FRONTEND
View file @
a2ab8c36
...
@@ -36,9 +36,11 @@ serverConnection.onclearchat = ...;
...
@@ -36,9 +36,11 @@ serverConnection.onclearchat = ...;
serverConnection.ondownstream = ...;
serverConnection.ondownstream = ...;
```
```
The `onconnected` callback is called when we connect to the server;
The `onconnected` callback is called when we connect to the server. The
`onclose` is the opposite of `onconnected`. `onusermessage` indicates
`onclose` callback is called when the socket is closed; you should use it
a message from the server that should be displayed to the user.
to close all your outgoing streams (incoming streams will be closed by the
server). `onusermessage` indicates a message from the server that should
be displayed to the user.
The other callbacks will only be called after you join a group. `onuser`
The other callbacks will only be called after you join a group. `onuser`
is used to indicate that a user has joined or left the current group.
is used to indicate that a user has joined or left the current group.
...
...
static/sfu.js
View file @
a2ab8c36
...
@@ -69,6 +69,7 @@ function gotConnected() {
...
@@ -69,6 +69,7 @@ function gotConnected() {
}
}
function
gotClose
(
code
,
reason
)
{
function
gotClose
(
code
,
reason
)
{
delUpMediaKind
(
null
);
setConnected
(
false
);
setConnected
(
false
);
if
(
code
!=
1000
)
if
(
code
!=
1000
)
console
.
warn
(
'
Socket close
'
,
code
,
reason
);
console
.
warn
(
'
Socket close
'
,
code
,
reason
);
...
@@ -395,10 +396,15 @@ function delUpMedia(c) {
...
@@ -395,10 +396,15 @@ function delUpMedia(c) {
setButtonsVisibility
()
setButtonsVisibility
()
}
}
/**
* delUpMediaKind reoves all up media of the given kind. If kind is
* falseish, it removes all up media.
* @param {string} kind
*/
function
delUpMediaKind
(
kind
)
{
function
delUpMediaKind
(
kind
)
{
for
(
let
id
in
serverConnection
.
up
)
{
for
(
let
id
in
serverConnection
.
up
)
{
let
c
=
serverConnection
.
up
[
id
];
let
c
=
serverConnection
.
up
[
id
];
if
(
c
.
kind
!=
kind
)
if
(
kind
&&
c
.
kind
!=
kind
)
continue
continue
c
.
close
(
true
);
c
.
close
(
true
);
delMedia
(
id
);
delMedia
(
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