Commit debaad3e authored by Yoann HOUPERT's avatar Yoann HOUPERT

Merge branch 'mfrere/hublot-webRTCAdapter'

parents 0ce98228 b10029e6
Pipeline #12877 failed with stage
......@@ -10,6 +10,8 @@ RUN apt-get update && apt-get install -y wget --no-install-recommends \
&& apt-get purge --auto-remove -y curl \
&& rm -rf /src/*.deb
RUN apt-get update && apt-get install -yq libgconf-2-4
WORKDIR /usr/src/app/hublot
COPY package.json .
......
......@@ -23,7 +23,7 @@
//
// It is the first file of the `controller` folder to be loaded in the client.
/* global robotController:true room document angular easyrtc */
/* global robotController:true document angular */
/* exported robotController */
robotController = {
......@@ -32,18 +32,20 @@ robotController = {
chatService: angular.element(document.body).injector().get('chat'),
getWebRTCAdapter: () => robotController.$injector.get('easyRTCAdapter'),
getWebRTCAdapter: () => {
return angular.element(document.body).injector().get('webRTCService');
},
getMyId: () => {
return easyrtc.myEasyrtcid;
return robotController.$injector.get('webRTCService').myRtcid();
},
getRemoteStream: participant => {
return easyrtc.getRemoteStream(participant);
return robotController.getWebRTCAdapter().getRemoteStream(participant);
},
getRemoteParticipants: () => {
const participants = easyrtc.getRoomOccupantsAsArray(room); // Note that room is exposed globally
const participants = robotController.getWebRTCAdapter().getRemoteRtcIds(); // Note that room is exposed globally
const res = [];
if (participants) {
for (let i = 0; i < participants.length; i++) {
......
......@@ -46,7 +46,7 @@ const angular = {
const easyRTCMock = (participantsWithStream, participantsWithoutStream = []) => ({
getRoomOccupantsAsArray: () => participantsWithStream
.concat(participantsWithoutStream),
.concat(participantsWithoutStream),
getRemoteStream: participant => {
// Participant must be in list of participants AND not be in the list
// of participants without stream.
......
......@@ -75,8 +75,8 @@ robotLib.reco = function (config) {
connected = false;
console.error('Online reco: STOMP failed to connect to',
config.reco.host, ':', config.reco.port,
'(trying again in', config.reco.reconnectInterval, 'ms)');
config.reco.host, ':', config.reco.port,
'(trying again in', config.reco.reconnectInterval, 'ms)');
console.error('Online reco: ' + err);
setTimeout(connection.tryConnect, config.reco.reconnectInterval);
});
......@@ -90,16 +90,16 @@ robotLib.reco = function (config) {
const connection = {
getReco: (confId, resolve, reject) => {
const ws = new WebSocket('ws://' + config.reco.host + ':' + config.reco.port + '/reco');
ws.onopen = function () {
ws.addEventListener('open', () => {
ws.send('/resources?id=' + confId + '&resources=keywords;wiki');
};
ws.onerror = function (event) {
});
ws.addEventListener('error', event => {
reject(event);
};
ws.onmessage = function (event) {
});
ws.addEventListener('message', event => {
ws.close();
resolve(event.data);
};
});
},
send: data => {
......@@ -108,32 +108,32 @@ robotLib.reco = function (config) {
start: confId => {
const ws = new WebSocket('ws://' + config.reco.host + ':' + config.reco.port + '/startstop');
ws.onopen = function () {
ws.addEventListener('open', () => {
ws.send('/stream?action=START&id=' + confId);
ws.close();
};
});
},
stop: confId => {
const ws = new WebSocket('ws://' + config.reco.host + ':' + config.reco.port + '/startstop');
ws.onopen = function () {
ws.addEventListener('open', () => {
ws.send('/stream?action=STOP&id=' + confId);
ws.close();
};
});
},
tryConnect: () => {
const ws = new WebSocket('ws://' + config.reco.host + ':' + config.reco.port + '/chat');
ws.onopen = function () {
ws.addEventListener('open', () => {
connected = true;
};
});
ws.onclose = function () {
connected = false;
};
ws.onerror = function () {
ws.addEventListener('error', () => {
setTimeout(connection.tryConnect, config.reco.reconnectInterval);
};
});
recoStompClient = ws;
}
};
......
......@@ -27,16 +27,16 @@ robotLib.stt = function (config) {
getTranscriptSocket: onSegment => {
try {
const ws = new WebSocket(config.gstreamerURL);
ws.onopen = function () {
ws.addEventListener('open', () => {
console.info('ws to stt module open');
};
});
ws.onclose = function () {
console.info('ws to stt module closed');
};
ws.onerror = function (event) {
ws.addEventListener('error', event => {
console.info('ws to stt module error: ' + event);
};
ws.onmessage = function (event) {
});
ws.addEventListener('message', event => {
const hyp = JSON.parse(event.data);
if (hyp.status === 0) {
if (hyp.result !== undefined && hyp.result.final) {
......@@ -59,7 +59,7 @@ robotLib.stt = function (config) {
});
}
}
};
});
return ws;
} catch (err) {
console.error(err);
......
......@@ -99,18 +99,21 @@ robot = {
text: e.from + '\t' + e.until + '\t' + easyrtcid + '\t' + e.text
});
});
ws.onerror = e => {
ws.addEventListener('error', e => {
// Try to open new connection on error
console.error('STT ws for ' + easyrtcid + ' error. Trying to reopen');
console.error(e);
robot.openSTTSocket(easyrtcid);
};
});
robot.recordedParticipantsWS[easyrtcid] = ws;
},
getUserStream(easyrtcid) {
const stream = robotController.getRemoteStream(easyrtcid);
robot.participantsMediaRecorders[easyrtcid] = robot.processAudio(stream, e => robot.recordedParticipantsWS[easyrtcid].send(e.data), 100);
robotController.getRemoteStream(easyrtcid).then(stream => {
if (stream !== undefined) {
robot.participantsMediaRecorders[easyrtcid] = robot.processAudio(stream, e => robot.recordedParticipantsWS[easyrtcid].send(e.data), 100);
}
});
},
recordParticipant(easyrtcid) {
......@@ -160,9 +163,11 @@ robot = {
robotLib.archive = robotLib.archive(robot.clientConfig);
robotController.onAttendeePush = (e, data) => {
if (data.easyrtcid !== robotController.getMyId()) {
robot.recordParticipant(data.easyrtcid);
}
robotController.getMyId().then(rtcid => {
if (data.rtcid !== rtcid) {
robot.recordParticipant(data.rtcid);
}
});
};
robotController.onAttendeeRemove = (e, data) => {
......@@ -191,9 +196,11 @@ robot = {
// Record current participants already present in the room
// (except the robot itself)
for (const participantId of robotController.getRemoteParticipants()) {
if (participantId !== robotController.getMyId()) {
robot.recordParticipant(participantId);
}
robotController.getMyId().then(rtcid => {
if (participantId !== rtcid) {
robot.recordParticipant(participantId);
}
});
}
// Wait 5 minute before leaving a room if alone
......
{
"visio": {
"url": "http://hubl.in"
"url": "http://janus.hubl.in"
},
"runner": {
"displayClientConsole": false,
......
......@@ -32,9 +32,9 @@ const create = (runner, modules, config) => {
}
controller.registry[room] = await runner.run(modules,
config.visio.url,
room,
config.client);
config.visio.url,
room,
config.client);
// Add callback for client to inform when it leaves the room
registerClientEndCallback(room);
......
......@@ -120,7 +120,7 @@ module.exports = config => {
}
} else {
console.error('Online reco: error trying to reach http://%s:%s/resources',
config.services.reco.host, config.services.reco.port);
config.services.reco.host, config.services.reco.port);
}
connectionToClient.close();
}
......
......@@ -93,6 +93,12 @@ module.exports = config => {
await submitButton.click();
console.log('runner: name submitted');
await page.$('#input_2');
console.log('runner: display contact invitation');
await page.waitFor(1000);
await page.keyboard.press('Escape');
console.log('runner: escape pressed');
await page.waitForSelector('[video-id=video-thumb8]');
console.log('runner: video exists');
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment