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
f9e05736
Commit
f9e05736
authored
Nov 30, 2020
by
Juliusz Chroboczek
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Implement remote mute.
parent
6040d194
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
32 additions
and
5 deletions
+32
-5
static/sfu.js
static/sfu.js
+32
-5
No files found.
static/sfu.js
View file @
f9e05736
...
...
@@ -403,8 +403,9 @@ function setButtonsVisibility() {
/**
* @param {boolean} mute
* @param {boolean} [reflect]
*/
function
setLocalMute
(
mute
)
{
function
setLocalMute
(
mute
,
reflect
)
{
muteLocalTracks
(
mute
);
let
button
=
document
.
getElementById
(
'
mutebutton
'
);
let
icon
=
button
.
querySelector
(
"
span .fas
"
);
...
...
@@ -417,6 +418,8 @@ function setLocalMute(mute) {
icon
.
classList
.
add
(
'
fa-microphone
'
);
button
.
classList
.
remove
(
'
muted
'
);
}
if
(
reflect
)
updateSettings
({
localMute
:
mute
});
}
getSelectElement
(
'
videoselect
'
).
onchange
=
function
(
e
)
{
...
...
@@ -447,8 +450,7 @@ document.getElementById('mutebutton').onclick = function(e) {
e
.
preventDefault
();
let
localMute
=
getSettings
().
localMute
;
localMute
=
!
localMute
;
updateSettings
({
localMute
:
localMute
})
setLocalMute
(
localMute
);
setLocalMute
(
localMute
,
true
);
}
document
.
getElementById
(
'
sharebutton
'
).
onclick
=
function
(
e
)
{
...
...
@@ -896,8 +898,7 @@ async function addFileMedia(file) {
let
presenting
=
!!
findUpMedia
(
'
local
'
);
let
muted
=
getSettings
().
localMute
;
if
(
presenting
&&
!
muted
)
{
setLocalMute
(
true
);
updateSettings
({
localMute
:
true
});
setLocalMute
(
true
,
true
);
displayWarning
(
'
You have been muted
'
);
}
}
...
...
@@ -1775,6 +1776,15 @@ function userCommand(c, r) {
serverConnection
.
userAction
(
c
,
id
,
p
[
1
]);
}
function
userMessage
(
c
,
r
)
{
let
p
=
parseCommand
(
r
);
if
(
!
p
[
0
])
throw
new
Error
(
`/
${
c
}
requires parameters`
);
let
id
=
findUserId
(
p
[
0
]);
if
(
!
id
)
throw
new
Error
(
`Unknown user
${
p
[
0
]}
`
);
serverConnection
.
userMessage
(
c
,
id
,
p
[
1
]);
}
commands
.
kick
=
{
parameters
:
'
user [message]
'
,
...
...
@@ -1811,6 +1821,13 @@ commands.unpresent = {
f
:
userCommand
,
};
commands
.
mute
=
{
parameters
:
'
user
'
,
description
:
'
mute a remote user
'
,
predicate
:
operatorPredicate
,
f
:
userMessage
,
};
function
handleInput
()
{
let
input
=
/** @type {HTMLTextAreaElement} */
(
document
.
getElementById
(
'
input
'
));
...
...
@@ -2101,6 +2118,16 @@ async function serverConnect() {
else
console
.
error
(
`Got unpriviledged message of kind
${
kind
}
`
);
break
;
case
'
mute
'
:
console
.
log
(
id
,
dest
,
username
);
if
(
priviledged
)
{
setLocalMute
(
true
,
true
);
let
by
=
username
?
'
by
'
+
username
:
''
;
displayWarning
(
`You have been muted
${
by
}
`
);
}
else
{
console
.
error
(
`Got unpriviledged message of kind
${
kind
}
`
);
}
break
;
default
:
console
.
warn
(
`Got unknown user message
${
kind
}
`
);
break
;
...
...
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