Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
H
hublot
Project overview
Project overview
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Yoann HOUPERT
hublot
Commits
d116a543
Commit
d116a543
authored
Apr 05, 2018
by
Yoann HOUPERT
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add activity vocality base
parent
ce8a1172
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
44 additions
and
5 deletions
+44
-5
lib/proxy.js
lib/proxy.js
+29
-5
lib/resume.js
lib/resume.js
+15
-0
No files found.
lib/proxy.js
View file @
d116a543
...
...
@@ -55,15 +55,39 @@ module.exports = config => {
}
function
kaldiWS
(
connectionToClient
,
resume
)
{
//Only manage one conf, manage room name later
const
streamData
=
resume
.
generateStream
();
let
participantsStream
=
{};
let
isInit
=
false
;
const
connectionToKaldi
=
new
WebSocket
(
config
.
services
.
kaldi
);
connectionToKaldi
.
on
(
'
open
'
,
()
=>
{
const
streamData
=
resume
.
generateStream
();
//When new user, new message array
const
userInformation
=
resume
.
userInformation
()
participantsStream
[
userInformation
]
=
[]
if
(
isInit
===
false
){
isInit
=
true
;
setInterval
(
function
(){
console
.
log
(
'
interval call
'
)
let
stream
=
resume
.
vocalActivity
(
participantsStream
);
if
(
stream
!==
undefined
){
connectionToKaldi
.
send
(
stream
,
{
binary
:
true
});
streamData
.
wstream
.
write
(
stream
);
}
},
100
)
}
connectionToClient
.
on
(
'
message
'
,
message
=>
{
connectionToKaldi
.
send
(
message
,
{
binary
:
true
});
streamData
.
wstream
.
write
(
message
);
//Push stream user
participantsStream
[
userInformation
].
push
(
message
);
});
connectionToKaldi
.
on
(
'
message
'
,
message
=>
{
...
...
lib/resume.js
View file @
d116a543
...
...
@@ -44,6 +44,10 @@ module.exports = config => {
fs
.
mkdirSync
(
config
.
folder
.
audio
);
}
},
userInformation
:
()
=>
{
return
uuidv1
()
},
generateStream
:
()
=>
{
if
(
timestamp
===
undefined
){
timestamp
=
new
Date
().
getTime
()
...
...
@@ -58,6 +62,17 @@ module.exports = config => {
}
return
streamData
},
vocalActivity
:
(
participantsStream
)
=>
{
const
keyMap
=
Object
.
keys
(
participantsStream
)
if
(
keyMap
){
for
(
let
i
=
0
;
i
<
keyMap
.
length
;
i
++
){
console
.
log
(
"
userId
"
,
keyMap
[
i
])
}
return
participantsStream
[
keyMap
[
0
]].
shift
();
}
return
undefined
;
},
endStream
:
(
streamData
)
=>
{
const
toSecond
=
1000
...
...
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