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
3fec0351
Commit
3fec0351
authored
May 04, 2020
by
Juliusz Chroboczek
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Let setLocal and SharedMedia take the new state as an explicit parameter.
parent
ac50973a
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
15 deletions
+15
-15
static/sfu.js
static/sfu.js
+15
-15
No files found.
static/sfu.js
View file @
3fec0351
...
...
@@ -123,12 +123,12 @@ function setConnected(connected) {
document
.
getElementById
(
'
presenterbox
'
).
onchange
=
function
(
e
)
{
e
.
preventDefault
();
setLocalMedia
();
setLocalMedia
(
this
.
checked
);
}
document
.
getElementById
(
'
sharebox
'
).
onchange
=
function
(
e
)
{
e
.
preventDefault
();
setShareMedia
();
setShareMedia
(
this
.
checked
);
}
async
function
updateStats
(
conn
,
sender
)
{
...
...
@@ -195,11 +195,11 @@ function displayStats(id) {
let
localMediaId
=
null
;
async
function
setLocalMedia
()
{
async
function
setLocalMedia
(
setup
)
{
if
(
!
getUserPass
())
return
;
if
(
!
document
.
getElementById
(
'
presenterbox
'
).
checked
)
{
if
(
!
setup
)
{
if
(
localMediaId
)
{
up
[
localMediaId
].
close
(
true
);
delete
(
up
[
localMediaId
]);
...
...
@@ -218,7 +218,7 @@ async function setLocalMedia() {
}
catch
(
e
)
{
console
.
error
(
e
);
document
.
getElementById
(
'
presenterbox
'
).
checked
=
false
;
await
setLocalMedia
();
await
setLocalMedia
(
false
);
return
;
}
localMediaId
=
await
newUpStream
();
...
...
@@ -240,11 +240,11 @@ async function setLocalMedia() {
let
shareMediaId
=
null
;
async
function
setShareMedia
()
{
async
function
setShareMedia
(
setup
)
{
if
(
!
getUserPass
())
return
;
if
(
!
document
.
getElementById
(
'
sharebox
'
).
checked
)
{
if
(
!
setup
)
{
if
(
shareMediaId
)
{
up
[
shareMediaId
].
close
(
true
);
delete
(
up
[
shareMediaId
]);
...
...
@@ -262,7 +262,7 @@ async function setShareMedia() {
}
catch
(
e
)
{
console
.
error
(
e
);
document
.
getElementById
(
'
sharebox
'
).
checked
=
false
;
await
setShareMedia
();
await
setShareMedia
(
false
);
return
;
}
shareMediaId
=
await
newUpStream
();
...
...
@@ -273,7 +273,7 @@ async function setShareMedia() {
let
sender
=
c
.
pc
.
addTrack
(
t
,
stream
);
t
.
onended
=
e
=>
{
document
.
getElementById
(
'
sharebox
'
).
checked
=
false
;
setShareMedia
();
setShareMedia
(
false
);
}
c
.
setInterval
(()
=>
{
updateStats
(
c
,
sender
);
...
...
@@ -408,10 +408,10 @@ function serverConnect() {
setConnected
(
false
);
document
.
getElementById
(
'
presenterbox
'
).
checked
=
false
;
document
.
getElementById
(
'
presenterbox
'
).
disabled
=
true
;
setLocalMedia
();
setLocalMedia
(
false
);
document
.
getElementById
(
'
sharebox
'
).
checked
=
false
;
document
.
getElementById
(
'
sharebox
'
).
disabled
=
true
;
setShareMedia
();
setShareMedia
(
false
);
for
(
let
id
in
down
)
{
let
c
=
down
[
id
];
delete
(
down
[
id
]);
...
...
@@ -541,10 +541,10 @@ function gotAbort(id) {
throw
new
Error
(
'
unknown up stream in abort
'
);
if
(
id
===
localMediaId
)
{
document
.
getElementById
(
'
presenterbox
'
).
checked
=
false
;
setLocalMedia
();
setLocalMedia
(
false
);
}
else
if
(
id
===
shareMediaId
)
{
document
.
getElementById
(
'
sharebox
'
).
checked
=
false
;
setShareMedia
();
setShareMedia
(
false
);
}
else
{
console
.
error
(
'
Strange stream in abort
'
);
delMedia
(
id
);
...
...
@@ -967,8 +967,8 @@ async function getIceServers() {
async
function
doConnect
()
{
await
serverConnect
();
await
setLocalMedia
();
await
setShareMedia
();
await
setLocalMedia
(
document
.
getElementById
(
'
presenterbox
'
).
checked
);
await
setShareMedia
(
document
.
getElementById
(
'
sharebox
'
).
checked
);
}
document
.
getElementById
(
'
userform
'
).
onsubmit
=
async
function
(
e
)
{
...
...
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